Better key bindings
This commit is contained in:
103
init.vim
103
init.vim
@@ -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 --- {{{
|
||||
|
||||
Reference in New Issue
Block a user