Cloned nnn.vim (the directory) into
/usr/local/share/vim/plugin/
In my vimrc I have added /usr/local/share/vim to my runtimepath.
Upon start of vim/gvim, I get:
Error detected while processing /usr/local/share/vim/plugin/nnn.vim/ftplugin/nnn.vim:
line 6:
E121: Undefined variable: g:nnn#action
E116: Invalid arguments for function empty(g:nnn#action)
line 12:
E121: Undefined variable: g:nnn#set_default_mappings
How to reproduce
See above.
Expected behavior
No error, of course
Environment:
OS: Gentoo Linux
Terminal: x11-misc/tabbed-0.6-r1 with x11-terms/xterm-367, or app-editors/gvim-8.2.3741
Shell: app-shells/bash-5.1_p16
Vim version: app-editors/vim-8.2.3741
Plugin manager: None
Plugin version: git clone of yesterday
Nnn version: app-misc/nnn-4.8
Solution
Change
if !empty(g:nnn#action)
to
if exists('g:nnn#action') && !empty(g:nnn#action)
and
if g:nnn#set_default_mappings
to
if exists('g:nnn#set_default_mappings') && g:nnn#set_default_mappings
Now, the errors went away, but I am not sure if this is OK, or if I just covered up a more serious problem. Are nnn#action and g:nnn#set_default_mappings supposed to be defined at the time ftplugin/nnn.vim uses them - and what happens if they are not? ftplugin/nnn.vim will not retouch them, since b:nnn_ftplugin will be 1 subsequently, which will cause it to return immediately at the start...
Problem
Cloned
nnn.vim
(the directory) into/usr/local/share/vim/plugin/
In myvimrc
I have added/usr/local/share/vim
to myruntimepath
. Upon start ofvim/gvim
, I get:How to reproduce
See above.
Expected behavior
No error, of course
Environment:
Solution Change
if !empty(g:nnn#action)
to
if exists('g:nnn#action') && !empty(g:nnn#action)
and
if g:nnn#set_default_mappings
to
if exists('g:nnn#set_default_mappings') && g:nnn#set_default_mappings
Now, the errors went away, but I am not sure if this is OK, or if I just covered up a more serious problem. Are
nnn#action
andg:nnn#set_default_mappings
supposed to be defined at the timeftplugin/nnn.vim
uses them - and what happens if they are not?ftplugin/nnn.vim
will not retouch them, sinceb:nnn_ftplugin
will be 1 subsequently, which will cause it to return immediately at the start...