Thinking in Vim | Living in the Command Line

permalink: /vim/

#tech #minimalism #linux

Vim is an essential command-line program. Not only is it one of the most widely installed text editors for Linux distributions, but many TUI applications also use VIM-like keybindings. Learning how to “think in vim” has allowed me to edit text such as this blog post with mouse-less efficiency.

However, vim has a bit of a steep learning curve. Not as insane as emacs or dwarf fortress, mind you, but steep enough to warrant an entire Github page detailing how to exit vim.

I found it incredibly useful to watch a video course available through O'Reilly. It covers how to edit, delete, copy, and paste text in vim; how to use macros; how to use the visual mode; and how to edit multiple files in vim. In short, it's a thorough overview of the vanilla vim experience, delegating customization, and plugin usage mostly to other resources like Modern Vim.

It's just nice to learn the vim keybindings if you're going to live in the command line. Cmus, a popular TUI music player, uses vim-like keybindings, and so does Zathura, a keyboard-centric ebook and pdf reader.

So far, the only changes I found to be absolutely necessary for using vanilla vim is setting hard tab length as 4 spaces with set tabstop=2 and set shiftwidth=4, and automatically enabling line numbering with set nu. Furthermore, I've set Neovim as my default version of vim through alias vim="nvim" in ~/.bashrc, though that is not necessary.

Becoming adept at editing text in the command-line with vim had another advantage: it made text-based productivity dead-simple to implement. I added alias today="vim ~/DIRECTORY/$(date +%Y-%m-%d).md" to ~/.bashrc so that typing “today” from anywhere in the command line brings up a markdown file with today's date and agenda. This simple script has made it effortless to bring up a text document to plan the day's tasks and agenda and to journal my progress.

One such file for a day may look like so:

* DUE: History essay
* Woke up at 7
* Breakfast, housework, admin till 9
* Homework till 12
* ...
* ...

Dear diary, .......

It's one of the most effective methods I've discovered to focus on today's tasks only without being bogged down by a lengthy todo list. And it's enabled by knowing vim and basic bash scripting.