Vim editor is my daily driver when it comes to editing files in headless environment. Vim gains advantage because it can be customized with plugins, tons of keyboard shortcuts (though not quite easy to learn), and a lot of resources to gain mastery using it.

Here is my Vim configuration file, the ~/.vimrc.

" Specify directory
call plug#begin('~/.vim/plugged')

" installed plugins
Plug 'tpope/vim-fugitive'
Plug 'scrooloose/syntastic'
Plug 'itchyny/lightline.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'mbbill/undotree'
Plug 'flazz/vim-colorschemes'
Plug 'kien/ctrlp.vim'
Plug 'junegunn/goyo.vim'
Plug 'tpope/vim-surround'
Plug 'rhysd/vim-grammarous'
Plug 'reedes/vim-pencil'
Plug 'vim-scripts/vim-auto-save'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'vimwiki/vimwiki'
Plug 'avakhov/vim-yaml'
Plug 'plasticboy/vim-markdown'

" Initialize plugin system
call plug#end()

" Base Configs
colorscheme Monokai
set laststatus=2
syntax enable
set linebreak
set tabstop=2
set expandtab
set autoindent
set t_Co=256
set number
set backspace=2
set encoding=utf-8
set clipboard=unnamed
set backspace=indent,eol,start
set wildmenu
set incsearch
set hlsearch
set showmatch

" Netrw's config
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_altv = 1
let g:netrw_winsize = 25

" Vim-Markdown's config
let g:vim_markdown_folding_disabled=1
let g:vim_markdown_frontmatter=1

" Map Configs
nnoremap <space>u :UndotreeToggle<cr>
nnoremap <space>h :noh<cr>
nnoremap <space>as :AutoSaveToggle<cr>
nnoremap <space>sp :SoftPencil<cr>
nnoremap <space>g :Goyo<cr>
nnoremap <space>gg :Goyo!<cr>
nnoremap <space>gf :Goyo 75%x90%<cr>
nnoremap <space>gx :Goyo!<cr> <bar> :wq<cr>
nnoremap <space>fzf :BLines<cr>
nnoremap <space>n :tabnew
nnoremap <space>[ :tabp<cr>
nnoremap <space>] :tabn<cr>
nnoremap <space>ss :set spell spelllang=en_us<cr>
nnoremap <space>ww :w<cr>
nnoremap <space>wq :wq<cr>
nnoremap <space>ee :Vexplore<cr>

This ~/.vimrc config assumes the following (plus few tricks):


I forgot where & when I stole this .vimrc and I implemented them long ago. As of writing today (9 Apr 2018), I added a few more lines. I added plugins Goyo.vim for zen-mode Markdown editing, ctrlp.vim for quick search (within a folder), vim-colorschemes so that I can use badwolf theme, undotree so I can see the undo stack. Also this day, I added 8 custom keybindings utilizing the <space> key extensively.

For a full cheat sheet, go here.


This is a plugin and it is a bit pain to use at first, that is why I have a special section for that here.


To enable spellcheck, I do this:

:set spell spelllang=en_us

So in our ~/.vimrc, I now have this:

nnoremap <space>ss :set spell spelllang=en_us<cr> 

Which enables me to just hit Space followed rapidly by s twice to enable spellchecking.

To fix spelling error, go to that word first and toggle Insert Mode, then press Ctrl-x-s to invoke the spelling suggestions.