Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
" --- Global settings
set nocompatible
syntax on
set ts=4 sw=4 noet hls ai
set bs=indent,eol,start
set hi=100
set laststatus=2
set incsearch
" --- netrw settings
let g:netrw_alto = 1
let g:netrw_altv = 1
hi CursorLine guibg=#F4F4F4
hi ColorColumn ctermbg=lightgrey guibg=#F4F4FF
" --- Global shortcuts
noremap <F3> :echo synIDattr(synID(line("."), col("."), 1), "name")<cr>
inoremap <F3> <CR><UP><END><CR><TAB>
noremap <F2> :w<CR>
inoremap <F2> <ESC>:w<CR>
noremap <F10> :n<CR>
" noremap <C-1> :silent !git show :1:<C-R>=expand("%")<CR> \| gview -<CR>
noremap <C-Down> :%y*<CR>
noremap <S-C-Down> "*yiw
noremap <C-q> :BufExplorer<CR>
noremap <M-C-q> :TlistToggle<CR>
noremap <M-Del> <C-w>c
noremap <C-CR> :cn<CR>:cc<CR>
noremap <S-C-CR> :cN<CR>:cc<CR>
noremap Q gq}
noremap <C-D> :windo :diffthis<CR>
noremap <C-S> :diffoff!<CR>
map <C-F9> :make<CR>
map <C-F10> :!ctags --append %<CR>
" --- Files navigation
map <C-f> :Explore<CR>
map <M-C-f> :Sexplore<CR>
map <M-C-t> :Texplore<CR>
" --- File types detection
au BufNewFile,BufRead *.json set ft=json ts=2 sw=2 et foldmethod=syntax | syntax sync fromstart
" Puppet
au BufNewFile,BufRead *.pp,*.pp.*tpl set ft=puppet | so /usr/share/vim/addons/syntax/puppet.vim
au BufNewFile,BufRead /**/sites-available/*.erb let b:eruby_subtype="apache" | set ft=eruby
au BufNewFile,BufRead **/modules/s2/**/*.pp map <buffer> <F9> :!puppet parser validate %<CR>
" Markdown
au BufNewFile,BufRead *.md set ft=markdown
au FileType markdown map <buffer> <F9> :!python -m markdown % ><C-r>=expand("%:r")<CR>.html<CR>
au FileType yaml setlocal foldmethod=indent et ts=2 sw=2
au FileType yaml map <buffer> <F9> :!perl -MYAML -e '$/=""; Load(<STDIN>)' <% <CR>
" --- Shell
au FileType sh map <buffer> <F9> :!bash %<CR>
" --- Python
au FileType python map <buffer> <F9> :!python %<CR>
au FileType python setlocal ts=4 sw=4 et makeprg=flake8\ % makeef=flake8.out
"errorformat=
" --- Ruby
au FileType ruby map <buffer> <F9> :!ruby %<CR>
" --- Berks
au BufNewFile,BufRead Berksfile set ft=ruby
" --- JSON
au BufNewFile,BufRead *.json map <buffer> <F9> :!python -m json.tool % >/dev/null && echo OK \|\| echo FAIL<CR>
set statusline=%f:%l:%c\ %r\ %m\ %y\ \ \ %=%p%%
" --- Taglist plugin
let Tlist_File_Fold_Auto_Close = 1
so /usr/share/vim-scripts/plugin/taglist.vim
au BufNewFile,BufRead *.sh,*.bash set ts=4 sw=4 noet
" --- Full screen
" http://askubuntu.com/questions/2140/is-there-a-way-to-turn-gvim-into-fullscreen-mode
map <silent> <F11> :call system("wmctrl -ir " . v:windowid . " -b toggle,fullscreen")<CR>
" http://vim.wikia.com/wiki/Omni_completion
set omnifunc=syntaxcomplete#Complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment