Developers

Introducing VIM and EMACS with HackerEarth

We get a lot valuable suggestions from our users on how we can make their experience of coding better on HackerEarth. One of them was support of Vim and Emacs in the code editor, and I am thrilled to share that our code editor now supports both the modes.

With a single setting button you can instantly shift to Vim or Emacs mode.

Select Vim or Emacs

Here is a short tutorial on how you can perform common actions in Vim and Emacs.

1. Delete all lines

Editing a file in Vim is easy. To delete all the contents of the file, keep the cursor at the start of the file and press d-Shift-G. In Emacs,  select everything, and then press “del.”

2. Remove only one line

If you to want to remove only one line, just press “dd” (d two times). And you can undo the last action by pressing “u”(undo). In Emacs, you can undo using the command Ctrl-x u.

If you press Ctrl-del in Emacs, this will delete the words in the line.

3. Edit one or two characters

If you want to remove only two or three characters from a word, take the cursor over to the characters and press “x.” To add some more characters, take the cursor to the right place and go to insert mode by pressing “i” and then type. In case you are doing it in Emacs the “del” key can be used to delete characters and adding new ones.

4. Word replace

Vim provides a very powerful way to find and replace words in a document. It allows you to use regular expressions to find patterns and replace them with new patterns. To replace a word with another word, go to command mode, type :%s/old word/new word/g and press enter. Here “old word” and “new word” can also be substituted with regular expressions as well.

5. Cursor Movement

To get to the start of the line in vim, you can use the “^” key and “$” key to go to the end of line. In Emacs, Ctrl-a takes you the beginning of a line and Ctrl-e takes you to the end.

In the next post, we will talk about creating a more comprehensive development experience in your local machine using Vim and Emacs.

Joydeep

Joydeep Bhattacharjee is a Category Head (Python) at HackerEarth. He likes to dabble in all things tech and is passionate about open source.

Share
Published by
Joydeep

Recent Posts

The complete guide to hiring a Full-Stack Developer using HackerEarth Assessments

Fullstack development roles became prominent around the early to mid-2010s. This emergence was largely driven…

4 weeks ago

Best Interview Questions For Assessing Tech Culture Fit in 2024

Finding the right talent goes beyond technical skills and experience. Culture fit plays a crucial…

1 month ago

Best Hiring Platforms in 2024: Guide for All Recruiters

Looking to onboard a recruiting platform for your hiring needs/ This in-depth guide will teach…

1 month ago

Best Assessment Software in 2024 for Tech Recruiting

Assessment software has come a long way from its humble beginnings. In education, these tools…

1 month ago

Top Video Interview Softwares for Tech and Non-Tech Recruiting in 2024: A Comprehensive Review

With a globalized workforce and the rise of remote work models, video interviews enable efficient…

1 month ago

8 Top Tech Skills to Hire For in 2024

Hiring is hard — no doubt. Identifying the top technical skills that you should hire…

3 months ago