Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions autoload/fern/mapping/node.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function! fern#mapping#node#init(disable_default_mappings) abort
nnoremap <buffer><silent> <Plug>(fern-action-expand:in) :<C-u>call <SID>call('expand_in')<CR>
nnoremap <buffer><silent> <Plug>(fern-action-collapse) :<C-u>call <SID>call('collapse')<CR>
nnoremap <buffer><silent> <Plug>(fern-action-reveal) :<C-u>call <SID>call('reveal')<CR>
nnoremap <buffer><silent> <Plug>(fern-action-focus:parent) :<C-u>call <SID>call('focus_parent')<CR>

nnoremap <buffer><silent> <Plug>(fern-action-enter) :<C-u>call <SID>call('enter')<CR>
nnoremap <buffer><silent> <Plug>(fern-action-leave) :<C-u>call <SID>call('leave')<CR>
Expand Down Expand Up @@ -115,6 +116,16 @@ function! s:map_reveal(helper) abort
return fern#internal#viewer#reveal(a:helper, path)
endfunction

function! s:map_focus_parent(helper) abort
let owner = a:helper.sync.get_cursor_node().__owner

if empty(owner)
return
endif

call a:helper.sync.focus_node(owner.__key)
endfunction

function! s:map_enter(helper) abort
let node = a:helper.sync.get_cursor_node()
if node is# v:null
Expand Down
3 changes: 3 additions & 0 deletions doc/fern.txt
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,9 @@ GLOBAL *fern-mapping-global*
*<Plug>(fern-action-reveal)*
Open a prompt to reveal a node in a tree.

*<Plug>(fern-action-focus:parent)*
Focus the parent of the cursor node.

*<Plug>(fern-action-enter)*
Open a new fern buffer which root node is a cursor node. In other
word, get enter the directory.
Expand Down