143 lines
3.6 KiB
VimL
143 lines
3.6 KiB
VimL
" key #mappings{{{
|
||
let g:mapleader = ' '
|
||
|
||
" miscallaneous
|
||
"{{{
|
||
nnoremap : :setlocal norelativenumber<CR>:
|
||
nnoremap <silent> <space>rc :so $MYVIMRC<CR>
|
||
nnoremap <silent> <space>nn :set invrelativenumber<CR>
|
||
nnoremap <silent><expr> <space>nh (&hls && v:hlsearch ? ':nohls' : ':set hls')."\n"
|
||
nnoremap <silent> <space>sl :set invlist<CR>
|
||
nnoremap <space>aa A<left>
|
||
nnoremap <space>a2 A<left><left>
|
||
nnoremap <space>ab A<C-o>B
|
||
nnoremap <space>co :!clear;
|
||
" Focus on current fold, close the rest
|
||
nnoremap <silent> <space>zz zMzvzt
|
||
" replace current word with last yanked/deleted text
|
||
nnoremap <silent> <space>rr "_diwP
|
||
" replace current word with last yanked text
|
||
nnoremap <silent> <space>ry diw"0P
|
||
" quick grep of visual selection
|
||
vnoremap <space>gr y:grep! -R <C-r>" .
|
||
" open quickfix window of TODOs
|
||
nnoremap <space>td :grep! -R '// *TODO' .<CR>:botright cwindow<CR>:echo len(getqflist()) 'TODOs'<CR>
|
||
" devdocs mapping
|
||
nnoremap <space>dd :DD<CR>
|
||
" write and delete current buffer
|
||
nnoremap <space>bx :w\|bd<cr>
|
||
|
||
"}}}
|
||
|
||
" git mappings
|
||
"{{{
|
||
nnoremap <space>gs :Gstatus<CR>
|
||
nnoremap <space>gd :Gdiff<CR>
|
||
nnoremap <space>gD :!clear; echo 'git diff'; git diff<CR>
|
||
nnoremap <space>ga :!clear; git add %; git status<CR>
|
||
nnoremap <space>gA :!clear; git add .; git status<CR>
|
||
nnoremap <space>gc :Gcommit<CR>
|
||
nnoremap <space>gg :!clear; git add %; git commit -m ''<Left>
|
||
nnoremap <space>gp :!clear; echo 'git push'; git push<CR>
|
||
" nnoremap <space>gp :terminal echo ':git push' & git push<CR>
|
||
" nnoremap <space>gp :Gpush<CR>
|
||
" nnoremap <space>gp :pedit | read ! echo 'git push'; git push<CR>
|
||
nnoremap <space>gl :Glog<CR>
|
||
"}}}
|
||
|
||
" netrw
|
||
"{{{
|
||
nnoremap <space>ex :Ex<CR>
|
||
nnoremap <space>ee :e .<CR>
|
||
nnoremap <space>eq :Rex<CR>
|
||
"}}}
|
||
|
||
" better window/tab/buffer navigation/management
|
||
"{{{
|
||
" nnoremap <C-h> <C-w>h
|
||
" nnoremap <C-l> <C-w>l
|
||
" nnoremap <C-k> <C-w>k
|
||
" nnoremap <C-j> <C-w>j
|
||
|
||
nnoremap <Esc>j :resize -5<CR>
|
||
nnoremap <Esc>k :resize +5<CR>
|
||
nnoremap <Esc>l :vertical resize +5<CR>
|
||
nnoremap <Esc>h :vertical resize -5<CR>
|
||
" nnoremap <Esc>= <C-w>=
|
||
|
||
" nnoremap <space><space>h :vsplit<CR>
|
||
" nnoremap <space><space>l :vsplit<CR><C-w>l
|
||
" nnoremap <space><space>j :split<CR><C-w>j
|
||
" nnoremap <space><space>k :split<CR><C-w>k
|
||
|
||
" nnoremap <space><space>t :tabnew<CR>
|
||
" nnoremap <space><space>z :tabnew %<CR>
|
||
" nnoremap <space><space>q :tabclose<CR>gT<CR>
|
||
|
||
" nnoremap <space># :b#<CR>
|
||
|
||
nnoremap <silent> <Tab> :bnext<CR>
|
||
nnoremap <silent> <S-Tab> :bprev<cr>
|
||
"}}}
|
||
|
||
"location list and quickfix mappings
|
||
"{{{
|
||
nnoremap <space>lo :botright lwindow<CR>
|
||
nnoremap <up> :lprev<CR>zv
|
||
nnoremap <down> :lnext<CR>zv
|
||
nnoremap <space>lc :lclose<CR>
|
||
nnoremap <space>lh :lhistory<CR>
|
||
nnoremap <space>lp :lolder<CR>
|
||
nnoremap <space>ln :lnewer<CR>
|
||
|
||
nnoremap <space>qo :botright cwindow<CR>
|
||
nnoremap <left> :cprev<CR>zv
|
||
nnoremap <right> :cnext<CR>zv
|
||
nnoremap <space>qc :cclose<CR>
|
||
nnoremap <space>qh :chistory<CR>
|
||
nnoremap <space>qp :colder<CR>
|
||
nnoremap <space>qn :cnewer<CR>
|
||
"}}}
|
||
|
||
" insert mode mappings
|
||
"{{{
|
||
inoremap jkrg <c-o>:reg<cr>
|
||
inoremap :w<cr> :w<cr>
|
||
inoremap [:w<cr> :w<cr>
|
||
inoremap {:w<cr> :w<cr>
|
||
"}}}
|
||
|
||
" brace/quotes completion
|
||
"{{{
|
||
inoremap {{ {}<left>
|
||
inoremap {<CR> {<CR>}<C-o>O
|
||
inoremap {; {<CR>};<C-o>O
|
||
inoremap {{{ {{}}<Left><Left>
|
||
|
||
inoremap (( ()<Left>
|
||
inoremap (<CR> (<CR>)<C-o>O
|
||
inoremap (; ();<Left><Left>
|
||
|
||
inoremap [[ []<Left>
|
||
inoremap [<CR> [<CR>]<C-o>O
|
||
|
||
inoremap "" ""<Left>
|
||
inoremap """ ""
|
||
inoremap "; "";<Left><Left>
|
||
inoremap '' ''<Left>
|
||
inoremap ''' ''
|
||
inoremap '; '';<Left><Left>
|
||
|
||
"}}}
|
||
|
||
"}}}
|
||
|
||
" #abbreviations
|
||
"{{{
|
||
iabbrev adn and
|
||
iabbrev waht what
|
||
iabbrev tehn then
|
||
"}}}
|
||
|
||
" vim: foldmethod=marker
|