aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/keys
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/keys')
-rw-r--r--.config/nvim/keys/mappings.vim44
-rw-r--r--.config/nvim/keys/which-key.vim67
2 files changed, 111 insertions, 0 deletions
diff --git a/.config/nvim/keys/mappings.vim b/.config/nvim/keys/mappings.vim
new file mode 100644
index 0000000..1b5ae4f
--- /dev/null
+++ b/.config/nvim/keys/mappings.vim
@@ -0,0 +1,44 @@
+" Better nav for omnicomplete
+inoremap <expr> <c-j> ("\<C-n>")
+inoremap <expr> <c-k> ("\<C-p>")
+
+" Use alt + hjkl to resize windows
+nnoremap <M-j> :resize -2<CR>
+nnoremap <M-k> :resize +2<CR>
+nnoremap <M-h> :vertical resize -2<CR>
+nnoremap <M-l> :vertical resize +2<CR>
+
+" I hate escape more than anything else
+" inoremap jk <Esc>
+" inoremap kj <Esc>
+
+" Easy CAPS
+" inoremap <c-u> <ESC>viwUi
+" nnoremap <c-u> viwU<Esc>
+
+" TAB in general mode will move to text buffer
+nnoremap <TAB> :bnext<CR>
+" SHIFT-TAB will go back
+nnoremap <S-TAB> :bprevious<CR>
+
+" Alternate way to save
+nnoremap <C-s> :w<CR>
+" Alternate way to quit
+nnoremap <C-Q> :wq!<CR>
+" Use control-c instead of escape
+nnoremap <C-c> <Esc>
+" <TAB>: completion.
+inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
+
+" Better tabbing
+vnoremap < <gv
+vnoremap > >gv
+
+" Better window navigation
+nnoremap <C-h> <C-w>h
+nnoremap <C-j> <C-w>j
+nnoremap <C-k> <C-w>k
+nnoremap <C-l> <C-w>l
+
+nnoremap <Leader>o o<Esc>^Da
+nnoremap <Leader>O O<Esc>^Da
diff --git a/.config/nvim/keys/which-key.vim b/.config/nvim/keys/which-key.vim
new file mode 100644
index 0000000..4105b61
--- /dev/null
+++ b/.config/nvim/keys/which-key.vim
@@ -0,0 +1,67 @@
+" Map leader to which_key
+nnoremap <silent> <leader> :silent WhichKey '<Space>'<CR>
+vnoremap <silent> <leader> :silent <c-u> :silent WhichKeyVisual '<Space>'<CR>
+
+" Create map to add keys to
+let g:which_key_map = {}
+" Define a separator
+let g:which_key_sep = '→'
+" set timeoutlen=100
+
+
+" Not a fan of floating windows for this
+let g:which_key_use_floating_win = 0
+
+" Change the colors if you want
+highlight default link WhichKey Operator
+highlight default link WhichKeySeperator DiffAdded
+highlight default link WhichKeyGroup Identifier
+highlight default link WhichKeyDesc Function
+
+" Hide status line
+autocmd! FileType which_key
+autocmd FileType which_key set laststatus=0 noshowmode noruler
+ \| autocmd BufLeave <buffer> set laststatus=2 noshowmode ruler
+
+" Single mappings
+let g:which_key_map['/'] = [ '<Plug>NERDCommenterToggle' , 'comment' ]
+let g:which_key_map['e'] = [ ':CocCommand explorer' , 'explorer' ]
+let g:which_key_map['f'] = [ ':Files' , 'search files' ]
+let g:which_key_map['h'] = [ '<C-W>s' , 'split below']
+let g:which_key_map['r'] = [ ':Ranger' , 'ranger' ]
+let g:which_key_map['S'] = [ ':Startify' , 'start screen' ]
+let g:which_key_map['T'] = [ ':Rg' , 'search text' ]
+let g:which_key_map['v'] = [ '<C-W>v' , 'split right']
+let g:which_key_map['z'] = [ 'Goyo' , 'zen' ]
+
+" s is for search
+let g:which_key_map.s = {
+ \ 'name' : '+search' ,
+ \ '/' : [':History/' , 'history'],
+ \ ';' : [':Commands' , 'commands'],
+ \ 'a' : [':Ag' , 'text Ag'],
+ \ 'b' : [':BLines' , 'current buffer'],
+ \ 'B' : [':Buffers' , 'open buffers'],
+ \ 'c' : [':Commits' , 'commits'],
+ \ 'C' : [':BCommits' , 'buffer commits'],
+ \ 'f' : [':Files' , 'files'],
+ \ 'g' : [':GFiles' , 'git files'],
+ \ 'G' : [':GFiles?' , 'modified git files'],
+ \ 'h' : [':History' , 'file history'],
+ \ 'H' : [':History:' , 'command history'],
+ \ 'l' : [':Lines' , 'lines'] ,
+ \ 'm' : [':Marks' , 'marks'] ,
+ \ 'M' : [':Maps' , 'normal maps'] ,
+ \ 'p' : [':Helptags' , 'help tags'] ,
+ \ 'P' : [':Tags' , 'project tags'],
+ \ 's' : [':Snippets' , 'snippets'],
+ \ 'S' : [':Colors' , 'color schemes'],
+ \ 't' : [':Rg' , 'text Rg'],
+ \ 'T' : [':BTags' , 'buffer tags'],
+ \ 'w' : [':Windows' , 'search windows'],
+ \ 'y' : [':Filetypes' , 'file types'],
+ \ 'z' : [':FZF' , 'FZF'],
+ \ }
+
+" Register which key map
+call which_key#register('<Space>', "g:which_key_map")