diff options
| author | Ariel D'Alessandro <ariel.dalessandro@auto1.com> | 2022-02-09 17:53:48 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-02-10 07:31:32 +0100 |
| commit | 77f5dd9693576af7fde80bdc99700f21eff01d6b (patch) | |
| tree | ebb4a64a4137c27b5771af8a95944b9dee92c8f5 /plugin/keymaps.vim | |
| parent | cd15d17a96390879c90e95ad90e0f75629e3eed7 (diff) | |
| download | nvim-conf-77f5dd9693576af7fde80bdc99700f21eff01d6b.tar.gz nvim-conf-77f5dd9693576af7fde80bdc99700f21eff01d6b.zip | |
WIP moving to all lua and new structure
Diffstat (limited to 'plugin/keymaps.vim')
| -rw-r--r-- | plugin/keymaps.vim | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/plugin/keymaps.vim b/plugin/keymaps.vim new file mode 100644 index 0000000..10f9bdb --- /dev/null +++ b/plugin/keymaps.vim @@ -0,0 +1,71 @@ +scriptencoding utf-8 + +nnoremap * /\<<C-R>=expand('<cword>')<CR>\><CR> +nnoremap # ?\<<C-R>=expand('<cword>')<CR>\><CR> + +vnoremap <leader>p "_dP + +nnoremap Y y$ + +nnoremap n nzzzv +nnoremap N Nzzzv +nnoremap J mzJ`z + +inoremap , ,<c-g>u +inoremap . .<c-g>u +inoremap ! !<c-g>u +inoremap ? ?<c-g>u +inoremap $ $<c-g>u +inoremap > ><c-g>u + +vnoremap < <gv +vnoremap > >gv + +nnoremap <leader>h :wincmd h<CR> +nnoremap <leader>j :wincmd j<CR> +nnoremap <leader>k :wincmd k<CR> +nnoremap <leader>l :wincmd l<CR> +nnoremap <leader>q :wincmd q<CR> +" Make windows to be basically the same size +nnoremap <leader>= <C-w>= + +nnoremap <leader>wv :vsp<CR> +nnoremap <leader>wh :sp<CR> + +nnoremap <C-j> :cnext<CR> +nnoremap <C-k> :cprev<CR> + +nnoremap <leader>i :lnext<CR> +nnoremap <leader>o :lprev<CR> + +nnoremap <leader>bd :bd<CR> + +nnoremap <expr> <leader>dp ":saveas " . expand('%') + +" For moving quickly up and down, +" Goes to the first line above/below that isn't whitespace +" Thanks to: http://vi.stackexchange.com/a/213 +nnoremap <silent> gj :let _=&lazyredraw<CR>:set lazyredraw<CR>/\%<C-R>=virtcol(".")<CR>v\S<CR>:nohl<CR>:let &lazyredraw=_<CR> +nnoremap <silent> gk :let _=&lazyredraw<CR>:set lazyredraw<CR>?\%<C-R>=virtcol(".")<CR>v\S<CR>:nohl<CR>:let &lazyredraw=_<CR> + +" Run the last command +nnoremap <leader><leader>c :<up> + + +if has('nvim') + " Make esc leave terminal mode + tnoremap <leader><Esc> <C-\><C-n> + tnoremap <Esc><Esc> <C-\><C-n> + + " Easy moving between the buffers + tnoremap <A-h> <C-\><C-n><C-w>h + tnoremap <A-j> <C-\><C-n><C-w>j + tnoremap <A-k> <C-\><C-n><C-w>k + tnoremap <A-l> <C-\><C-n><C-w>l + + " Try and make sure to not mangle space items + tnoremap <S-Space> <Space> + tnoremap <C-Space> <Space> +endif + +nnoremap <leader><leader>x :call alpha#save_and_exec()<cr> |