Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
152 lines (120 sloc) 3.63 KB
" =========================================
" KEYBINDS
" =========================================
if maparg('\\') ==# ''
xmap \\ <Plug>Commentary
nmap \\ <Plug>Commentary
nmap \\\ <Plug>CommentaryLine
endif
" enter fix - press enter and go to insert mode
map <M-Enter> O
map <Enter> o
" duplicate current line
nnoremap <C-d> Yp
" change location of current work directory
map <Leader>C :cd %:p:h<CR>
"f# keys
noremap <F1> :set invfullscreen<CR>
inoremap <F1> <ESC>:set invfullscreen<CR>a
nmap <silent> <F2> :NERDTreeToggle<CR>
inoremap <silent> <F2> <ESC>:NERDTreeToggle<CR>
nmap <silent> <F3> :GundoToggle<CR>
nmap <silent> <F5> :set invlist<CR>:set list?<CR>
nmap <silent> <F6> :set invwrap<CR>:set wrap?<CR>
nmap <silent> <F7> :set invhls<CR>:set hls?<CR>
nmap <silent> <F8> \C
" tabs
nnoremap tt :tabnew<cr>
" splits
noremap ,v :vsp^<cr>
noremap ,h :split^<cr>
" CTags
map <Leader>rt :!ctags --extra=+f --exclude=.git --exclude=coverage --exclude=.svn --exclude=log -R<CR><CR>
nnoremap <leader>r :CtrlPTag<CR><CR>
" Stupid shift key fixes
if has("user_commands")
command! -bang -nargs=? -complete=file E e<bang> <args>
command! -bang -nargs=? -complete=file W w<bang> <args>
command! -bang -nargs=? -complete=file Wq wq<bang> <args>
command! -bang -nargs=? -complete=file WQ wq<bang> <args>
command! -bang Wa wa<bang>
command! -bang WA wa<bang>
command! -bang Q q<bang>
command! -bang QA qa<bang>
command! -bang Qa qa<bang>
endif
" Yank from the cursor to the end of the line, to be consistent with C and D.
nnoremap Y y$
" Stop using <Insert>
nnoremap <Insert> <nop>
" Stop using arrows
" noremap <Up> <nop>
" noremap <Down> <nop>
" noremap <Left> <nop>
" noremap <Right> <nop>
" moving lines
nnoremap <C-DOWN> :m+<CR>==
nnoremap <C-UP> :m-2<CR>==
inoremap <C-DOWN> <Esc>:m+<CR>==gi
inoremap <C-UP> <Esc>:m-2<CR>==gi
vnoremap <C-DOWN> :m'>+<CR>gv=gv
vnoremap <C-UP> :m-2<CR>gv=gv
" expand path to file
map <leader>e :e ./
map <leader>ew :e <C-R>=expand("%:p:h") ."/"<CR>
map <leader>es :sp <C-R>=expand("%:p:h") ."/"<CR>
map <leader>ev :vsp <C-R>=expand("%:p:h") ."/"<CR>
map <leader>et :tabe <C-R>=expand("%:p:h") ."/"<CR>
" cycle through buffers with <ALT><Left> and <ALT><Right>
nmap <M-Left> :bprev<CR>
nmap <M-Right> :bnext<CR>
" cycle tabs with <CTRL><Left> and <CTRL><Right>
nmap <C-Left> :tabprev<CR>
nmap <C-Right> :tabnext<CR>
" fast save, close etc
nmap <leader>w :w!<CR>
nmap <leader>q :x!<CR>
nmap <leader>a :q!<CR>
nmap <leader>o :only!<CR>
" Keep search matches in the middle of the window.
nnoremap n nzzzv
nnoremap N Nzzzv
" Fugitive
nnoremap <leader>gd :Gdiff<cr>
nnoremap <leader>gs :Gstatus<cr>
nnoremap <leader>gw :Gwrite<cr>
nnoremap <leader>ga :Gadd<cr>
nnoremap <leader>gb :Gblame<cr>
nnoremap <leader>gco :Gcheckout<cr>
nnoremap <leader>gci :Gcommit<cr>
nnoremap <leader>gm :Gmove<cr>
nnoremap <leader>gr :Gremove<cr>
nnoremap <leader>gl :Shell git gl -18<cr>:wincmd \|<cr>
" Ctrlp
map <leader>t :CtrlPMixed<CR>
" Rgrep
map <C-f> :Rgrep<CR>
" enter command trick
nnoremap ; :
" vim-easymotion
" map / <Plug>(easymotion-sn)
" omap / <Plug>(easymotion-tn)
" map n <Plug>(easymotion-next)
" map N <Plug>(easymotion-prev)
" Bidirectional & within line 't' motion
" " Can be typed even faster than jj.
" imap jk <Esc>
" " Press i to enter insert mode, and ii to exit.
" imap ii <Esc>
" " Two semicolons are easy to type.
" imap ;; <Esc>
" " Press Shift-Space (may not work on your system).
" imap <S-Space> <Esc>
" " Or just Space to enter insert mode.
" nmap <Space> i
" map s :CtrlSpace<CR>
" map <C-t> :Runittest<CR>
" map <Leader>z :call RunNearestSpec()<CR>
map <leader>n :bn<cr>
map <leader>p :bp<cr>
map <leader>d :bd<cr>