Better key bindings

This commit is contained in:
2021-10-09 22:46:37 +01:00
parent e535a07c61
commit 489aa75216
2 changed files with 94 additions and 11 deletions

View File

@@ -65,7 +65,7 @@ execute "hi IncSearch guibg=" . color3 . " ctermbg=3 guifg=" . color0 . " ctermf
execute "hi Search guibg=" . color3 . " ctermbg=3 guifg=" . color0 . " ctermfg=0"
execute "hi Directory ctermbg=NONE guifg=" . color4 . " ctermfg=4"
execute "hi MatchParen guibg=" . color1 . " ctermbg=1 guifg=" . color8 . " ctermfg=8"
execute "hi ColorColumn guibg=" . color0 . " ctermbg=0 guifg=" . color0 . " ctermfg=0"
execute "hi ColorColumn guibg=" . color0 . " ctermbg=0 guifg=" . color7 . " ctermfg=7"
execute "hi signColumn ctermbg=NONE guifg=" . color4 . " ctermfg=4"
execute "hi ErrorMsg ctermbg=NONE guifg=" . color8 . " ctermfg=8"
execute "hi ModeMsg ctermbg=NONE guifg=" . color2 . " ctermfg=2"

103
init.vim
View File

@@ -87,8 +87,22 @@ set splitbelow
set splitright
"We'll set simpler mappings to switch between splits
nnoremap <C-H> <C-W><C-H>
nnoremap <C-L> <C-W><C-L>
"Decrease window size (replaces some weird netrw stuff)
nnoremap <C-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-J> <C-W><C-J>
nnoremap <C-S-K> <C-W><C-K>
"Decrease window size (Backspace clone)
inoremap <C-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
" }}}
" Search --- {{{
@@ -106,6 +120,78 @@ nnoremap <Leader>ev :tabedit $MYVIMRC<cr>
nnoremap <Leader>es :source $MYVIMRC<cr>
" }}}
"Changing unused ctrl bindings
"List all tags in the current buffer (replaced pageup, use CTRL-u instead)
nnoremap <c-b> <cmd>BTags<cr>
"List all tags in directory
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>
"Search within the current buffer (replaced pagedown, use CTRL-d instead)
nnoremap <c-f> /
"Search within the whole project
nnoremap <c-s-f> <cmd>Rg<cr>
"Search git history (replaced something weird with netrw)
nnoremap <c-h> <cmd>Commits<cr>
"Search git history within current buffer/selection
nnoremap <c-s-h> <cmd>BCommits<cr>
"Move line down (uses vim-unimpaired) (replaced move down, use "j")
nnoremap <c-j> ]e
"Move line up (uses vim-unimpaired) (replaced move up, use "k")
nnoremap <c-k> [e
"Search marks (replaced move down, use <CR>)
nnoremap <c-m> <cmd>Marks<cr>
" nnoremap <c-n>
"Search version controlled files (replaced move up, use "k")
nnoremap <c-p> <cmd>GFiles<cr>
"Search all files in directory
nnoremap <c-s-p> <cmd>Files<cr>
"Toggle file draw
nnoremap <c-q> <cmd>CHADopen<cr>
"Search all snippets (uses ultisnips)
nnoremap <c-s> <cmd>Snippets<cr>
"Search git history (replaced scroll one line up, use "k")
nnoremap <c-y> <cmd>Commits<cr>
"Search git history within current buffer/selection
nnoremap <c-s-y> <cmd>BCommits<cr>
"List all tags in the current buffer
inoremap <c-b> <cmd>BTags<cr>
"List all tags in directory
inoremap <c-s-b> <cmd>Tags<cr>
"List all the recently opened files (replaced inserting characters from below)
inoremap <c-e> <cmd>History<cr>
"Search within the current buffer
inoremap <c-f> <Esc>/
"Search within the whole project
inoremap <c-s-f> <cmd>Rg<cr>
"Search git history (replaced backspace clone)
inoremap <c-h> <cmd>Commits<cr>
"Search git history within current buffer/selection
inoremap <c-s-h> <cmd>BCommits<cr>
"Move line down (uses vim-unimpaired) (replaced <CR> clone)
inoremap <c-j> <Esc>]ei
"Move line up (uses vim-unimpaired) (replaced start digraph, use command instead)
inoremap <c-k> <Esc>[ei
"Search marks (replaced <CR> clone)
inoremap <c-m> <cmd>Marks<cr>
"Add line below (replaced execute single command in normal)
inoremap <c-o> <Esc>o
"Add line above
inoremap <c-s-o> <Esc>O
"Search version controlled files (replaced autocomplete reverse)
inoremap <c-p> <cmd>GFiles<cr>
"Search all files in directory
inoremap <c-s-p> <cmd>Files<cr>
"Toggle file draw (replaces CTRL-v clone)
nnoremap <c-q> <cmd>CHADopen<cr>
"Search all snippets (uses ultisnips)
inoremap <c-s> <cmd>Snippets<cr>
"Search git history (replaced inserting characters from above)
nnoremap <c-y> <cmd>Commits<cr>
"Search git history within current buffer/selection
nnoremap <c-s-y> <cmd>BCommits<cr>
"Add simple highlight removal
nnoremap <Leader><space> :nohlsearch<cr>
@@ -119,10 +205,11 @@ 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 ; :
nnoremap : ;
"Append the line with a semicolon
inoremap <Leader>; <Esc>mzA;<Esc>`za
@@ -141,6 +228,7 @@ 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!
" }}}
@@ -166,8 +254,6 @@ nnoremap <Leader>em :call ToggleEmmet()<cr>
" Conceal markdown text
set conceallevel=3
nnoremap <Leader>d <cmd>CHADopen<cr> " Open file draw with ,d
let g:AutoPairsFlyMode = 1
let g:AutoPairsShortcutBackInsert = '<m-b>' " Use <m-b> to insert the closing parentheses if it jumped ahead by mistake
@@ -204,9 +290,6 @@ let g:chadtree_settings = {
nnoremap H ^
nnoremap L $
"Move a line up or down
nnoremap <C-J> ddp
nnoremap <C-K> ddkP
" }}}
" Operator mappings --- {{{
@@ -214,8 +297,8 @@ 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 an{ :<C-u>normal! f{vi{<cr>
onoremap al{ :<C-u>normal! F}vi<cr>
" }}}
" Abbreviations --- {{{