nnn.vim
nnn.vim copied to clipboard
Error when mapping action to <backspace>
Describe the bug
When adding action to call a function when <backspace>
is pressed. I get an error:
Error detected while processing function nnn#select_action:
line 6:
E728: Using a Dictionary as a Number
To Reproduce
Add this config on top of nnn.vim:
function! QuitNNN()
execute('normal! q')
endfunction
let g:nnn#action = { '<backspace>': funcref('QuitNNN') }
- Open vim
- Press key
n - Press key
- See error
Expected behavior
Should call my function (and in turn close explorer).
Environment:
- OS: macos
- Terminal: iterm2
- Shell: zsh
- Vim version: vim 8
- Plugin manager: vim-plug
- Plugin version: master
- Nnn version: latest on brew
The problem seems to be related to explorer as using nnn#pick it works.
It works now with any <c- key, but not with
I can reproduce the problem. However, I would suggest an alternative (better) way to achieve the behavior you want:
autocmd FileType nnn tnoremap <buffer><silent> <backspace> q
Or place the mapping in ftplugin/nnn.vim
.
A problem though with mapping backspace with q is that, backspace will not work as intended in moments like entering texts in renaming files/new file name etc.