Replies: 28 comments 21 replies
-
Seems to be a popular request to have a nerdtree like persistent session/window. #55 It might be possible to implement this features by communicating with nnn via stdout. I don't have much free time to implement it, but I welcome anyone who wants to submit a PR. |
Beta Was this translation helpful? Give feedback.
-
I think #43 and #55 are different from my request in that they expect nnn to close, but want the open directory to persist/be remembered.
My personal desire is to have nnn stay open and visible. I'm not asking the plugin to store session data at all, so as I understand the requests in those other two issues implementing them wouldn't give me the behavior I want. Perhaps I'm just not (yet) adapted to a vim-centric workflow. When I can see the dir tree, i tend to structure around that tree. As I've been using nvim primarily the past few weeks, I've found myself creating a lot more gigantic files and trying to navigate within files instead of between files. In any case, I understand that your time constrained, and I'll continue looking for other solutions/workflows/etc |
Beta Was this translation helpful? Give feedback.
-
Im also interested in NNN persistant pane. You describe it very well like NerdTREE no matter if you open the file the File Browser do not close after opening the file. |
Beta Was this translation helpful? Give feedback.
-
Still nothing about that. It would be very helpful to have persistent pane. |
Beta Was this translation helpful? Give feedback.
-
Please be patient. Anyway, taking a look over this, the first thing I question is, when a file is selected from the |
Beta Was this translation helpful? Give feedback.
-
Since |
Beta Was this translation helpful? Give feedback.
-
@mcchrish This is an interesting idea, but could you elaborate a tad more? I have never quite thought about a curses process communicating via stdout. I guess it would be an alternative to the picker file, maybe |
Beta Was this translation helpful? Give feedback.
-
I think what the user is looking for is, |
Beta Was this translation helpful? Give feedback.
-
User provides the picker output file and whenever she acts (presses |
Beta Was this translation helpful? Give feedback.
-
I guess we can have some keybind that is intercepted before it reaches |
Beta Was this translation helpful? Give feedback.
-
Yes, it seems so. We would need to change the behaviour of So maybe a switch or something. |
Beta Was this translation helpful? Give feedback.
-
Exactly However, |
Beta Was this translation helpful? Give feedback.
-
I think we would need to use the stdout method since Vim must communicate with nnn first, them nnn communicates back with Vim. |
Beta Was this translation helpful? Give feedback.
-
I would love to help make the |
Beta Was this translation helpful? Give feedback.
-
You'll have to follow the |
Beta Was this translation helpful? Give feedback.
-
Done with the change at jarun/nnn@2bd72d1. Now you can follow the |
Beta Was this translation helpful? Give feedback.
-
I've tested it on both Vim8 ( My only change to https://github.com/jarun/nnn/blob/2bd72d1b29d968204421e9a479bc1c159a9dc490/src/nnn.c#L6290 which is probably incorrect for most purposes but was just a test. My logging output looks like this: Maybe the help page for
Emphasis mine. I suspect I may be doing something wrong, but I do not know how to proceed. |
Beta Was this translation helpful? Give feedback.
-
I'm trying some experiments a bit and see if might be helpful. I'm using neovim 0.4.4 and nnn 4.0. A small vimscript to test out: function! s:callback(id, data, name)
echom string([a:id, a:data])
endfunction
function! s:test_nnn()
call termopen('nnn -p -', {'on_stdout': function('s:callback') })
endfunction I'm getting the same result:
But if you take a look at the end, the selected files are found in the output:
It just seems like nnn outputs some other UI data/escape codes to stdout. If I changed call termopen('echo "hello"', {'on_stdout': function('s:callback') }) The output is simply:
If I try using ranger, I'm met with a similar output as nnn:
So it looks like this is just how curses programs deal with stdout? And finally I tried running nnn again but this time with the option call termopen('nnn -p -', {'on_stdout': function('s:callback'), 'stdout_buffered': v:true }) Where I get a single list as output:
This looks like something that we can parse where the items in the list are the actual selected files outputted by nnn except for the first item. The first item is a string containing escape codes and the first selected item at the end of it.
This could be something that can be work on for now but I hope there is something from the nnn or neovim side that could make it easier. Note that I have not tried nnn with the jarun/nnn@2bd72d1 patch yet and only tried neovim. I hope this will be of help. |
Beta Was this translation helpful? Give feedback.
-
Thank you so much! Not sure if we should proceed with the Have you considered the possibility of having |
Beta Was this translation helpful? Give feedback.
-
I'm not that familiar with named pipes and I look at some usage from other plugins and it looks promising. |
Beta Was this translation helpful? Give feedback.
-
We currently can't use a named pipe because for some reason |
Beta Was this translation helpful? Give feedback.
-
I have a working prototype of this utilizing |
Beta Was this translation helpful? Give feedback.
-
How should the buffer be opened on selection? This is turning out to be more complicated than I thought. |
Beta Was this translation helpful? Give feedback.
-
Here is NERDTree's interface: I was thinking of just using the normal edit options, plus the previous-window option and also the reuse option. |
Beta Was this translation helpful? Give feedback.
-
I have a working implementation! Take a look: https://asciinema.org/a/MEsmOftxBqhBH4fYjkvPAZvrS cc @jarun Edit: highlighting doesn't show correctly in the asciinema, but that's irrelevant. |
Beta Was this translation helpful? Give feedback.
-
Using tmux with a shellwrapper you can sort of get a persistent explorer: #!/bin/sh
ssn_name="VIMTMUX"
split_open_vim() {
tmux split-window -t "$ssn_name" -l '75%' -h vim --servername "$ssn_name" "$@"
}
if [ -z "$TMUX" ]; then
tmux new-session -d -s "$ssn_name"
tmux send-keys -t "$ssn_name" "export EDITOR=$0" Enter
tmux send-keys -t "$ssn_name" "nnn; exit" Enter
[ -n "$1" ] && split_open_vim "$@"
tmux attach-session -d -t "$ssn_name"
exit
fi
session="$(vim --serverlist)"
if [ "$session" = "$ssn_name" ]; then
vim --servername "$ssn_name" --remote-tab "$@"
tmux select-pane -t "$ssh_name" -R
else
split_open_vim "$@"
fi I'm not sure if this will work on neovim or not. Also not a tmux user, so the script probably has a lot room for improvements. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
Coming from more graphical editors and IDEs, I'm used to having a file explorer open all the time.
Describe the solution you'd like
Using netrw in nvim I can get roughly equivalent behavior:
Is it possible to do this with nnn instead?
Describe alternatives you've considered
Seems feasible to pass the file list back to vimscript on some bindable keypress and then process it as usual. I dont have the familiarity with nnn or vimscript to implement it myself atm.
Beta Was this translation helpful? Give feedback.
All reactions