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:
parent
d1472f0e89
commit
b0647949f8
19 changed files with 131 additions and 35 deletions
|
@ -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
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
" Keyboard shortcut
|
||||
nnoremap <Leader>u :UndotreeToggle<CR>
|
||||
|
||||
" Hide the sign column
|
||||
autocmd FileType undotree setlocal signcolumn=no
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
69
bundles-init/vim-which-key.cfg.vim
Normal file
69
bundles-init/vim-which-key.cfg.vim
Normal 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'
|
1
bundles-init/vim-which-key.load.vim
Normal file
1
bundles-init/vim-which-key.load.vim
Normal file
|
@ -0,0 +1 @@
|
|||
NeoBundle 'tseeker/vim-which-key'
|
|
@ -1,3 +1,2 @@
|
|||
" 'Silent' command, can be used to run stuff silently then redrawing
|
||||
|
||||
command! -nargs=* -bang Silent execute ':silent<bang>'.' '.<q-args> | execute ':redraw!'
|
||||
|
|
|
@ -10,8 +10,6 @@ if &t_Co == 256
|
|||
hi CursorLine cterm=NONE ctermbg=234
|
||||
hi CursorColumn cterm=NONE ctermbg=233
|
||||
hi ColorColumn ctermbg=52
|
||||
hi LineNr ctermfg=58
|
||||
hi CursorLineNr ctermfg=130
|
||||
hi Search ctermfg=15 ctermbg=53
|
||||
hi Folded ctermbg=17 ctermfg=227
|
||||
endif
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
" Timeout settings for key sequences
|
||||
set notimeout
|
||||
set timeout
|
||||
set timeoutlen=0
|
||||
set ttimeout
|
||||
set ttimeoutlen=-1
|
||||
|
||||
" Time between updates
|
||||
set updatetime=100
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
" Highlight search results, and clear that by hitting space very hard twice.
|
||||
set hlsearch
|
||||
nnoremap <silent> <Leader><space> :nohlsearch<CR>
|
||||
nmap <silent> <Leader><space> :nohlsearch<CR>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
" Enable mouse by default, provide <Leader>M shortcut to toggle on/off
|
||||
" Enable mouse by default, provide <Leader>om shortcut to toggle on/off
|
||||
|
||||
function! <SID>ToggleMouse()
|
||||
if &g:mouse != ""
|
||||
|
@ -11,7 +11,4 @@ function! <SID>ToggleMouse()
|
|||
endfunction
|
||||
|
||||
set mouse=a
|
||||
|
||||
nnoremap <silent> <Leader>M :call <SID>ToggleMouse()<cr>
|
||||
vnoremap <silent> <C-c> "+y
|
||||
set pastetoggle=<Leader>P
|
||||
nnoremap <silent> <Leader>om :call <SID>ToggleMouse()<cr>
|
||||
|
|
2
cfg/03-x-copy.vim
Normal file
2
cfg/03-x-copy.vim
Normal file
|
@ -0,0 +1,2 @@
|
|||
" Map Ctrl+C to X-compatable copy
|
||||
vnoremap <silent> <C-c> "+y
|
|
@ -1,4 +1,4 @@
|
|||
" Cursor line & column: ' c' = invert, ' C' = mode, ' n' = line numbers
|
||||
" Cursor line & column display
|
||||
function! <SID>ToggleCursorMode()
|
||||
if &cursorline && &cursorcolumn || !( &cursorline || &cursorcolumn )
|
||||
set cursorline nocursorcolumn
|
||||
|
@ -7,8 +7,6 @@ function! <SID>ToggleCursorMode()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <Leader>c :set cursorline! cursorcolumn!<CR>
|
||||
nnoremap <silent> <Leader>C :call <SID>ToggleCursorMode()<CR>
|
||||
nnoremap <silent> <Leader>n :set number!<CR>
|
||||
|
||||
set cursorline number
|
||||
nnoremap <silent> <Leader>oc :set cursorline! cursorcolumn!<CR>
|
||||
nnoremap <silent> <Leader>oC :call <SID>ToggleCursorMode()<CR>
|
||||
|
|
7
cfg/05-line-numbers.vim
Normal file
7
cfg/05-line-numbers.vim
Normal file
|
@ -0,0 +1,7 @@
|
|||
" Line number display and related controls
|
||||
highlight LineNr ctermbg=232 ctermfg=58 cterm=NONE
|
||||
highlight CursorLineNr ctermbg=232 ctermfg=130 cterm=bold
|
||||
|
||||
set number relativenumber
|
||||
nnoremap <silent> <Leader>on :set number!<CR>
|
||||
nnoremap <silent> <Leader>oN :set relativenumber!<CR>
|
|
@ -3,5 +3,5 @@
|
|||
call DoNeoBundleCheck( )
|
||||
|
||||
" Add key mappings for updates and installation
|
||||
nnoremap <silent> <Leader>Bu :NeoBundleCheckUpdate<cr>
|
||||
nnoremap <silent> <Leader>Bi :call DoNeoBundleCheck()<cr>
|
||||
nnoremap <silent> <Leader>Pu :NeoBundleCheckUpdate<cr>
|
||||
nnoremap <silent> <Leader>Pi :call DoNeoBundleCheck()<cr>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
" Make sure :Man is loaded, and map it.
|
||||
|
||||
" Make sure :Man is loaded, and map it. Also, remove the default mapping.
|
||||
if exists( ':Man' ) != 2
|
||||
source $VIMRUNTIME/ftplugin/man.vim
|
||||
endif
|
||||
|
||||
unmap <Leader>K
|
||||
nnoremap <Leader>hm :Man <cword><cr>
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
" Sign column color and visibility
|
||||
let s:sc_modes = {
|
||||
\ 'no' : 'yes' ,
|
||||
\ 'yes' : 'no' ,
|
||||
\ }
|
||||
|
||||
function! <SID>ToggleSignColumn()
|
||||
let &signcolumn = s:sc_modes[ &g:signcolumn ]
|
||||
endfunction
|
||||
|
||||
highlight SignColumn ctermfg=15 ctermbg=234
|
||||
set signcolumn=yes
|
||||
highlight SignColumn ctermbg=234
|
||||
nmap <silent> <leader>os :call <SID>ToggleSignColumn()<cr>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
" Vertical split style and color
|
||||
set fillchars+=vert:┃
|
||||
highlight VertSplit ctermbg=234 ctermfg=29 cterm=NONE
|
||||
highlight StatusLine ctermbg=0 ctermfg=234 cterm=inverse
|
||||
highlight StatusLine ctermbg=15 ctermfg=234 cterm=inverse
|
||||
highlight StatusLineNC ctermbg=234 ctermfg=234 cterm=inverse
|
||||
highlight StatusLineTerm ctermbg=15 ctermfg=234 cterm=inverse
|
||||
highlight StatusLineTermNC ctermbg=234 ctermfg=234 cterm=inverse
|
||||
highlight WildMenu ctermbg=29 ctermfg=0 cterm=standout
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
" Configure the paste toggle shortcut
|
||||
set pastetoggle=<Leader><S-F12>
|
||||
" Configure the paste toggle shortcut and a mapping that also toggles paste,
|
||||
" for use with vim-which-key.
|
||||
set pastetoggle=<Leader>op
|
||||
nnoremap <silent> <leader>op :set paste!<cr>
|
||||
|
|
Loading…
Reference in a new issue