My vim setup

April 13th, 2015
  • vim

Back to some python coding recently, I’ve been very frustrated with setting up virtualenv in eclipse/pydev, and as the other IDEs don’t satisfy me neither, I decided to give vim a chance ! After some googling, I managed to setup a really cool programming environment !

SPF13-vim

You can find it here: http://vim.spf13.com I’ve used vim occasionally, mainly to edit config files on my server, but would have never imagined how powerful vim can be with the help of plugins. After installing SPF13, I had to tune ~/.vimrc to be able to use fully some plugins. I’m running vim on ubuntu 14.04, maybe the following won’t apply for other OS.

~/.vimrc.before.local

let g:airline_powerline_fonts=1

This line enables special characters support in airline plugin: airline

Somehow airline displayed a strange character after the git icon, in gvim only. In order to fix airline in gvim, I had to install patched fonts from https://github.com/powerline/fonts. Just clone the repository, then install your favorite police (in my case inconsalata) with kde system settings > font management. Then change the following line in ~/.vimrc:

    if has('gui_running')
        set guioptions-=T           " Remove the toolbar
        set lines=40                " 40 lines of text instead of 24
        if !exists("g:spf13_no_big_font")
            if LINUX() && has("gui_running")
                "Replace this line with the following one: set guifont=Andale\ Mono\ Regular\ 12,Menlo\ Regular\ 11,Consolas\ Regular\ 12,Courier\ New\ Regular\ 14
                set guifont=Inconsolata\ for\ Powerline\ Regular\ 12
            elseif OSX() && has("gui_running")
                set guifont=Andale\ Mono\ Regular:h12,Menlo\ Regular:h11,Consolas\ Regular:h12,Courier\ New\ Regular:h14
            elseif WINDOWS() && has("gui_running")
                set guifont=Andale_Mono:h10,Menlo:h10,Consolas:h10,Courier_New:h10
            endif
        endif
    else

Buffet

vimawesome is a great resource to find plugins, and it’s where I found buffet. This plugin allows you to easily navigate through open buffers. To install it, edit ~/.vimrc.bundles.local:

Bundle 'sandeepcr529/Buffet.vim'

Then in vim just run :PluginInstall.

The default shortcut didn’t suited me, so I added a new one in ~/.vimrc.local:

nnoremap <Leader>l :Bufferlistsw <CR>

Here is how my ~/.vimrc.local looks like:

"Support for paste from clipboard (with middle click)
set mouse=
let g:used_javascript_libs = 'angularjs'
"Avoid complaints from syntax plugin for angular directives
let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute \"ng-"]
colorscheme beauty256
nnoremap <Leader>l :Bufferlistsw <CR>

As you can see, I added angular support, and changed the default color scheme. The command set mouse= is very useful as it allows you to paste in vim from your OS clipboard.