Automatically close ( [ { and "
imap ( ()<Left>
imap [ []<Left>
imap { {}<Left>
imap " <C-V>"<C-V>"<Left>
Tab-Completion
function InsertTabWrapper(direction) " automagically decide what to do with <tab>
let col = col('.') -1 " <s-tab> in insert mode
if !col
return "\<tab>" " insert Tab at the beginning of the line
elseif a:direction < 0
return "\<c-p>" " insert Backward-Completion
elseif getline('.')[col - 1] == '<space>'
return "\<BS>\<TAB>" " replace <space><tab> with <tab>
elseif getline('.')[col - 1] !~ '\k'
return "\<tab>" " insert Tab if preceding character is not a keyword character
else
return "\<c-n>" " insert Forward-Completion
endfunction
inoremap <tab> <c-r>=InsertTabWrapper(1)<cr>
inoremap <s-tab> <c-r>=InsertTabWrapper(-1)<cr>