config/nvim/keys: reorder mappings

This commit is contained in:
xeruf 2021-05-08 20:23:57 +02:00
parent 3040ccda51
commit dab83792db
1 changed files with 28 additions and 27 deletions

View File

@ -1,47 +1,49 @@
let @c = '/^\n i```Ni```j0/``` lllkxNA'
" Save file as root when I forgot to use sudoedit " Save file as root when I forgot to use sudoedit
cnoremap w!! execute 'write !sudo tee % >/dev/null' <bar> edit! cnoremap w!! execute 'write !sudo tee % >/dev/null' <bar> edit!
" Write file & source vimrc (really only makes sense from within vimrc to quickly test changes) " Write file & source vimrc
" For quickly testing changes while editing vimrc
command! WS write <bar> source $MYVIMRC command! WS write <bar> source $MYVIMRC
command! FormatJSON %!python -m json.tool command! FormatJSON %!python -m json.tool
command! DiffSwap :diffsp % " Diff for swap - replaced by 'chrisbra/Recover.vim' command! DiffSwap :diffsp % " Diff for swap - superseded by 'chrisbra/Recover.vim'
"command! for dictcc
" @c now takes an indented code block and surrounds it in backticks instead
let @c = '/^\n i```Ni```j0/``` lllkxNA'
" Sane yanking " Sane yanking
map Y y$ map Y y$
" Disable Ex mode - https://vi.stackexchange.com/q/457 " Disable Ex mode - https://vi.stackexchange.com/q/457
nnoremap Q @q nnoremap Q @q
let mapleader=" " " Alias replace all to S
nmap <leader>" ysiW"
" Alias write and quit to leader
nnoremap <leader>q :wq<CR>
nnoremap <leader>w :w<CR>
" Easy split navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Shortcut split opening
nnoremap <leader>h :split<Space>
nnoremap <leader>v :vsplit<Space>
" Alias replace all to S
nnoremap S :%s//gI<Left><Left><Left> nnoremap S :%s//gI<Left><Left><Left>
" Jump around without shift " Jump around without shift
nnoremap gl $ nnoremap gl $
nnoremap gh 0 nnoremap gh 0
nnoremap gk H nnoremap gk H
nnoremap gj L nnoremap gj L
nnoremap gb G nnoremap gb G
" Enable and disable auto comment let mapleader=" "
" Shortcut for quoting current WORD
nmap <leader>" ysiW"
" Alias write and quit to leader
nnoremap <leader>q :wq<CR>
nnoremap <leader>w :w<CR>
" Easy split navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Shortcut split opening
nnoremap <leader>h :split<Space>
nnoremap <leader>v :vsplit<Space>
" Enable and disable auto comment
map <leader>c :setlocal formatoptions-=cro<CR> map <leader>c :setlocal formatoptions-=cro<CR>
map <leader>C :setlocal formatoptions=cro<CR> map <leader>C :setlocal formatoptions=cro<CR>
@ -51,7 +53,6 @@ map <leader>ls :setlocal colorcolumn=81,121 nowrap<CR>
map <leader>lw :setlocal colorcolumn=81 textwidth=80<CR> map <leader>lw :setlocal colorcolumn=81 textwidth=80<CR>
map <leader>ln :setlocal colorcolumn= textwidth=0 wrap<CR> map <leader>ln :setlocal colorcolumn= textwidth=0 wrap<CR>
" Quickly switch indentation settings
map <leader>t :setlocal shiftwidth=4 tabstop=4 noexpandtab<CR> map <leader>t :setlocal shiftwidth=4 tabstop=4 noexpandtab<CR>
map <leader>T :setlocal shiftwidth=2 expandtab<CR> map <leader>T :setlocal shiftwidth=2 expandtab<CR>
" }}}