@@ -222,6 +222,9 @@ Fern provide following mapping helper functions:
222222 | fern#smart#scheme() | Return a mapping expression determined by a
223223 scheme of a current fern tree
224224
225+ | fern#smart#root() | Return a mapping expression determined by a
226+ kind of a current cursor node
227+
225228For example, following execute "open" on leaf but "expand" on branch.
226229>
227230 nmap <buffer><expr> <Plug>(fern-my-open-or-expand)
@@ -686,7 +689,7 @@ fern#smart#drawer({drawer}, {drawer-right}, {explorer})
686689>
687690 " Perform 'expand' on drawer and 'enter' on explorer
688691 nmap <buffer><expr>
689- \ <Plug>(fern-expand-or-enter)
692+ \ <Plug>(fern-my- expand-or-enter)
690693 \ fern#smart#drawer(
691694 \ "<Plug>(fern-action-expand)",
692695 \ "<Plug>(fern-action-enter)",
@@ -708,6 +711,20 @@ fern#smart#scheme({default}, {schemes})
708711 \ {
709712 \ 'bookmark': "\<C-^>",
710713 \ },
714+ \ )
715+
716+ *fern#smart#root()*
717+ fern#smart#root({root} , {others} )
718+ Return one of a given mapping expression determined by a kind of a
719+ current cursor node. If the node is root, the {root} is returned.
720+ Otherwise the {others} is returned.
721+ >
722+ " Perform 'leave' on root node and 'open-or-enter' on others
723+ nmap <buffer><expr>
724+ \ <Plug>(fern-my-leave-or-open-or-enter)
725+ \ fern#smart#root(
726+ \ "<Plug>(fern-action-leave)",
727+ \ "<Plug>(fern-action-open-or-enter)",
711728 \ )
712729
713730-----------------------------------------------------------------------------
0 commit comments