Search code examples
browsersafarieditorkey-bindingsrich-text-editor

How to enable all default emacs key-bindings on the online programming editor on `hackerrank`?


I am using Safari version 13.1.1. macOS Catalina 10.15.5.

Today I have spent 8 hours in hackerrank unable to cut a line using Ctrl+k, it is so difficult when you get used to a keybinding and unable to use it for a long time. I have faced with same error on the editor on stackoverflow, which has an answer here. When I tested other default key-bindings some other also does not work.

  • Ctrl + k does not work to delete a line
  • Ctrl + Space does not work to select a line
  • Ctrl + _ does not do undo, I cannot even to redo
  • Ctrl + s does not do forward incremental search
  • Ctrl + i does not do indent

... and many more.

As an alternative solution, I wrote it on my local editor and copy it from there and paste it to the editor.


On the online editor at hacker-rank, it is mentioned that it provides Emacs as editor mode, but it does not let users to use all the main keybinds. Same issue occurs on the leetcode as well. You can see the example editor in these sites for letcode, hackerrank.

[Q] How can I enable all default emacs key-bindings on the online programming editor on hackerrank? Can I overwrite its .emacs file?


Solution

  • Just tried out and putting the emacs configuration the editor allows me to use Ctrl+K as a shortcut for deleting the line. I think you already know how to enable the emacs use, but just in case press the little engine on the top rigth corner and in editor mode choose emacs.

    It doesn't seem that will allow you to change keybindings, so honestly I would rather go for writing the code in my local text editor and copy-pasting once it is written.