We receive many valuable suggestions from our users on how to improve their coding experience on HackerEarth. One frequent request was support for Vim and Emacs in the code editor. We’re excited to announce that our code editor now supports both modes!
With a single settings button, you can instantly switch to Vim or Emacs mode.
Here’s a short tutorial on how you can perform common actions in Vim and Emacs.
1. Delete All Lines
In Vim, place the cursor at the start of the file and press d⇧G
. In Emacs, select everything and press Delete
.
2. Remove a Single Line
In Vim, press dd
to delete the current line. Undo with u
. In Emacs, use Ctrl-x u
to undo.
To delete words in Emacs, use Ctrl+Delete
.
3. Edit Characters
In Vim, move to the character and press x
to delete. Enter insert mode with i
to type. In Emacs, use Delete
to remove characters and type to insert new ones.
4. Word Replace
In Vim, use :%s/old/new/g
to replace all occurrences of "old" with "new". This supports regular expressions too.
5. Cursor Movement
In Vim, use ^
to go to the beginning of a line and $
to go to the end. In Emacs, use Ctrl-a
to move to the start and Ctrl-e
to move to the end.
In the next post, we’ll talk about creating a more comprehensive development experience on your local machine using Vim and Emacs.