Handle keyboard shortcuts at plugin load time

Don't load plugins based on keyboard shortcuts, as this conflicts with
vim-which-key. Instead, create shortcuts when plugins are declared, and
load them when the commands they provide are used.
This commit is contained in:
Emmanuel BENOîT 2023-06-18 14:04:54 +02:00
parent b13a63ba83
commit be99bfda32
No known key found for this signature in database
GPG key ID: 2356DC6956CF54EF
9 changed files with 16 additions and 20 deletions

View file

@ -1,6 +1,2 @@
let g:ctrlp_working_path_mode = '' " Disable CtrlP-controlled chdir
let g:ctrlp_map = '' " Disable default mapping
nnoremap <Leader>pp :CtrlPBuffer<CR>
nnoremap <Leader>po :CtrlPMRUFiles<CR>
nnoremap <Leader>pi :CtrlP<CR>

View file

@ -1,6 +1,8 @@
call dein#add('ctrlpvim/ctrlp.vim', #{
\ lazy: 1,
\ on_map: #{
\ n: [ '<Leader>pi' , '<Leader>po', '<Leader>pp' ]
\ }
\ on_cmd: ['CtrlPBuffer', 'CtrlPMRUFiles', 'CtrlP']
\ })
nnoremap <Leader>pp :CtrlPBuffer<CR>
nnoremap <Leader>po :CtrlPMRUFiles<CR>
nnoremap <Leader>pi :CtrlP<CR>

View file

@ -1,3 +0,0 @@
" Add key mappings for updates and installation
nnoremap <silent> <Leader>Pu :DeinUpdate<cr>
nnoremap <silent> <Leader>Pi :call CheckDeinInstall()<cr>

View file

@ -1,6 +1,8 @@
call dein#add('wsdjeg/dein-ui.vim', #{
\ lazy: 1,
\ on_map: #{
\ n: [ '<Leader>Pu' , '<Leader>Pi' ]
\ }
\ on_cmd: ['DeinUpdate'],
\ })
" Add key mappings for updates and installation
nnoremap <silent> <Leader>Pu :DeinUpdate<cr>
nnoremap <silent> <Leader>Pi :call CheckDeinInstall()<cr>

View file

@ -1,6 +1,5 @@
" NERDTree: ' e' = toggle side bar
let g:NERDTreeGitStatusUpdateOnWrite = 1
nnoremap <Leader>e :NERDTreeToggle<CR>
" Set the bookmarks file's path
let g:NERDTreeBookmarksFile = GetVardataPath( 'NTBookmarks' )

View file

@ -1,4 +1,6 @@
call dein#add('scrooloose/nerdtree', #{
\ lazy: 1,
\ on_map: #{ n: ['<Leader>e'] },
\ on_cmd: [ 'NERDTree', 'NERDTreeToggle' ],
\ })
nnoremap <Leader>e :NERDTreeToggle<CR>

View file

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

View file

@ -1,4 +1,6 @@
call dein#add('mbbill/undotree', #{
\ lazy: 1 ,
\ on_map: #{ n: [ '<Leader>u' ] },
\ on_cmd: [ 'UndotreeShow', 'UndotreeToggle' ],
\ })
nnoremap <Leader>u :UndotreeToggle<CR>

View file

@ -2,7 +2,6 @@
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' ]