Vim

Being able to modify files and edit text from the command line is extremely important. There is a lot of overhead in opening a separate graphical text editor (like Sublime, VSCode, Atom, TextEdit, Notepad++, etc) and navigating to the file you want to edit, instead of directly opening a file where you are on the command line.

When you start working on remote servers (like NIH’s Biowulf), you may not have an easy option of using a graphical editor. This may require extra steps like transferring files to and from the server which dramatically slows down your work. Feeling at home in the terminal will pay off.

The two main command-line text editors are emacs and vim. If you haven’t already learned one of these, I suggest vim because it’s available on just about any machine you log on to, so you’ll always feel at home in a terminal.

It takes a lot of time and practice to get proficient with vim. But editing text is such a common task that improving your efficiency in any small way will pay off in the long term.

As a rule of thumb, you’ll be miserable for the first two weeks you’re learning vim. Everything will seem like it’s taking you way longer than it should. But then you’ll get more practice, and will be able to edit far faster than any other graphical text editor.

In fact, many graphical text editors have a “vim mode” for users who want to apply their vim skills to more efficient editing even within a GUI.

I have yet to meet someone who regretted learning vim. It’s well worth your time.

vimtutor

Once vim is installed, type vimtutor at the terminal and go through it.

Tips and Tricks

  • The search and replace functionality is very useful in vim. To do this you use the command :s (substitute). Check out Search and Replace for the many ways you can use this command.

Other resources

  • Here’s one example of a vim cheatsheet, but you might want to look around for something that fits your brain from a Google image search for them.

  • Learn Vim Progressively is one person’s view on a good pacing for learning vim.

  • A browser-based game that gets your fingers used to the Vim keybindings: Vim Adventures

  • Once you have some vim under your belt, you can try some of these to get some practice (might want to check the cheat-sheets before each one): Vim Dojo

  • There is a robust plugin ecosystem for vim. See my dotfiles for the vim plugins I use the most.