Configure the vim plugins and other stuff.

2015 May 13 at 05:15 » Tagged as :vim, winetricks, plugins,

The story so far is that I have moved from pydev to vim, and then dumped the initial vim setup which used python mode in favour of setting everything up from scratch. Then struggled a bit with autocomplete for django and now it's time to tweak some of the plugins.

minibufexpl

Right-o now it's time to configure the plugins that were installed the other day. Let's start with minibufexpl they haven't made any key mappings so if you want to use it you need to keep typing in long commands or you need to create a map in your .vimrc file. Before doing that you can type :nmap to see what the current mappings are (you dont' want a conflict do you?) I chose <leader>\b for buffer explorer :MBEToggle and I am not bothered about open and close mappings. The next thing is to change the positioning from a horizontal split to a verticle and make it 20 columns wide, and also open on the left.

let g:miniBufExplVSplit = 20   " column width in chars
let g:miniBufExplBRSplit = 0
let g:miniBufExplStatusLineText = 'Buffers'

It also changes the minibufexpl's status bar to just buffers. Wonder if the status line can be removed completely.

Command-T

While minibufexpl might be cool it might actually be redundant because command-t has both a file and buffer select/search/autocomplete feature. In fact with Command-t installed you probably don't need NERDTree either. In my case the debugger took over both default mappings for the buffer and files and they had to be added back in with

nnoremap  t :CommandT
nnoremap  b :CommandTBuffer

Tasklist.

This one didn't survie. The plugin is five years old and can be replaced with a simple vim command (which is nothing more than a comment to a stackoverflow answer)

noremap <leader>todo :noautocmd vimgrep /TODO/j **/*.py<CR>:cw<CR>

Snipmate

Here is another one that didn't survive. I've never really liked using snippets. You are more likely to spend time thinking up usefull snippets and putting them into a file rather than actual coding. And this is a lot of extra stuff to remember.

Oh, BTW snipmate is often linked in blogs as msanders/snipmate.vim; that's indeed the original. However there is a more upto form at garbas/vim-snipmate this one doesn't have the snippets though, but you would probably want to look up snippets specific for your programming language than the rather generic (and outdated) snippets you find in the original repo.

NERD Commenter

It's one of the things I picked up from coming home to vim. NERD Commenter allows you to add remove comments very easily. If you never had to comment out a large chunk of code temporarily your brain is probably wired differently from everyone else's

 

Sparkup

If you write HTML (and with everyone claiming to be a full stack developer who doesn't?) you would love sparkup you write what looks like CSS and the plugin will convert that to a set of tags. Pretty nifty.

 

The keyboard mappings

use Ctrl-s to save files when in insert mode

imap <C-S> <ESC>:w<CR>i

add Ctrl-c, v, x support and also make vim use the system clipboard

" add 'standard' copy paste stuff 
vmap <C-c> "+y1
vmap <C-x> "+c
vmap <C-v> c<ESC>"+pg
imap <C-v> <C-r><C-o>+

" use the system clipboard so that lines yanked in vim can be pasted elsewhere
set clipboard=unnamed

Rope

Before ending this post, Let's get back to rope for a bit. The first time you open a project you will need to do :RopeGenerateAutoimportCache to set things up