Update bindings and add consistency

This commit is contained in:
2021-12-05 20:36:40 +00:00
parent 33211744c8
commit 6e6d769d6c

138
init.vim
View File

@@ -94,21 +94,21 @@ set splitright
"We'll set simpler mappings to switch between splits
"Decrease window size (replaces some weird netrw stuff)
nnoremap <C-H> <C-W>-
nnoremap <C-S-H> <C-W>-
"Increase window size (Redraws the screen, use :redraw instead)
nnoremap <C-L> <C-W>+
nnoremap <C-S-H> <C-W><C-H>
nnoremap <C-S-L> <C-W><C-L>
nnoremap <C-S-L> <C-W>+
nnoremap <C-H> <C-W><C-H>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-S-J> <C-W><C-J>
nnoremap <C-S-K> <C-W><C-K>
"Decrease window size (Backspace clone)
inoremap <C-H> <C-W>-
inoremap <C-S-H> <C-W>-
"Increase window size (Replaces leaving `insertmode`, don't use `insertmode`)
inoremap <C-L> <C-W>+
inoremap <C-S-H> <Esc><C-W><C-H>i
inoremap <C-S-L> <Esc><C-W><C-L>i
inoremap <C-S-J> <Esc><C-W><C-J>i
inoremap <C-S-K> <Esc><C-W><C-K>i
inoremap <C-S-L> <C-W>+
inoremap <C-H> <Esc><C-W><C-H>i
inoremap <C-L> <Esc><C-W><C-L>i
inoremap <C-J> <Esc><C-W><C-J>i
inoremap <C-K> <Esc><C-W><C-K>i
" }}}
" Search --- {{{
@@ -121,92 +121,92 @@ set path+=**
" Mappings --- {{{
" Editing files - {{{
"Make it easy to edit the vimrc file
nnoremap <Leader>ev :tabedit $MYVIMRC<cr>
nnoremap <Leader>ev :tabedit $MYVIMRC<CR>
"Source the vimrc file
nnoremap <Leader>es :source $MYVIMRC<cr>
nnoremap <Leader>es :source $MYVIMRC<CR>
" }}}
"Changing unused ctrl bindings
"Turn on git blame
nnoremap <c-s-a> <cmd>GBlame<cr>
nnoremap <C-S-A> <CMD>GBlame<CR>
"List all tags in the current buffer (replaced pageup, use CTRL-u instead)
nnoremap <c-b> <cmd>BTags<cr>
nnoremap <C-B> <CMD>BTags<CR>
"List all tags in directory
nnoremap <c-s-b> <cmd>Tags<cr>
nnoremap <C-S-B> <CMD>Tags<CR>
"List all the recently opened files (replaced scroll one line up, use "k")
nnoremap <c-e> <cmd>History<cr>
nnoremap <C-E> <CMD>History<CR>
"Search within the current buffer (replaced pagedown, use CTRL-d instead)
nnoremap <c-f> /
nnoremap <C-F> /
"Search within the whole project
nnoremap <c-s-f> <cmd>Rg<cr>
nnoremap <C-S-F> <CMD>Rg<CR>
"Move line down (uses vim-unimpaired) (replaced move down, use "j")
nnoremap <c-j> <c-e>
nnoremap <C-J> <C-E>
"Move line up (uses vim-unimpaired) (replaced move up, use "k")
nnoremap <c-k> <c-y>
nnoremap <C-K> <C-Y>
"Does not work because of legacy reasons
" nnoremap <c-m>
" nnoremap <C-M>
"Search marks (replaced "j" clone)
nnoremap <c-n> <cmd>Marks<cr>
nnoremap <C-N> <CMD>Marks<CR>
"Search version controlled files (replaced move up, use "k")
nnoremap <c-p> <cmd>GFiles<cr>
nnoremap <C-P> <CMD>GFiles<CR>
"Search all files in directory
nnoremap <c-s-p> <cmd>Files<cr>
nnoremap <C-S-P> <CMD>Files<CR>
"Toggle file draw
nnoremap <c-q> <cmd>CHADopen<cr>
nnoremap <C-Q> <CMD>CHADopen<CR>
"Search all snippets (uses ultisnips)
nnoremap <c-s> <cmd>Snippets<cr>
nnoremap <C-S> <CMD>Snippets<CR>
"Search git history (replaced scroll one line up, use "k")
nnoremap <c-y> <cmd>Commits<cr>
nnoremap <C-Y> <CMD>Commits<CR>
"Search git history within current buffer/selection
nnoremap <c-s-y> <cmd>BCommits<cr>
nnoremap <C-S-Y> <CMD>BCommits<CR>
"Turn on git blame
inoremap <c-s-a> <cmd>GBlame<cr>
inoremap <C-S-A> <CMD>GBlame<CR>
"List all tags in the current buffer
inoremap <c-b> <cmd>BTags<cr>
inoremap <C-B> <CMD>BTags<CR>
"List all tags in directory
inoremap <c-s-b> <cmd>Tags<cr>
inoremap <C-S-B> <CMD>Tags<CR>
"List all the recently opened files (replaced inserting characters from below)
inoremap <c-e> <cmd>History<cr>
inoremap <C-E> <CMD>History<CR>
"Search within the current buffer
inoremap <c-f> <Esc>/
inoremap <C-F> <Esc>/
"Search within the whole project
inoremap <c-s-f> <cmd>Rg<cr>
inoremap <C-S-F> <CMD>Rg<CR>
"Move line down (uses vim-unimpaired) (replaced <CR> clone)
inoremap <c-j> <Esc>ddpi
inoremap <C-J> <Esc>ddpi
"Move line up (uses vim-unimpaired) (replaced start digraph, use command instead)
inoremap <c-k> <Esc>ddkPi
inoremap <C-K> <Esc>ddkPi
"Does not work because of legacy reasons
" inoremap <c-m> <cmd>Marks<cr>
" inoremap <C-M> <CMD>Marks<CR>
"Add line below (replaced execute single command in normal)
inoremap <c-o> <Esc>o
inoremap <C-O> <Esc>o
"Add line above
inoremap <c-s-o> <Esc>O
inoremap <C-S-O> <Esc>O
"Search version controlled files (replaced autocomplete reverse)
inoremap <c-p> <cmd>GFiles<cr>
inoremap <C-P> <CMD>GFiles<CR>
"Search all files in directory
inoremap <c-s-p> <cmd>Files<cr>
inoremap <C-S-P> <CMD>Files<CR>
"Toggle file draw (replaces CTRL-v clone)
nnoremap <c-q> <cmd>CHADopen<cr>
nnoremap <C-Q> <CMD>CHADopen<CR>
"Search all snippets (uses ultisnips)
inoremap <c-s> <cmd>Snippets<cr>
inoremap <C-S> <CMD>Snippets<CR>
"Search git history (replaced inserting characters from above)
inoremap <c-y> <cmd>Commits<cr>
inoremap <C-Y> <CMD>Commits<CR>
"Search git history within current buffer/selection
inoremap <c-s-y> <cmd>BCommits<cr>
inoremap <C-S-Y> <CMD>BCommits<CR>
"Add simple highlight removal
nnoremap <Leader><space> :nohlsearch<cr>
nnoremap <Leader><Space> :nohlsearch<CR>
"Convert tabs to spaces
nnoremap <Leader><Tab> :retab<cr>
nnoremap <Leader><Tab> :retab<CR>
"Git mappings
nnoremap ga :Git add %<cr>
nnoremap gb :Git blame<cr>
nnoremap gC :Git commit<cr>
nnoremap gp :Git push<cr>
nnoremap gP :Git pull<cr>
nnoremap ga :Git add %<CR>
nnoremap gb :Git blame<CR>
nnoremap gC :Git commit<CR>
nnoremap gp :Git push<CR>
nnoremap gP :Git pull<CR>
"Map movement keys to Escape
inoremap jj <Esc>
@@ -215,7 +215,7 @@ inoremap kk <Esc>
inoremap hh <Esc>
"Delete a line in insert mode
" inoremap <C-d> <Esc>ddi
" inoremap <C-D> <Esc>ddi
"Use semicolon instead of colon for commands
nnoremap ; :
@@ -226,19 +226,19 @@ inoremap <Leader>; <Esc>mzA;<Esc>`za
nnoremap <Leader>; mzA;<Esc>`za<Esc>
"Easily navigate items in the quickfix menu
nnoremap <Leader>] :cnext<cr>
nnoremap <Leader>[ :cprevious<cr>
nnoremap <Leader>] :cnext<CR>
nnoremap <Leader>[ :cprevious<CR>
"Indent arrays
nnoremap <Leader>{ mzF[`a<cr><Esc>``%i<cr><Esc>`z
nnoremap <Leader>} mzF[`a<cr><Esc>``%i<cr><Esc>`zvi[:s/,\s*/,\r/g<cr>vi[=<Esc>`z:nohlsearch<cr>
nnoremap <Leader>{ mzF[`a<CR><Esc>``%i<CR><Esc>`z
nnoremap <Leader>} mzF[`a<CR><Esc>``%i<CR><Esc>`zvi[:s/,\s*/,\r/g<CR>vi[=<Esc>`z:nohlsearch<CR>
"A command to properly indent json code
command! FormatJSON %!python -m json.tool
" Allow saving of files as doas
command! W execute 'silent! w !doas /usr/bin/tee % >/dev/null' <Bar> edit!
command! X execute 'silent! x !doas /usr/bin/tee % >/dev/null' <Bar> edit!
command! W execute 'silent! w !doas /usr/bin/tee % >/dev/null' <BAR> edit!
command! X execute 'silent! x !doas /usr/bin/tee % >/dev/null' <BAR> edit!
" }}}
@@ -250,22 +250,22 @@ function ToggleEmmet()
if g:emmet_completion
echo "Emmet completion off!"
let g:user_emmet_expandabbr_key=','
iunmap <tab>
iunmap <Tab>
let g:emmet_completion = 0
else
echo "Emmet completion on!"
let g:user_emmet_expandabbr_key='<Tab>'
imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>")
imap <Expr> <Tab> emmet#expandAbbrIntelligent("\<Tab>")
let g:emmet_completion = 1
endif
endfunction
nnoremap <Leader>em :call ToggleEmmet()<cr>
nnoremap <Leader>em :call ToggleEmmet()<CR>
" Conceal markdown text
set conceallevel=3
let g:AutoPairsFlyMode = 1
let g:AutoPairsShortcutBackInsert = '<m-b>' " Use <m-b> to insert the closing parentheses if it jumped ahead by mistake
let g:AutoPairsShortcutBackInsert = '<M-B>' " Use <M-B> to insert the closing parentheses if it jumped ahead by mistake
let g:chadtree_settings = {
\ 'theme': {
@@ -321,12 +321,12 @@ nnoremap L $
" }}}
" Operator mappings --- {{{
onoremap in( :<C-u>normal! f(vi(<cr>
onoremap il( :<C-u>normal! F)vi(<cr>
onoremap an( :<C-u>normal! f(va(<cr>
onoremap al( :<C-u>normal! F)va(<cr>
onoremap an{ :<C-u>normal! f{vi{<cr>
onoremap al{ :<C-u>normal! F}vi<cr>
onoremap in( :<C-U>normal! f(vi(<CR>
onoremap il( :<C-U>normal! F)vi(<CR>
onoremap an( :<C-U>normal! f(va(<CR>
onoremap al( :<C-U>normal! F)va(<CR>
onoremap an{ :<C-U>normal! f{vi{<CR>
onoremap al{ :<C-U>normal! F}vi<CR>
" }}}
" Abbreviations --- {{{