Skip to content

Instantly share code, notes, and snippets.

@gumeniukcom
Last active September 28, 2015 00:47
Show Gist options
  • Save gumeniukcom/1357734 to your computer and use it in GitHub Desktop.
Save gumeniukcom/1357734 to your computer and use it in GitHub Desktop.
VIM config
set tabstop=4
set shiftwidth=4
set smarttab
set expandtab
set smartindent
set number
set wildmenu
set wcm=<Tab>
menu Exec.Make :!make <CR>
menu Exec.RUN :!./%< <CR>
menu Exec.Python :!python % <CR>
menu Exec.mc :!mc<CR>
map <F9> :emenu Exec.<Tab>
imap <F2> <Esc>:w<CR>
map <F2> <Esc>:w<CR>
imap <F3> <Esc>:!make <CR>
map <F3> <Esc>:!make <CR>
imap <F4> <Esc>:!./%< <CR>
map <F4> <Esc>:!./%< <CR>
imap <F5> <Esc>:browse tabnew<CR>
map <F5> <Esc>:browse tabnew<CR>
imap <F6> <Esc> :tabprev <CR>i
map <F6> :tabprev <CR>
imap <F7> <Esc> :tabnext <CR>i
map <F7> :tabnext <CR>
set wildmenu
set wcm=<Tab>
menu Exit.quit :quit<CR>
menu Exit.quit! :quit!<CR>
menu Exit.save :exit<CR>
map <F8> :emenu Exit.<Tab>
function! InsertTabWrapper(direction)
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
elseif "backward" == a:direction
return "\<c-p>"
else
return "\<c-n>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper ("forward")<cr>
inoremap <s-tab> <c-r>=InsertTabWrapper ("backward")<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment