Skip to content

Commit e90cdeb

Browse files
authored
Merge pull request #434 from mopp/add_open_drop
add <Plug>(fern-action-open:drop)
2 parents 951a05d + 92cb78c commit e90cdeb

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

autoload/fern/mapping/open.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function! fern#mapping#open#init(disable_default_mappings) abort
1313
nnoremap <buffer><silent> <Plug>(fern-action-open:leftest) :<C-u>call <SID>call('open', 'topleft vsplit')<CR>
1414
nnoremap <buffer><silent> <Plug>(fern-action-open:bottom) :<C-u>call <SID>call('open', 'botright split')<CR>
1515
nnoremap <buffer><silent> <Plug>(fern-action-open:rightest) :<C-u>call <SID>call('open', 'botright vsplit')<CR>
16+
nnoremap <buffer><silent> <Plug>(fern-action-open:drop) :<C-u>call <SID>call('open', 'drop')<CR>
1617
nnoremap <buffer><silent> <Plug>(fern-action-open:edit-or-error) :<C-u>call <SID>call('open', 'edit')<CR>
1718
nnoremap <buffer><silent> <Plug>(fern-action-open:edit-or-split) :<C-u>call <SID>call('open', 'edit/split')<CR>
1819
nnoremap <buffer><silent> <Plug>(fern-action-open:edit-or-vsplit) :<C-u>call <SID>call('open', 'edit/vsplit')<CR>

doc/fern.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,10 @@ GLOBAL *fern-mapping-global*
929929
The command will be applied on an "anchor" window when invoked from a
930930
drawer style fern (|fern-glossary-anchor|.)
931931

932+
*<Plug>(fern-action-open:drop)*
933+
Open a cursor node or jump the window when it was already opend.
934+
Note See |drop| for more details.
935+
932936
*<Plug>(fern-action-open:edit-or-error)*
933937
Open a cursor node or marked nodes with |edit| command or fallback
934938
to print an error.

test/fern/internal/buffer.vimspec

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,22 @@ Describe fern#internal#buffer
135135
\ 'opener': 'vsplit',
136136
\})
137137
Assert Equals(winnr('$'), 2)
138+
%bwipeout!
139+
140+
call fern#internal#buffer#open('hello1', {
141+
\ 'opener': 'edit',
142+
\})
143+
call fern#internal#buffer#open('hello2', {
144+
\ 'opener': 'vsplit',
145+
\})
146+
call fern#internal#buffer#open('hello1', {
147+
\ 'opener': 'drop',
148+
\})
149+
Assert Equals(winnr(), 2)
150+
call fern#internal#buffer#open('hello2', {
151+
\ 'opener': 'drop',
152+
\})
153+
Assert Equals(winnr(), 1)
138154
End
139155
End
140156
End

0 commit comments

Comments
 (0)