Skip to content

Commit 0a21cdb

Browse files
committed
Use : in hidden/mark actions
1 parent 92a2bbb commit 0a21cdb

File tree

4 files changed

+93
-22
lines changed

4 files changed

+93
-22
lines changed

autoload/fern/action.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
let s:Action = vital#fern#import('App.Action')
2+
call s:Action.set_ignores([
3+
\ 'hidden-set',
4+
\ 'hidden-unset',
5+
\ 'hidden-toggle',
6+
\ 'mark-clear',
7+
\ 'mark-set',
8+
\ 'mark-unset',
9+
\ 'mark-toggle',
10+
\])
211

312
function! fern#action#_init() abort
413
call s:Action.init()

autoload/fern/mapping/filter.vim

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
function! fern#mapping#filter#init(disable_default_mappings) abort
2-
nnoremap <buffer><silent> <Plug>(fern-action-hidden-set) :<C-u>call <SID>call('hidden_set')<CR>
3-
nnoremap <buffer><silent> <Plug>(fern-action-hidden-unset) :<C-u>call <SID>call('hidden_unset')<CR>
4-
nnoremap <buffer><silent> <Plug>(fern-action-hidden-toggle) :<C-u>call <SID>call('hidden_toggle')<CR>
2+
nnoremap <buffer><silent> <Plug>(fern-action-hidden:set) :<C-u>call <SID>call('hidden_set')<CR>
3+
nnoremap <buffer><silent> <Plug>(fern-action-hidden:unset) :<C-u>call <SID>call('hidden_unset')<CR>
4+
nnoremap <buffer><silent> <Plug>(fern-action-hidden:toggle) :<C-u>call <SID>call('hidden_toggle')<CR>
55
nnoremap <buffer><silent> <Plug>(fern-action-include) :<C-u>call <SID>call('include')<CR>
66
nnoremap <buffer><silent> <Plug>(fern-action-exclude) :<C-u>call <SID>call('exclude')<CR>
77
8+
" Alias
9+
nmap <buffer> <Plug>(fern-action-hidden) <Plug>(fern-action-hidden:toggle)
10+
811
if !a:disable_default_mappings
9-
nmap <buffer><nowait> ! <Plug>(fern-action-hidden-toggle)
12+
nmap <buffer><nowait> ! <Plug>(fern-action-hidden)
1013
nmap <buffer><nowait> fi <Plug>(fern-action-include)
1114
nmap <buffer><nowait> fe <Plug>(fern-action-exclude)
1215
endif
16+
17+
" DEPRECATED:
18+
nmap <buffer><silent><expr> <Plug>(fern-action-hidden-set)
19+
\ fern#mapping#deprecated('fern-action-hidden-set', 'fern-action-hidden:set')
20+
nmap <buffer><silent><expr> <Plug>(fern-action-hidden-unset)
21+
\ fern#mapping#deprecated('fern-action-hidden-unset', 'fern-action-hidden:unset')
22+
nmap <buffer><silent><expr> <Plug>(fern-action-hidden-toggle)
23+
\ fern#mapping#deprecated('fern-action-hidden-toggle', 'fern-action-hidden:toggle')
1324
endfunction
1425

1526
function! s:call(name, ...) abort

autoload/fern/mapping/mark.vim

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
11
let s:Promise = vital#fern#import('Async.Promise')
22

33
function! fern#mapping#mark#init(disable_default_mappings) abort
4-
nnoremap <buffer><silent> <Plug>(fern-action-mark-clear) :<C-u>call <SID>call('mark_clear')<CR>
5-
nnoremap <buffer><silent> <Plug>(fern-action-mark-toggle) :<C-u>call <SID>call('mark_toggle')<CR>
6-
nnoremap <buffer><silent> <Plug>(fern-action-mark-set) :<C-u>call <SID>call('mark_set')<CR>
7-
nnoremap <buffer><silent> <Plug>(fern-action-mark-unset :<C-u>call <SID>call('mark_unset')<CR>
8-
vnoremap <buffer><silent> <Plug>(fern-action-mark-set) :call <SID>call('mark_set')<CR>
9-
vnoremap <buffer><silent> <Plug>(fern-action-mark-unset) :call <SID>call('mark_unset')<CR>
10-
vnoremap <buffer><silent> <Plug>(fern-action-mark-toggle) :call <SID>call('mark_toggle')<CR>
4+
nnoremap <buffer><silent> <Plug>(fern-action-mark:clear) :<C-u>call <SID>call('mark_clear')<CR>
5+
nnoremap <buffer><silent> <Plug>(fern-action-mark:set) :<C-u>call <SID>call('mark_set')<CR>
6+
nnoremap <buffer><silent> <Plug>(fern-action-mark:unset :<C-u>call <SID>call('mark_unset')<CR>
7+
nnoremap <buffer><silent> <Plug>(fern-action-mark:toggle) :<C-u>call <SID>call('mark_toggle')<CR>
8+
vnoremap <buffer><silent> <Plug>(fern-action-mark:set) :call <SID>call('mark_set')<CR>
9+
vnoremap <buffer><silent> <Plug>(fern-action-mark:unset) :call <SID>call('mark_unset')<CR>
10+
vnoremap <buffer><silent> <Plug>(fern-action-mark:toggle) :call <SID>call('mark_toggle')<CR>
11+
12+
" Alias
13+
nmap <buffer> <Plug>(fern-action-mark) <Plug>(fern-action-mark:toggle)
14+
vmap <buffer> <Plug>(fern-action-mark) <Plug>(fern-action-mark:toggle)
1115
1216
if !a:disable_default_mappings
13-
nmap <buffer><nowait> <C-j> <Plug>(fern-action-mark-toggle)j
14-
nmap <buffer><nowait> <C-k> k<Plug>(fern-action-mark-toggle)
15-
nmap <buffer><nowait> - <Plug>(fern-action-mark-toggle)
16-
vmap <buffer><nowait> - <Plug>(fern-action-mark-toggle)
17+
nmap <buffer><nowait> <C-j> <Plug>(fern-action-mark)j
18+
nmap <buffer><nowait> <C-k> k<Plug>(fern-action-mark)
19+
nmap <buffer><nowait> - <Plug>(fern-action-mark)
20+
vmap <buffer><nowait> - <Plug>(fern-action-mark)
1721
endif
22+
23+
" DEPRECATED:
24+
nmap <buffer><silent><expr> <Plug>(fern-action-mark-clear)
25+
\ <SID>deprecated('fern-action-mark-clear', 'fern-action-mark:clear')
26+
nmap <buffer><silent><expr> <Plug>(fern-action-mark-set)
27+
\ <SID>deprecated('fern-action-mark-set', 'fern-action-mark:set')
28+
nmap <buffer><silent><expr> <Plug>(fern-action-mark-unset)
29+
\ <SID>deprecated('fern-action-mark-unset', 'fern-action-mark:unset')
30+
nmap <buffer><silent><expr> <Plug>(fern-action-mark-toggle)
31+
\ <SID>deprecated('fern-action-mark-toggle', 'fern-action-mark:toggle')
32+
vmap <buffer><silent><expr> <Plug>(fern-action-mark-clear)
33+
\ <SID>deprecated('fern-action-mark-clear', 'fern-action-mark:clear')
34+
vmap <buffer><silent><expr> <Plug>(fern-action-mark-set)
35+
\ <SID>deprecated('fern-action-mark-set', 'fern-action-mark:set')
36+
vmap <buffer><silent><expr> <Plug>(fern-action-mark-unset)
37+
\ <SID>deprecated('fern-action-mark-unset', 'fern-action-mark:unset')
38+
vmap <buffer><silent><expr> <Plug>(fern-action-mark-toggle)
39+
\ <SID>deprecated('fern-action-mark-toggle', 'fern-action-mark:toggle')
1840
endfunction
1941

2042
function! s:call(name, ...) abort

doc/fern.txt

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -665,18 +665,31 @@ GLOBAL *fern-mapping-global*
665665
The original window width will be restored once user leave the window.
666666
It only works on a drawer style fern window.
667667

668-
*<Plug>(fern-action-hidden-set)*
668+
*<Plug>(fern-action-hidden:set)*
669669
Show hidden nodes. For example hidden nodes in file:// scheme is a
670670
file or directory starts from '.' character.
671671

672-
*<Plug>(fern-action-hidden-unset)*
672+
*<Plug>(fern-action-hidden:unset)*
673673
Hide hidden nodes. For example hidden nodes in file:// scheme is a
674674
file or directory starts from '.' character.
675675

676-
*<Plug>(fern-action-hidden-toggle)*
676+
*<Plug>(fern-action-hidden:toggle)*
677677
Toggle hidden nodes. For example hidden nodes in file:// scheme is a
678678
file or directory starts from '.' character.
679679

680+
*<Plug>(fern-action-hidden)*
681+
An alias to "hidden:toggle" action. Users can overwrite this mapping
682+
to change the default behavior of "hidden" action.
683+
684+
*<Plug>(fern-action-hidden-set)*
685+
DEPRECATED: Use |<Plug>(fern-action-hidden:set)| instead.
686+
687+
*<Plug>(fern-action-hidden-unset)*
688+
DEPRECATED: Use |<Plug>(fern-action-hidden:unset)| instead.
689+
690+
*<Plug>(fern-action-hidden-toggle)*
691+
DEPRECATED: Use |<Plug>(fern-action-hidden:toggle)| instead.
692+
680693
*<Plug>(fern-action-include)*
681694
Open a prompt to enter include filter. Users can type a |pattern| to
682695
filter nodes recursively.
@@ -685,17 +698,33 @@ GLOBAL *fern-mapping-global*
685698
Open a prompt to enter exclude filter. Users can type a |pattern| to
686699
filter nodes recursively.
687700

688-
*<Plug>(fern-action-mark-clear)*
701+
*<Plug>(fern-action-mark:clear)*
689702
Clear existing marks.
690703

691-
*<Plug>(fern-action-mark-toggle)*
704+
*<Plug>(fern-action-mark:set)*
705+
Set marks on cursor node(s).
706+
707+
*<Plug>(fern-action-mark:unset)*
708+
Unset marks on cursor node(s).
709+
710+
*<Plug>(fern-action-mark:toggle)*
692711
Toggle marks on cursor node(s).
693712

713+
*<Plug>(fern-action-mark)*
714+
An alias to "mark:toggle" action. Users can overwrite this mapping to
715+
change the default behavior of "mark" action.
716+
717+
*<Plug>(fern-action-mark-clear)*
718+
DEPRECATED: Use |<Plug>(fern-action-mark:clear)| instead.
719+
694720
*<Plug>(fern-action-mark-set)*
695-
Set marks on cursor node(s).
721+
DEPRECATED: Use |<Plug>(fern-action-mark:set)| instead.
696722

697723
*<Plug>(fern-action-mark-unset)*
698-
Unset marks on cursor node(s).
724+
DEPRECATED: Use |<Plug>(fern-action-mark:unset)| instead.
725+
726+
*<Plug>(fern-action-mark-toggle)*
727+
DEPRECATED: Use |<Plug>(fern-action-mark:toggle)| instead.
699728

700729
*<Plug>(fern-action-debug)*
701730
Echo debug information of a cursor node.

0 commit comments

Comments
 (0)