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.

vimemac
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.”

gif_4

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.

gif_2

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

gif_8

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.

gif_5

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.

word_replace

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.

gif_7

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

Hackerearth Subscribe

Get advanced recruiting insights delivered every month

Hire top tech talent with our recruitment platform

Access Free Demo

Related reads

How Candidates Use Technology to Cheat in Online Technical Assessments
How Candidates Use Technology to Cheat in Online Technical Assessments

How Candidates Use Technology to Cheat in Online Technical Assessments

Article Summary How online assessments have transformed hiring Current state of cheating in online technical assessments Popular techniques candidates use to cheat Steps…

Talent Acquisition Strategies For Rehiring Former Employees
Talent Acquisition Strategies For Rehiring Former Employees

Talent Acquisition Strategies For Rehiring Former Employees

Former employees who return to work with the same organisation are essential assets. In talent acquisition, such employees are also termed as ‘Boomerang…

Automation in Talent Acquisition: A Comprehensive Guide
Automation in Talent Acquisition: A Comprehensive Guide

Automation in Talent Acquisition: A Comprehensive Guide

Automation has become a major element in the modern-day hiring process. The automated hiring process gained momentum since the advent of remote work…

Predictive Analytics for Talent Management
Predictive Analytics for Talent Management

Predictive Analytics for Talent Management

The job landscape in today’s age is highly competitive for both job seekers and hiring managers. Finding the right talent under such conditions…

How To Create A Positive Virtual Onboarding Experience?
How To Create A Positive Virtual Onboarding Experience?

How To Create A Positive Virtual Onboarding Experience?

The advent of the pandemic changed the hiring industry in many ways. One of the biggest outcomes of this global phenomenon was that…

How To Conduct A Recruitment SWOT Analysis?
How To Conduct A Recruitment SWOT Analysis?

How To Conduct A Recruitment SWOT Analysis?

A SWOT analysis is a business strategy to assess the Strengths, Weaknesses, Opportunities and Threats of a system. The exercise helps teams evaluate…

Hackerearth Subscribe

Get advanced recruiting insights delivered every month

View More

Top Products

Hackathons

Engage global developers through innovation

Hackerearth Hackathons Learn more

Assessments

AI-driven advanced coding assessments

Hackerearth Assessments Learn more

FaceCode

Real-time code editor for effective coding interviews

Hackerearth FaceCode Learn more

L & D

Tailored learning paths for continuous assessments

Hackerearth Learning and Development Learn more