Style and shortcut tweaks. Added vim-which-key.

* Shortcut changes to make the Leader-based shortcuts easier to use
 * Install vim-which-key
 * Style fixes and changes
 * Reorganised some of the settings
This commit is contained in:
Emmanuel BENOîT 2020-12-07 16:36:17 +01:00
parent d1472f0e89
commit b0647949f8
19 changed files with 131 additions and 35 deletions

View file

@ -7,3 +7,6 @@ autocmd VimEnter * if argc() == 0 && &columns > 150 | NERDTree | endif
" Set the bookmarks file's path
let g:NERDTreeBookmarksFile = GetVardataPath( 'NTBookmarks' )
" Hide the sign column
autocmd FileType nerdtree setlocal signcolumn=no

View file

@ -1 +1,5 @@
" Keyboard shortcut
nnoremap <Leader>u :UndotreeToggle<CR>
" Hide the sign column
autocmd FileType undotree setlocal signcolumn=no

View file

@ -5,10 +5,12 @@ nnoremap <silent> <Leader>gs :Git<cr>
nnoremap <silent> <Leader>gc :Git commit -q<cr>
nnoremap <Leader>gb :Git branch<space>
" Note: dangerous commands don't have a <cr>
" Note: dangerous commands don't have a <cr>. Also commands that need
" arguments, obviously.
nnoremap <Leader>gB :Git checkout -b<space>
nnoremap <Leader>gC :Git checkout<space>
nnoremap <Leader>gM :GMove<space>
nnoremap <Leader>gp :Git pull --recurse-submodules<space>
nnoremap <Leader>gP :Git push<space>
nnoremap <Leader>gr :GRename<space>
nnoremap <Leader>gR :GRemove

View file

@ -9,10 +9,12 @@ let g:lsp_signs_error = {'text': '✗'}
let g:lsp_signs_warning = {'text': '‼'}
" Keyboard shortcuts
noremap <Leader>df :LspDocumentFormat<cr>
vnoremap <Leader>df :LspDocumentRangeFormat<cr>
noremap <Leader>dr :LspReferences<cr>
noremap <F3> :LspDefinition<cr>
noremap <Leader>dR :LspRename<cr>
noremap <Leader>dh :LspHover<cr>
noremap <Leader>ds :LspWorkspaceSymbol<cr>
noremap <Leader>ld :LspDocumentDiagnostics<cr>
noremap <Leader>lf :LspDocumentFormat<cr>
noremap <Leader>lgd :LspDefinition<cr>
noremap <Leader>lgD :LspDeclaration<cr>
noremap <Leader>li :LspHover<cr>
noremap <Leader>lr :LspReferences<cr>
noremap <Leader>lR :LspRename<cr>
noremap <Leader>ls :LspDocumentSymbol<cr>
noremap <Leader>lS :LspWorkspaceSymbol<cr>

View file

@ -0,0 +1,69 @@
" Leader-based key sequences
nnoremap <silent> <Space> :<c-u>WhichKey '<Space>'<CR>
let g:which_key_map = {}
call which_key#register('<Space>', 'g:which_key_map')
let g:which_key_fallback_to_native_key = 1
" Direct commands
let g:which_key_map[' '] = [ 'call feedkeys(":nohlsearch\n")' , 'clear-search' ]
let g:which_key_map.e = 'file-explorer'
let g:which_key_map.u = 'undo-tree'
" Options
let g:which_key_map.o = { 'name' : '+options' }
let g:which_key_map.o.c = 'cursor-dir'
let g:which_key_map.o.C = 'cursor-mode'
let g:which_key_map.o.m = 'mouse'
let g:which_key_map.o.n = 'line-numbers'
let g:which_key_map.o.N = 'relative-line-numbers'
let g:which_key_map.o.p = 'paste'
let g:which_key_map.o.w = 'whitespace'
let g:which_key_map.o.s = 'sign-column'
" Fuzzy finder
let g:which_key_map.p = { 'name' : '+fuzzy-finder' }
let g:which_key_map.p.p = 'buffers'
let g:which_key_map.p.o = 'recent-files'
let g:which_key_map.p.i = 'open-file'
" Git commands
let g:which_key_map.g = { 'name' : '+git' }
let g:which_key_map.g['+'] = 'add-hunk'
let g:which_key_map.g['-'] = 'revert-hunk'
let g:which_key_map.g['<'] = 'previous-hunk'
let g:which_key_map.g['>'] = 'next-hunk'
let g:which_key_map.g.a = 'add-file'
let g:which_key_map.g.B = 'new-branch'
let g:which_key_map.g.C = 'checkout-branch'
let g:which_key_map.g.c = 'commit'
let g:which_key_map.g.d = 'diff'
let g:which_key_map.g.L = 'log-full'
let g:which_key_map.g.l = 'log-split'
let g:which_key_map.g.M = 'move'
let g:which_key_map.g.P = 'push'
let g:which_key_map.g.p = 'pull'
let g:which_key_map.g.R = 'remove'
let g:which_key_map.g.s = 'status'
" Help
let g:which_key_map.h = { 'name' : '+help' }
let g:which_key_map.h.m = 'man-page'
let g:which_key_map.h.v = 'vim-help'
" Language helpers
let g:which_key_map.l = { 'name' : '+language' }
let g:which_key_map.l.d = 'diagnostics'
let g:which_key_map.l.f = 'format'
let g:which_key_map.l.g = { 'name' : '+goto' }
let g:which_key_map.l.g.d = 'declaration'
let g:which_key_map.l.g.D = 'definition'
let g:which_key_map.l.i = 'information'
let g:which_key_map.l.r = 'references'
let g:which_key_map.l.R = 'rename'
let g:which_key_map.l.s = 'document-symbols'
let g:which_key_map.l.s = 'workspace-symbols'
" Plugins
let g:which_key_map.P = { 'name' : '+plugins' }
let g:which_key_map.P.i = 'install-new'
let g:which_key_map.P.u = 'update'

View file

@ -0,0 +1 @@
NeoBundle 'tseeker/vim-which-key'