mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 07:20:04 +08:00
feat(filetree): add user autocmd to override key binding
This commit is contained in:
parent
a892272616
commit
b10a4b5500
@ -173,6 +173,7 @@ function! s:defx_init()
|
||||
\ defx#get_context().winwidth + 10)
|
||||
nnoremap <silent><buffer><expr> < defx#do_action('resize',
|
||||
\ defx#get_context().winwidth - 10)
|
||||
doautocmd User DefxInit
|
||||
endf
|
||||
|
||||
" in this function we should vim-choosewin if possible
|
||||
|
@ -38,6 +38,7 @@ function! s:nerdtreeinit() abort
|
||||
" nnoremap <silent><buffer> <CR> :<C-u>silent! exe 'NERDTree' g:NERDTreeFileNode.GetSelected().path.str()<CR>
|
||||
nnoremap <silent><buffer> <Home> :call cursor(2, 1)<cr>
|
||||
nnoremap <silent><buffer> <End> :call cursor(line('$'), 1)<cr>
|
||||
doautocmd User NerdTreeInit
|
||||
endfunction
|
||||
|
||||
function! s:paste_to_file_manager() abort
|
||||
|
@ -108,6 +108,7 @@ function! s:vimfilerinit()
|
||||
nmap <buffer> <Left> <Plug>(vimfiler_smart_h)
|
||||
nmap <buffer> <Right> <Plug>(vimfiler_smart_l)
|
||||
nmap <buffer> <2-LeftMouse> <Plug>(vimfiler_expand_or_edit)
|
||||
doautocmd User VimfilerInit
|
||||
endf
|
||||
|
||||
function! s:vimfiler_vsplit() abort
|
||||
|
@ -33,6 +33,7 @@ description: "General documentation about how to use SpaceVim, including the qui
|
||||
- [File tree](#file-tree)
|
||||
- [File tree navigation](#file-tree-navigation)
|
||||
- [Open file with file tree.](#open-file-with-file-tree)
|
||||
- [Override filetree key bindings](#override-filetree-key-bindings)
|
||||
- [General usage](#general-usage)
|
||||
- [Native functions](#native-functions)
|
||||
- [Command line mode key bindings](#command-line-mode-key-bindings)
|
||||
@ -954,6 +955,25 @@ If only one file buffer is opened, a file is opened in the active window, otherw
|
||||
| `s g` | open file in a vertically split window |
|
||||
| `s v` | open file in a horizontally split window |
|
||||
|
||||
|
||||
#### Override filetree key bindings
|
||||
|
||||
If you want to override the default key bindings in filetree windows. You can use User autocmd in bootstrap function. for examples:
|
||||
|
||||
```vim
|
||||
function! myspacevim#before() abort
|
||||
autocmd User NerdTreeInit
|
||||
\ nnoremap <silent><buffer> <CR> :<C-u>call
|
||||
\ g:NERDTreeKeyMap.Invoke('o')<CR>
|
||||
endfunction
|
||||
```
|
||||
|
||||
Here is all the autocmd for filetree:
|
||||
|
||||
- nerdtree: `User NerdTreeInit`
|
||||
- defx: `User DefxInit`
|
||||
- vimfiler: `User VimfilerInit`
|
||||
|
||||
## General usage
|
||||
|
||||
The following key bindings are the general key bindings for moving the cursor.
|
||||
|
Loading…
Reference in New Issue
Block a user