Closed ram02z closed 3 years ago
@mcchrish can you please take a look at it? Are you waiting for someone to pitch in?
@jarun I'm waiting for anyone to take a look. PR is welcome and I can take a review.
In that case please respond to the defect with a note so someone else bothers to look into it. What appears to be the problem? Do the error strings help?
This is probably a problem with fzopen
plugin. I don't use it, so I'm not sure what's going on here. But seems to me that is the offending snippet.
# Check for picker mode
if [ "$3" ]; then
if [ "$entry" ]; then
if [ "-" = "$3" ]; then
printf "%s\n" "$entry"
else
printf "%s\n" "$entry" > "$3"
fi
# Tell `nnn` to clear its internal selection
printf "%s" "0p" > "$NNN_PIPE"
fi
exit 0
fi
Added the "help wanted" label so anyone who's interested can take a look.
@N-R-K fzopen is working as expected in this block. This is a case of calling a picker plugin while nnn
is started in picker mode. See $3
in https://github.com/jarun/nnn/tree/master/plugins#access-level-of-plugins
So, if user is picking files using fzopen()
, nnn
should not pick files. The picker output file path is passed to the plugin (-
if it's stdout) and the plugin will write picked files to it (nnn
would skip writing to the output file).
@mizlan can you please have a look?
Can reproduce this with a dummy plugin with that block.
#!/bin/sh
# Check for picker mode
entry="$1"
if [ "$3" ]; then
if [ "$entry" ]; then
if [ "-" = "$3" ]; then
printf "%s\n" "$entry"
else
printf "%s\n" "$entry" > "$3"
fi
# Tell `nnn` to clear its internal selection
printf "%s" "0p" > "$NNN_PIPE"
fi
exit 0
fi
In explorer mode, it just opens the plugin file.
That's with pick a plugin method... and expected as per current code.
Okay, I know what's going on. The plugin is printing only filename, not full path. So if you change directory it becomes a problem.
OK. I fixed the other issue with opening the plugin (instead of run) at https://github.com/jarun/nnn/commit/bdbd182c65cee58c2d09374a93a9ca3425e4ab7b.
@ram02z the fzopen plugin is fixed. Please confirm if the patch works for you.
@ram02z the fzopen plugin is fixed. Please confirm if the patch works for you.
The patch works great, thanks for the fix @N-R-K !
To Reproduce
NNNPicker
fzopen
and pick a fileScreenshots
Environment:
Additional context
The error doesn't occur for me if I don't change the directory that nnn.vim was invoked from.
nnn.vim config: https://github.com/ram02z/dotfiles/blob/6ee4aa967a18643a657f7d30cf4435fccb265f05/dot_config/nvim/plugin/50-plugins.lua#L321-L350