dotfiles/vim/vimrc.d/keybind.vim

94 lines
2.7 KiB
VimL

"" Keybinds
let mapleader=","
"" Kill
nnoremap <Leader>kb :BD<cr>
"" Toggles : t for toggle
" Toggle PasteMode
nnoremap <Leader>tp :set invpaste paste?<cr>
" Toggle wordwrap
nnoremap <Leader>tw :set wrap!<CR>
" Toggle Git Gutter :: Requires GitGutter
nnoremap <Leader>tg :GitGutterToggle<cr>
" Toggle Indent :: Requires Yggdroot/indentLine
nnoremap <leader>ti :IndentLinesToggle<cr>
" Tooggle Spell Check
nnoremap <leader>ts :setlocal spell! spelllang=en<CR>
" Toggle Relative Numbers
nnoremap <leader>t# :call NumberToggle()<cr>
" Toggle Syntastic :: Requires scrooloose/syntastic
nnoremap <leader>tc :SyntasticToggleMode<cr>
" Keybind ri
nnoremap <leader>ri :call ri#OpenSearchPrompt(0)<cr> " horizontal split"
nnoremap <leader>rk :call ri#LookupNameUnderCursor()<cr> " keyword lookup"
" vim-test mappings : T for Testing
nnoremap <silent> <Leader>Tt :TestFile<CR>
nnoremap <silent> <Leader>Ts :TestNearest<CR>
nnoremap <silent> <Leader>Tl :TestLast<CR>
nnoremap <silent> <Leader>Ta :TestSuite<CR>
nnoremap <silent> <leader>Tgt :TestVisit<CR>
" Enter for Nerd :: Requires Nerdtree
map <Leader><cr> :NERDTreeToggle<cr>
" Sudo Save :: Requires tpope/vim-eunuch
nnoremap <Leader>W :SudoWrite<cr>
" Quick Format : f for Format
nnoremap <silent> <Leader>fi :normal migg=G`i`
nnoremap <silent> <Leader>fw :FixWhitespace<cr>
vnoremap <silent> <Leader>ft :Tabularize /
nnoremap <silent> <Leader>fT :Tabularize /\zs<LEFT><LEFT><LEFT>
" Set File Type Use : F for Filetype
nnoremap <silent> <Leader>Fm :set filetype=markdown<CR>
nnoremap <silent> <Leader>Fv :set filetype=vim<CR>
nnoremap <silent> <Leader>Frb :set filetype=ruby<CR>
" Tagbar
nmap <F8> :TagbarToggle<CR>
" CTRL-P
map <F3> :CtrlPMRU<cr>
nnoremap <Leader>b :CtrlPBuffer<cr>
" Better Search :: Requires haya14busa/incsearch.vim
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
nnoremap <Space> :
" Better Subsitute :: Requires osyo-manga/vim-over
nnoremap <leader>s :OverCommandLine<CR> %s/
" Format XML
map @@x :%s/<\([^>]\)*>/\r&\r/g<enter>:g/^$/d<enter>vat=
" Switch windows with shift + jikl
nnoremap <S-l> :wincmd l<CR>
nnoremap <S-j> :wincmd j<CR>
nnoremap <S-h> :wincmd h<CR>
nnoremap <S-k> :wincmd k<CR>
" Line Switch
nnoremap <C-j> :m .+1<CR>==
nnoremap <C-k> :m .-2<CR>==
vnoremap <C-j> :m '>+1<CR>gv=gv
vnoremap <C-k> :m '<-2<CR>gv=gv
" Plug Stuff
nnoremap <leader>pi :PlugInstall<CR>
nnoremap <leader>pu :PlugUpdate<CR>
nnoremap <leader>ps :PlugStatus<CR>
" UltiSnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
imap <expr><C-k> pumvisible() ? "\<C-y><C-R>=UltiSnips#ExpandSnippet()<CR>" : "\<C-R>=UltiSnips#ExpandSnippet()<CR>"