A basic vimrc

There are some vim settings that I always add to my .vimrc config file. The nice thing about the command line text editors is that one can customize them to the nth degree. On the other hand, getting started can be overwhelming.

Here I suggest a few that of possible configurations that I consider to be essential to vastly improving usability. I write this article for those who are new to the world of command line interfaces (CLI). For offical vim documentation you may want to check out vim.org

Syntax highlighting

Not only does color make the view pop (I am a fan of color), it helps with navigating code. If you’re learning to code, your brain hasn’t formed the fluency yet. The colors can help with visualizing the syntax and improve readability.

syntax on

Vim has its own default syntax colorscheme, and a few of them as well. I like browsing a site like vimcolors for additional color schemes available.

When you find one you like, save the theme.vim file into your ~/.vim/colors location and turn on the colorscheme in your .vimrc file. Lately I’ve been using this theme called jellybean.

colorscheme jellybeans

View Line numbers

I like being able to see line numbers when debugging to find the specific chunk of code that the compiler/interpreter finds problematic. You could set this to be absolute [1-n] values or use relative numbers, which would be +/- from your current cursor position. Either way to turn on numbers, you want to set nu or set numbers.

set number

Note that without the visible line numbers, you could still navigate through a vim editor by jumping to specific line. For example to get to the 50th line you would use :50

Highlighting word search results

To round off the essential features of vim - highlighting the substring matched. In a sea of text, as a graphically visual person (I’m left handed, right brained), I read better when there’s color to highlight areas to focus.

set hlsearch

All together your barebones .vimrc might look like this:

syntax on
colorscheme jellybeans
set number
set hlsearch