dotfiles/vim/vimrc

58 lines
1.6 KiB
VimL

set nocompatible
" For when you forget to sudo.. Really Write the file.
cmap w!! w !sudo tee % >/dev/null
" This helps with RVM etc
set shell=zsh
" CTags
map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
set tags=tmp/tags;/,./tmp/tags;/,tags;/,./tags;/
cmap <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
let g:ragtag_global_maps = 1
" Align cucumber tables
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
" Prevents '<Plug>DiscretionaryEnd' being inserted when pressing <Enter> in
" insert mode on new files. Blame SuperTab
let g:SuperTabCrMapping = 0
let g:SuperTabDefaultCompletionType = "context"
" snipMate config
let g:snips_author = 'Bodaniel Jeanes'
"clojure
let vimclojure#ParenRainbow=1
autocmd FileType clojure AutoCloseOff
" Quick editing of common dot-files
map <Leader>vv :edit $MYVIMRC<CR>
map <Leader>gg :edit $MYGVIMRC<CR>
map <Leader>.. :cd ~/.config<CR>:enew<CR>
source ~/.vim/ui.vim
source ~/.vim/autocommands.vim
source ~/.vim/bundles.vim
if filereadable(expand('~/.vimrc.local'))
source ~/.vimrc.local
endif