Skip to content

Commit

Permalink
Map <Return> and <Backspace> directly to <Plug> commands
Browse files Browse the repository at this point in the history
NeoVim introduced a breaking change that breaks indirect mapping of
<Return> and <Backspace> to a command via <C-m> and <C-h>.
(neovim/neovim#14090 (comment))

Mapping them directly fixes the problem and is clearer.
  • Loading branch information
tomtomjhj committed May 15, 2022
1 parent ab237a1 commit 4fc7b83
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autoload/fern/mapping/node.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ function! fern#mapping#node#init(disable_default_mappings) abort
if !a:disable_default_mappings
nmap <buffer><nowait> <F5> <Plug>(fern-action-reload)
nmap <buffer><nowait> <C-m> <Plug>(fern-action-enter)
nmap <buffer><nowait> <Return> <Plug>(fern-action-enter)
nmap <buffer><nowait> <C-h> <Plug>(fern-action-leave)
nmap <buffer><nowait> <Backspace> <Plug>(fern-action-leave)
nmap <buffer><nowait> l <Plug>(fern-action-expand)
nmap <buffer><nowait> h <Plug>(fern-action-collapse)
nmap <buffer><nowait> i <Plug>(fern-action-reveal)
nmap <buffer><nowait> <Return> <C-m>
nmap <buffer><nowait> <Backspace> <C-h>
endif
endfunction

Expand Down
1 change: 1 addition & 0 deletions autoload/fern/mapping/open.vim
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function! fern#mapping#open#init(disable_default_mappings) abort
if !a:disable_default_mappings
nmap <buffer><nowait> <C-m> <Plug>(fern-action-open-or-enter)
nmap <buffer><nowait> <Return> <Plug>(fern-action-open-or-enter)
nmap <buffer><nowait> l <Plug>(fern-action-open-or-expand)
nmap <buffer><nowait> s <Plug>(fern-action-open:select)
nmap <buffer><nowait> e <Plug>(fern-action-open)
Expand Down

0 comments on commit 4fc7b83

Please sign in to comment.