Organize maps.vim
First, set mappings that work directly from normal mode, extend or cange the vim operations. After that, set leader mappings. When refactoring into leader / localleader mappings, this should probably be divided into first setting the leader mappings and then setting localleader for different contexts.
This commit is contained in:
parent
a054b717d2
commit
cc7b292bf5
1 changed files with 20 additions and 27 deletions
|
|
@ -12,6 +12,24 @@
|
||||||
" backspace to switch to alternate (last) buffer
|
" backspace to switch to alternate (last) buffer
|
||||||
nnoremap <BS> <C-^>
|
nnoremap <BS> <C-^>
|
||||||
|
|
||||||
|
" since u undoes, would it not make sense that U redoes?
|
||||||
|
nnoremap U <C-r>
|
||||||
|
|
||||||
|
" stronger versions of left,right - move all the way to beginning/end of line
|
||||||
|
nnoremap H ^
|
||||||
|
nnoremap L $
|
||||||
|
|
||||||
|
" move around between matching brackets with tab
|
||||||
|
nnoremap <tab> %
|
||||||
|
nnoremap <tab> %
|
||||||
|
|
||||||
|
" when in insertion mode, C-u uppercases the current word, C-l lowercases it,
|
||||||
|
inoremap <C-U> <esc>gUiw`]a
|
||||||
|
inoremap <C-u> <esc>guiw`]a
|
||||||
|
|
||||||
|
" yank filename to f buffer
|
||||||
|
nnoremap yf :let @f = expand("%")<cr>
|
||||||
|
|
||||||
" repeat the last substitute command with all its flags preserved
|
" repeat the last substitute command with all its flags preserved
|
||||||
noremap &
|
noremap &
|
||||||
\ :&&<CR>
|
\ :&&<CR>
|
||||||
|
|
@ -65,11 +83,9 @@ nnoremap <leader>/ :noh<cr>
|
||||||
nnoremap <leader>- :sp<cr>
|
nnoremap <leader>- :sp<cr>
|
||||||
nnoremap <leader>\ :vsp<cr>
|
nnoremap <leader>\ :vsp<cr>
|
||||||
|
|
||||||
" move around between matching brackets with tab
|
|
||||||
nnoremap <tab> %
|
|
||||||
nnoremap <tab> %
|
|
||||||
|
|
||||||
" Spell check set to <leader>O, 'o' for 'orthography':
|
" Spell check set to <leader>O, 'o' for 'orthography':
|
||||||
|
" Move to the prev/next spelling error with [S ]S
|
||||||
|
" Move to the prev/next spelling error or suggestion with [s ]s
|
||||||
noremap <leader>O :setlocal spell! spelllang=en_us<CR>
|
noremap <leader>O :setlocal spell! spelllang=en_us<CR>
|
||||||
noremap <leader>OE :setlocal spell! spelllang=en_us<CR>
|
noremap <leader>OE :setlocal spell! spelllang=en_us<CR>
|
||||||
noremap <leader>OG :setlocal spell! spelllang=de_de<CR>
|
noremap <leader>OG :setlocal spell! spelllang=de_de<CR>
|
||||||
|
|
@ -86,21 +102,6 @@ nnoremap <leader>V :vsp $MYVIMRC<cr>
|
||||||
" source vimrc with keystroke combination
|
" source vimrc with keystroke combination
|
||||||
nnoremap <leader>VV :source $MYVIMRC<cr>
|
nnoremap <leader>VV :source $MYVIMRC<cr>
|
||||||
|
|
||||||
" since u undoes, would it not make sense that U redoes?
|
|
||||||
nnoremap U <C-r>
|
|
||||||
|
|
||||||
" when in insertion mode, C-u uppercases the current word, C-l lowercases it,
|
|
||||||
inoremap <C-u> <esc>gUiw`]a
|
|
||||||
inoremap <C-l> <esc>guiw`]a
|
|
||||||
|
|
||||||
" get rid of the help message popping up when I miss esc and hit F1
|
|
||||||
nnoremap <F1> <ESC>
|
|
||||||
inoremap <F1> <ESC>
|
|
||||||
vnoremap <F1> <ESC>
|
|
||||||
|
|
||||||
" yank filename to f buffer
|
|
||||||
nnoremap yf :let @f = expand("%")<cr>
|
|
||||||
|
|
||||||
" remove all trailing whitespaces
|
" remove all trailing whitespaces
|
||||||
" on pressing space+W
|
" on pressing space+W
|
||||||
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
|
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
|
||||||
|
|
@ -190,11 +191,3 @@ nnoremap <silent> <leader>Q vapJgqap
|
||||||
|
|
||||||
" Enter distraction free prose mode with F11
|
" Enter distraction free prose mode with F11
|
||||||
noremap <F11> :Goyo<CR>
|
noremap <F11> :Goyo<CR>
|
||||||
|
|
||||||
" surround stuff with quotes, from normal or visual mode
|
|
||||||
nnoremap <leader>" viw<esc>a"<esc>bi"<esc>lel
|
|
||||||
vnoremap <leader>" <esc>`<i"<esc>`>la"<esc>l
|
|
||||||
|
|
||||||
" stronger versions of left,right - move all the way
|
|
||||||
nnoremap H ^
|
|
||||||
nnoremap L $
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue