Cover image for 5 Vim productivity tips to improve your workflow

5 Vim productivity tips to improve your workflow

nflamel profile image Fran C. ・3 min read

1. Remap the leader key to the space bar

let mapleader      = ' '

It might look strange, but think about how little you use it on normal mode. The space bar is a pretty accessible key on your keyboard and it will reduce your pinky pain.

2. Use Localvimrc to customize your vim per project

GitHub logo embear / vim-localvimrc

Search local vimrc files (".lvimrc") in the tree (root dir up to current dir) and load them.


This plugin searches for local vimrc files in the file system tree of the currently opened file. It searches for all ".lvimrc" files from the directory of the file up to the root directory. By default those files are loaded in order from the root directory to the directory of the file. The filename and amount of loaded files are customizable through global variables.

For security reasons it the plugin asks for confirmation before loading a local vimrc file and loads it using |:sandbox| command. The plugin asks once per session and local vimrc before loading it, if the file didn't change since previous loading.

It is possible to define a whitelist and a blacklist of local vimrc files that are loaded or ignored unconditionally.

The plugin can be found on Bitbucket, GitHub and VIM online.


The LocalVimRC command

Resource all local vimrc files for the…

I have lot of customizations for Vim, but making them work on each and every project I work is nearly impossible. For example for JavaScript/TypeScript. In some projects I just use plain JS, in others JS with Flow, in others TypeScript but a bit of plain JS too... and setting up vim with specific linters, shortcuts, etc for each one of them is painful.

Besides that, sometimes I don't want to make certain configurations public, so adding them to my public dot-files is not an option.

With this plugin you can easily (and more or less safely) keep those configurations scoped to the projects where you need them.

3. Spell check your markdown and git commits

augroup setSpelling

  autocmd FileType gitcommit setlocal spell spelllang=en_us
  autocmd FileType markdown setlocal spell spelllang=en_us
augroup END

If (like me) you're not a native English speaker it is even more helpful to have spell checking. This simple piece of config will spell check your git commit messages and the markdown you write.

Remember when Vim marks a spelling issue you can see the available options with z=. You want to know more about spelling? Check :help spell on Vim.

4. Use mnemonics for your shortcuts

I have a lot of shorcuts on Vim. Remembering them all is impossible. I group them with mnemonics which are simpler to remember. For example, all my git related mnemonics are grouped under <leader>g so <leader>gs means :Gstatus. Most are obvious, but I've added some comments where not.

nnoremap <leader>gs :Gstatus<CR>
nnoremap <leader>gc :Gcommit<CR>
nnoremap <leader>gC :Gcommit -n<CR> " commit but ignore hooks
nnoremap <leader>gP :Gpush<CR>
nnoremap <leader>gfP :Gpush --force-with-lease<CR>
nnoremap <leader>gp :Gpull<CR>
nnoremap <leader>gf :Gfetch<CR>
nnoremap <leader>gl :GV!<CR> " Git log for the current file
nnoremap <leader>gL :GV<CR> " Full git log
nnoremap <leader>gd :Gvdiff<CR>
nnoremap <leader>gb :Gblame<CR>
nnoremap <leader>gm :Git checkout master<CR>
nnoremap <leader>g- :Git checkout -<CR>
nnoremap <leader>grm :Grebase -i master<CR>

BTW, If you are interested those 2 use fugitive and gv

GitHub logo tpope / vim-fugitive

fugitive.vim: A Git wrapper so awesome, it should be illegal


I'm not going to lie to you; fugitive.vim may very well be the best Git wrapper of all time. Check out these features:

Bring up an enhanced version of git status with :G (also known as :Gstatus). Press g? to bring up a list of maps for numerous operations including diffing, staging, committing, rebasing, and stashing.

View any blob, tree, commit, or tag in the repository with :Gedit (and :Gsplit, :Gvsplit, :Gtabedit, ...). Edit a file in the index and write to it to stage the changes. Use :Gdiffsplit to bring up the staged version of the file side by side with the working tree version and use Vim's diff handling capabilities to stage a subset of the file's changes.

Commit, merge, and rebase with :Gcommit, :Gmerge, and :Grebase, using the current Vim instance to edit commit messages and the rebase todo…

GitHub logo junegunn / gv.vim

A git commit browser in Vim


A git commit browser.


gitv is nice. But I needed a faster, and possibly simpler alternative that I can use with a project with thousands of commits.


Requires fugitive.

Using vim-plug:

Plug 'tpope/vim-fugitive'
Plug 'junegunn/gv.vim'



  • :GV to open commit browser
    • You can pass git log options to the command, e.g. :GV -S foobar.
  • :GV! will only list commits that affected the current file
  • :GV? fills the location list with the revisions of the current file

:GV or :GV? can be used in visual mode to track the changes in the selected lines.


  • o or <cr> on a commit to display the content of it
  • o or <cr> on commits to display the diff in the range
  • O opens a new tab instead
  • gb for :Gbrowse
  • ]] and [[ to move between commits
  • . to start command-line with :Git [CURSOR]

From 2 of my favorite vim plugin authors. Tim Pope and Junegunn Choi

5. Learn how to navigate the help.

Vim's help is great. Not only that, most plugins you install come with a very well crafted help. Understanding how to navigate it makes your life easier. It is pretty easy:

  • :help to see the global vim help (yeah, that's pretty obvious)
  • :help command/topic/shortcut to see its help. E.g. :help :Gstatus, :help CTRL-W or :help sort
  • You'll see some words on the help are highlighted. Those are links and you can follow them with CTRL+]. If you want to go back to where you were you can use CTRL+o Link tag on vim help

Bonus: You don't know what you don't know...

Let me explain that: Vim can do A LOT, you don't know how much (and neither do I). The only way to do it is to research and play with it. Many of the things I do on my .vimrc come from other people's dotfiles.

There are literally thousands of dotfiles out there, people shares them (I do share mines!). If you are interested on improving your Vim's workflow go check them. Find famous Vim authors and check what they do. You'll be amazed on how much you will learn!

Posted on Oct 15 '19 by:

nflamel profile

Fran C.


I break code for a living... wait no, I fix it, most of the times. Well, sometimes.Yeah, I break code for a living.


markdown guide