153 lines
4.1 KiB
VimL
153 lines
4.1 KiB
VimL
|
nnoremap <SPACE> <Nop>
|
||
|
let g:mapleader = ' '
|
||
|
|
||
|
" easy config
|
||
|
nmap <S-F9> :e $HOME/.vimrc<CR>
|
||
|
nmap <S-F10> :so $HOME/.vimrc<CR>
|
||
|
|
||
|
" Force saving files that require root permission
|
||
|
command! SUDOwrite :execute 'w !sudo tee > /dev/null %' | edit!
|
||
|
|
||
|
" Bubble single lines
|
||
|
nmap <silent> <C-S-Up> :m-2<CR>==
|
||
|
nmap <silent> <C-S-Down> :m+<CR>==
|
||
|
imap <silent> <C-S-Up> <Esc>:m-2<CR>==gi
|
||
|
imap <silent> <C-S-Down> <Esc>:m+<CR>==gi
|
||
|
|
||
|
" Bubble multiple lines
|
||
|
vmap <silent> <C-S-Up> :m-2<CR>gv=gv
|
||
|
vmap <silent> <C-S-Down> :m'>+<CR>gv=gv
|
||
|
|
||
|
" Indent lines using <Left> and <Right>
|
||
|
vmap <C-S-Right> >gv
|
||
|
nmap <C-S-Right> >>
|
||
|
imap <C-S-Right> <Esc>>>i
|
||
|
vmap <C-S-Left> <gv
|
||
|
nmap <C-S-Left> <<
|
||
|
imap <C-S-Left> <Esc><<i
|
||
|
|
||
|
" moving through location list items
|
||
|
" noremap <S-Up> :lprevious<CR>
|
||
|
" noremap <S-Down> :lnext<CR>
|
||
|
|
||
|
" moving through buffers
|
||
|
" noremap <S-Left> :bn<CR>
|
||
|
" noremap <S-Right> :bp<CR>
|
||
|
noremap <leader>bd <Esc>:bd<CR>
|
||
|
noremap <leader>wc <Esc>:bd<CR>
|
||
|
noremap <leader>bo <Esc>:Bufonly<CR>
|
||
|
|
||
|
" Remap window commands
|
||
|
" map <leader>ws <Esc>:wincmd s<CR>
|
||
|
" map <leader>wv <Esc>:wincmd v<CR>
|
||
|
" map <leader>wc <Esc>:wincmd c<CR>
|
||
|
" map <leader>wn <Esc>:wincmd n<CR>
|
||
|
" map <leader>wo <Esc>:wincmd o<CR>
|
||
|
" map <leader>w+ <Esc>:wincmd _<CR>
|
||
|
" map <leader>w- <Esc>:wincmd <Bar><CR>
|
||
|
" map <leader>w= <Esc>:wincmd =<CR>
|
||
|
" nmap + :vertical resize +20<CR>
|
||
|
" nmap - :vertical resize -20<CR>
|
||
|
" map <C-S--> <Esc>:wincmd ><CR>
|
||
|
" map <C-Down> <Esc>:wincmd j<CR>
|
||
|
" map <C-j> <Esc>:wincmd j<CR>
|
||
|
" map <C-Up> <Esc>:wincmd k<CR>
|
||
|
" map <C-k> <Esc>:wincmd k<CR>
|
||
|
" map <C-Left> <Esc>:wincmd h<CR>
|
||
|
" map <C-h> <Esc>:wincmd h<CR>
|
||
|
" map <C-Right> <Esc>:wincmd l<CR>
|
||
|
" map <C-l> <Esc>:wincmd l<CR>
|
||
|
nnoremap <silent> <A-i> :wincmd K<CR>
|
||
|
nnoremap <silent> <A-k> :wincmd J<CR>
|
||
|
nnoremap <silent> <A-j> :wincmd H<CR>
|
||
|
nnoremap <silent> <A-l> :wincmd L<CR>
|
||
|
nnoremap <silent> <A-Up> :wincmd k<CR>
|
||
|
nnoremap <silent> <A-Down> :wincmd j<CR>
|
||
|
nnoremap <silent> <A-Left> :wincmd h<CR>
|
||
|
nnoremap <silent> <A-Right> :wincmd l<CR>
|
||
|
inoremap <silent> <A-Up> <Esc>:wincmd k<CR>
|
||
|
inoremap <silent> <A-Down> <Esc>:wincmd j<CR>
|
||
|
inoremap <silent> <A-Left> <Esc>:wincmd h<CR>
|
||
|
inoremap <silent> <A-Right> <Esc>:wincmd l<CR>
|
||
|
|
||
|
" tags
|
||
|
nmap <S-F3> :exec("tjump ".expand("<cword>"))<CR>
|
||
|
nmap <S-F4> :split<CR>:exec("tjump ".expand("<cword>"))<CR>
|
||
|
|
||
|
" trigger NERDTree, Tagbar $ Co.
|
||
|
nmap <leader>n <Esc>:NERDTreeToggle<CR>
|
||
|
nmap <leader>t <Esc>:TagbarToggle<CR>
|
||
|
" nmap <leader>f "zyaw :exe ":Ack ".@z.""<CR>
|
||
|
nmap <C-f> :CtrlP<CR>
|
||
|
nmap <C-t> :CtrlPTag<CR>
|
||
|
nmap <C-b> :CtrlPBuffer<CR>
|
||
|
|
||
|
" grep word under cursor
|
||
|
nnoremap <silent><leader>f :lgr! "\b<C-R><C-W>\b"<CR>:cw<CR>
|
||
|
|
||
|
" paste from system clipboard
|
||
|
inoremap <silent> <S-Insert> <ESC>:set paste<CR>"+p :set nopaste<CR>
|
||
|
|
||
|
" toggle spellcheck
|
||
|
nmap <silent> <S-F7> :setlocal spell! spelllang=en_us<CR>
|
||
|
|
||
|
" cursor jump
|
||
|
nnoremap <S-Up> 3k
|
||
|
inoremap <S-Up> <Esc>:-3<CR>i
|
||
|
vnoremap <S-Up> 3k
|
||
|
nnoremap <S-Down> 3j
|
||
|
inoremap <S-Down> <Esc>:+3<CR>i
|
||
|
vnoremap <S-Down> 3j
|
||
|
nnoremap <C-Up> 6k
|
||
|
inoremap <C-Up> <Esc>:-6<CR>i
|
||
|
vnoremap <C-Up> 6k
|
||
|
nnoremap <C-Down> 6j
|
||
|
inoremap <C-Down> <Esc>:+6<CR>i
|
||
|
vnoremap <C-Down> 6j
|
||
|
|
||
|
" scrolling
|
||
|
nnoremap <S-PageUp> 10<C-Y>
|
||
|
inoremap <S-PageUp> <Esc>10<C-Y>i
|
||
|
vnoremap <S-PageUp> 10<C-Y>
|
||
|
nnoremap <S-PageDown> 10<C-E>
|
||
|
inoremap <S-PageDown> <Esc>10<C-E>i
|
||
|
vnoremap <S-PageDown> 10<C-E>
|
||
|
|
||
|
" F keys
|
||
|
nmap <F2> :noh<CR>
|
||
|
imap <F2> <C-O>:noh<CR>
|
||
|
nmap <F3> :YcmCompleter GoToDeclaration<CR>
|
||
|
nmap <F4> :YcmCompleter GoTo<CR>
|
||
|
nmap <C-F4> :YcmCompleter GoTo<CR>:wincmd o<CR>
|
||
|
noremap <F5> :FufBuffer<CR>
|
||
|
nmap <F7> :call ManCurrentWord()<CR><CR>
|
||
|
nmap <F8> :call DevHelpCurrentWord()<CR><CR>
|
||
|
nnoremap <silent> <F10> :call NERDComment("n", "Toggle")<cr>
|
||
|
vnoremap <silent> <F10> <ESC>:call NERDComment("v", "Toggle")<cr>
|
||
|
" nmap <F4> <C-]>
|
||
|
|
||
|
" plugins etc
|
||
|
noremap <C-F> :NERDTreeToggle<CR>
|
||
|
noremap <C-B> :TagbarToggle<CR>
|
||
|
inoremap <C-B> <C-O>:TagbarToggle<CR>
|
||
|
|
||
|
" remap visual block
|
||
|
nnoremap <S-B> <c-v>
|
||
|
|
||
|
" write
|
||
|
noremap <C-s> :w<CR>
|
||
|
inoremap <C-s> <C-O>:w<CR>
|
||
|
|
||
|
" exit
|
||
|
noremap <C-q> :qa!<CR>
|
||
|
inoremap <C-q> <C-O>:qa!<CR>
|
||
|
|
||
|
" paste
|
||
|
nnoremap <C-V> "+gPl
|
||
|
vnoremap <C-V> :<C-U>call Paste("v")<CR>
|
||
|
inoremap <C-V> <C-O>:call Paste("i")<CR>
|
||
|
|
||
|
" select all
|
||
|
nnoremap <C-A> ggVG<CR>
|
||
|
inoremap <C-A> <C-O>:call Select()<CR>
|