diff options
Diffstat (limited to 'keys/mappings.vim')
-rw-r--r-- | keys/mappings.vim | 102 |
1 files changed, 47 insertions, 55 deletions
diff --git a/keys/mappings.vim b/keys/mappings.vim index 94db7ddb..0ae118d0 100644 --- a/keys/mappings.vim +++ b/keys/mappings.vim @@ -1,3 +1,4 @@ +" Basic Key Mappings imap <C-h> <C-w>h imap <C-j> <C-w>j @@ -12,67 +13,58 @@ nnoremap <Space> <Nop> vnoremap < <gv vnoremap > >gv -if exists('g:vscode') +" Better nav for omnicomplete +inoremap <expr> <c-j> ("\<C-n>") +inoremap <expr> <c-k> ("\<C-p>") -" Simulate same TAB behavior in VSCode -nmap <Tab> :Tabnext<CR> -nmap <S-Tab> :Tabprev<CR> +" I hate escape more than anything else +inoremap jk <Esc> +inoremap kj <Esc> -else - " Better nav for omnicomplete - inoremap <expr> <c-j> ("\<C-n>") - inoremap <expr> <c-k> ("\<C-p>") +" Easy CAPS +" inoremap <c-u> <ESC>viwUi +" nnoremap <c-u> viwU<Esc> - " I hate escape more than anything else - inoremap jk <Esc> - inoremap kj <Esc> +" TAB in general mode will move to text buffer +nnoremap <silent> <TAB> :bnext<CR> +" SHIFT-TAB will go back +nnoremap <silent> <S-TAB> :bprevious<CR> - " Easy CAPS - " inoremap <c-u> <ESC>viwUi - " nnoremap <c-u> viwU<Esc> +" Move selected line / block of text in visual mode +" shift + k to move up +" shift + j to move down +xnoremap K :move '<-2<CR>gv-gv +xnoremap J :move '>+1<CR>gv-gv - " TAB in general mode will move to text buffer - nnoremap <silent> <TAB> :bnext<CR> - " SHIFT-TAB will go back - nnoremap <silent> <S-TAB> :bprevious<CR> +" Alternate way to save +nnoremap <silent> <C-s> :w<CR> +" Alternate way to quit +nnoremap <silent> <C-Q> :wq!<CR> +" Use control-c instead of escape +nnoremap <silent> <C-c> <Esc> +" <TAB>: completion. +inoremap <silent> <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" - " Move selected line / block of text in visual mode - " shift + k to move up - " shift + j to move down - xnoremap K :move '<-2<CR>gv-gv - xnoremap J :move '>+1<CR>gv-gv +" Better window navigation +nnoremap <C-h> <C-w>h +nnoremap <C-j> <C-w>j +nnoremap <C-k> <C-w>k +nnoremap <C-l> <C-w>l - " Alternate way to save - nnoremap <silent> <C-s> :w<CR> - " Alternate way to quit - nnoremap <silent> <C-Q> :wq!<CR> - " Use control-c instead of escape - nnoremap <silent> <C-c> <Esc> - " <TAB>: completion. - inoremap <silent> <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" +" Terminal window navigation +tnoremap <C-h> <C-\><C-N><C-w>h +tnoremap <C-j> <C-\><C-N><C-w>j +tnoremap <C-k> <C-\><C-N><C-w>k +tnoremap <C-l> <C-\><C-N><C-w>l +inoremap <C-h> <C-\><C-N><C-w>h +inoremap <C-j> <C-\><C-N><C-w>j +inoremap <C-k> <C-\><C-N><C-w>k +inoremap <C-l> <C-\><C-N><C-w>l +tnoremap <Esc> <C-\><C-n> - - " Better window navigation - nnoremap <C-h> <C-w>h - nnoremap <C-j> <C-w>j - nnoremap <C-k> <C-w>k - nnoremap <C-l> <C-w>l - - " Terminal window navigation - tnoremap <C-h> <C-\><C-N><C-w>h - tnoremap <C-j> <C-\><C-N><C-w>j - tnoremap <C-k> <C-\><C-N><C-w>k - tnoremap <C-l> <C-\><C-N><C-w>l - inoremap <C-h> <C-\><C-N><C-w>h - inoremap <C-j> <C-\><C-N><C-w>j - inoremap <C-k> <C-\><C-N><C-w>k - inoremap <C-l> <C-\><C-N><C-w>l - tnoremap <Esc> <C-\><C-n> - - " Use alt + hjkl to resize windows - nnoremap <silent> <M-j> :resize -2<CR> - nnoremap <silent> <M-k> :resize +2<CR> - nnoremap <silent> <M-h> :vertical resize -2<CR> - nnoremap <silent> <M-l> :vertical resize +2<CR> -endif +" Use alt + hjkl to resize windows +nnoremap <silent> <M-j> :resize -2<CR> +nnoremap <silent> <M-k> :resize +2<CR> +nnoremap <silent> <M-h> :vertical resize -2<CR> +nnoremap <silent> <M-l> :vertical resize +2<CR> |