Github url


by amix

amix /vimrc

The ultimate Vim configuration (vimrc)

22.1K Stars 6.0K Forks Last release: Not found MIT License 399 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


The Ultimate vimrc

Over the last 10 years, I have used and tweaked Vim. This configuration is the ultimate vimrc (or at least my version of it).

There are two versions:

  • The Basic: If you want something small just copy basic.vim into your ~/.vimrc and you will have a good basic setup
  • The Awesome: Includes a ton of useful plugins, color schemes, and configurations

I would, of course, recommend using the awesome version.

How to install the Awesome version?

Install for your own user only

The awesome version includes a lot of great plugins, configurations and color schemes that make Vim a lot better. To install it simply do following from your terminal:

git clone --depth=1 ~/.vim\_runtime sh ~/.vim\_runtime/install\_awesome\

Install for multiple users

To install for multiple users, the repository needs to be cloned to a location accessible for all the intended users.

git clone --depth=1 /opt/vim\_runtime sh ~/.vim\_runtime/install\_awesome\ /opt/vim\_runtime user0 user1 user2 # to install for all users with home directories sh ~/.vim\_runtime/install\_awesome\ /opt/vim\_runtime --all



can be any directory, as long as all the users specified have read access.


I recommend using IBM Plex Mono font (it's an open-source and awesome font that can make your code beautiful). The Awesome vimrc is already setup to try to use it.

Some other fonts that Awesome will try to use:

How to install the Basic version?

The basic version is just one file and no plugins. Just copy basic.vim and paste it into your vimrc.

The basic version is useful to install on remote servers where you don't need many plugins, and you don't do many edits.

git clone --depth=1 ~/.vim\_runtime sh ~/.vim\_runtime/install\_basic\

How to install on Windows?

Use gitforwindows to checkout the repository and run the installation instructions above. No special instructions needed ;-)

How to install on Linux

If you have vim aliased as


instead of


, make sure to either alias it:

alias vi=vim

. Otherwise,

apt-get install vim

How to update to latest version?

Just do a git rebase!

cd ~/.vim\_runtime git pull --rebase python update\

Some screenshots

Colors when editing a Python file:

Screenshot 1

NERD Tree plugin in a terminal window: Screenshot 3

Distraction free mode using goyo.vim and vim-zenroom2: Screenshot 4

Included Plugins

I recommend reading the docs of these plugins to understand them better. Each plugin provides a much better Vim experience!

  • ack.vim: Vim plugin for
    (ag) or ack -- a wicked fast grep
  • Quickly and easily switch between buffers. This plugin can be opened with
  • ctrlp.vim: Fuzzy file, buffer, mru and tag finder. It's mapped to
  • goyo.vim and vim-zenroom2:
  • lightline.vim: A light and configurable statusline/tabline for Vim
  • NERD Tree: A tree explorer plugin for vim
  • open_file_under_cursor.vim: Open file under cursor when pressing
  • pathogen.vim: Manage your vim runtimepath
  • snipmate.vim: snipmate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim
  • ale: Syntax and lint checking for vim (ALE requires NeoVim >= 0.2.0 or Vim 8 with +timers +job +channel)
  • vim-commentary: Comment stuff out. Use
    to comment out a line (takes a count),
    to comment out the target of a motion.
    uncomments a set of adjacent commented lines.
  • vim-expand-region: Allows you to visually select increasingly larger regions of text using the same key combination
  • vim-fugitive: A Git wrapper so awesome, it should be illegal
  • vim-indent-object: Defines a new text object representing lines of code at the same indent level. Useful for python/vim scripts
  • vim-multiple-cursors: Sublime Text style multiple selections for Vim, CTRL+N is remapped to CTRL+S (due to YankRing)
  • vim-yankstack: Maintains a history of previous yanks, changes and deletes
  • vim-zenroom2 Remove all clutter and focus only on the essential. Similar to iA Writer or Write Room
  • gist-vim Easily create gists from Vim using the

Included color schemes

Included modes

How to include your own stuff?

After you have installed the setup, you can create ~/.vim_runtime/my_configs.vim to fill in any configurations that are important for you. For instance, my my_configs.vim looks like this:

~/.vim\_runtime (master)\> cat my\_configs.vim map <leader>ct :cd ~/Desktop/Todoist/todoist<cr>
map <leader>cw :cd ~/Desktop/Wedoist/wedoist<cr> 

You can also install your plugins, for instance, via pathogen you can install vim-rails:

cd ~/.vim\_runtime git clone git:// my\_plugins/vim-rails

Key Mappings

The leader is


, so whenever you see


it means



Normal mode mappings

Fast saving of a buffer (



nmap <leader>w :w!<cr>





(search) and




(backwards search):

map <space> /
map <c-space> ?
map <silent> <leader><cr> :noh<cr>

Disable highlights when you press



map <silent> <leader><cr> :noh<cr>

Smart way to move between windows (



map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-h> <c-w>h
map <c-l> <c-w>l

Closing of the current buffer(s) (


and (



" Close current buffer map <leader>bd :Bclose<cr>

" Close all buffers
map <leader>ba :1,1000 bd!<cr>

Useful mappings for managing tabs:

map <leader>tn :tabnew<cr>
map <leader>to :tabonly<cr>
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove 

" Opens a new tab with the current buffer's path
" Super useful when editing files in the same directory
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/

Switch CWD to the directory of the open buffer:

map <leader>cd :cd %:p:h<cr>:pwd<cr>



for fast search:

map <leader>g :Ack 

Quickly open a buffer for scripbble:

map <leader>q :e ~/buffer<cr>

Toggle paste mode on and off:

map <leader>pp :setlocal paste!<cr>

Visual mode mappings

Visual mode pressing




searches for the current selection:

vnoremap <silent> * :call VisualSelection('f')<cr>
vnoremap <silent> # :call VisualSelection('b')<cr>

When you press gv you


after the selected text:

vnoremap <silent> gv :call VisualSelection('gv', '')<cr>

When you press


you can search and replace the selected text:

vnoremap <silent> <leader>r :call VisualSelection('replace')<cr>

Surround the visual selection in parenthesis/brackets/etc.:

vnoremap $1 <esc>`&gt;a)<esc>`<i>
vnoremap $2 <esc>`&gt;a]<esc>`<i>
vnoremap $3 <esc>`&gt;a}<esc>`<i>
vnoremap $$ <esc>`&gt;a"<esc>`<i>
vnoremap $q <esc>`&gt;a'<esc>`<i>
vnoremap $e <esc>`&gt;a`<esc>`<i>

Insert mode mappings

Quickly insert parenthesis/brackets/etc.:

inoremap $1 ()<esc>i
inoremap $2 []<esc>i
inoremap $3 {}<esc>i
inoremap $4 {<esc>o}<esc>O
inoremap $q ''<esc>i
inoremap $e ""<esc>i
inoremap $t &lt;&gt;<esc>i

Insert the current date and time (useful for timestamps):

iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>

Command line mappings

$q is super useful when browsing on the command line. It deletes everything until the last slash:

cno $q <c->eDeleteTillSlash()<cr>

Bash like keys for the command line:

cnoremap <c-a> <home>
cnoremap <c-e> <end>
cnoremap <c-k> <c-u>

cnoremap <c-p> <up>
cnoremap <c-n> <down>

Write the file as sudo (works only on Unix). Super useful when you open a file and you don't have permissions to save your changes. Vim tip:


Plugin related mappings

Open bufexplorer to see and manage the current buffers (



map <leader>o :BufExplorer<cr>

Open ctrlp.vim plugin to quickly find a file or a buffer (





" Quickly find and open a file in the CWD let g:ctrlp\_map = '<c-f>'

" Quickly find and open a recently opened file
map <leader>f :MRU<cr>

" Quickly find and open a buffer
map <leader>b :CtrlPBuffer<cr>

NERD Tree mappings:

map <leader>nn :NERDTreeToggle<cr>
map <leader>nb :NERDTreeFromBookmark 
map <leader>nf :NERDTreeFind<cr>

goyo.vim and vim-zenroom2 lets you only focus on one thing at a time. It removes all the distractions and centers the content. It has a special look when editing Markdown, reStructuredText and textfiles. It only has one mapping. (



map <leader>z :Goyo<cr>

vim-multiple-cursors mappings to manage multiple cursors at once:

let g:multi\_cursor\_start\_word\_key = '<c-s>'
let g:multi_cursor_select_all_word_key = '<a-s>'
let g:multi_cursor_start_key = 'g<c-s>'
let g:multi_cursor_select_all_key = 'g<a-s>'
let g:multi_cursor_next_key = '<c-s>'
let g:multi_cursor_prev_key = '<c-p>'
let g:multi_cursor_skip_key = '<c-x>'
let g:multi_cursor_quit_key = '<esc>'

vim-yankstack mappings to manage the kill-ring (clipboard):

nmap <c-p> <plug>yankstack_substitute_older_paste
nmap <c-n> <plug>yankstack_substitute_newer_paste

ctrl-p mappings to easily find and open a file, buffer, etc.:

let g:ctrlp\_map = '<c-f>'
map <leader>j :CtrlP<cr>
map <c-b> :CtrlPBuffer<cr>

vim-snipmate mappings to autocomplete via snippets:

ino <c-j> <c-r>=snipMate#TriggerSnippet()<cr>
snor <c-j> <esc>i<right><c-r>=snipMate#TriggerSnippet()<cr>

vim-surround mappings to easily surround a string with


gettext annotation:

vmap Si S(i\_<esc>f)
au FileType mako vmap Si S"i${ _(<esc>2f"a) }<esc>

ale to easily go to the next Ale syntax/lint error:

nmap <silent> <leader>a <plug>(ale_next_wrap)

Spell checking



will toggle spell checking:

map <leader>ss :setlocal spell!<cr>

Shortcuts using


instead of special characters:

map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
map <leader>s? z=



:help cope

if you are unsure what cope is. It's super useful!

When you search with


, display your results in cope by doing:


To go to the next search result do:


To go to the previous search results do:


Cope mappings:

map <leader>cc :botright cope<cr>
map <leader>co ggVGy:tabnew<cr>:set syntax=qf<cr>pgg
map <leader>n :cn<cr>
map <leader>p :cp<cr>

How to uninstall

Just do following: * Remove


* Remove any lines that reference


in your


Looking for a remote-first job?

Maintaining this Vim configuration isn't my day job. Daily I am the founder/CEO of Doist. You could come and help us build the workplace of the future while living a balanced life (anywhere in the world 🌍🌎🌏).

PS: Using Vim isn't a requirement πŸ˜„

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.