ranger.vim
ranger.vim copied to clipboard
Tab feature
Implements the following:
- Remove the Bclose dependency
- Fix a bug with the alternate file as described in issue #25
- Implement a non-default option to see Ranger in a new tab
mmm, as you know I'm still learning git(hub), that 'review' was meant to accompany commit 91bdf17 about tempname()
I'm not sure what to do when the user edits a directory but doesn't choose a file. In light of your decision to not consider the directory buffer for the alternate, it means that if a user has:
- fileA
- fileB
- edits a directory
- a. does not choose a file
he should end up with fileB open and fileA being alternate. b. does choose a file
he should end up with the new file and fileB being alternate
4b is easy, we determine what the alternate buffer is in the directory buffer before opening Ranger, and pass it as a window variable. 4a however I've no idea how to do, the problem is knowing what the alternate buffer was before the user edited a directory. Before they do so, the plugin has no functions running, no way to go back in time to before the new (directory)buffer was created and as a result we have an extra buffer standing between us and an easy way to determine the alternate
About 4a, I found a neovim function let buffers = nvim_list_bufs() that return the buffer numbers as an array. So I guess the third element should be the fileA: let fileA = nvim_list_bufs()[2].
I don't think we can rely on the buffer numbers, that would work in this simple example, but I think the buffer numbers do not represent the order in which buffers are visited, only the order in which they were opened, there's a big difference most of the time.
If there's a function that returns a list of the order in which buffers have been visited for the current session or something that would be exactly what we need
hum yes I found this PR of fzf https://github.com/junegunn/fzf.vim/commit/852cfa0c11d5661d79ed1faf1cc211b3c6ef7b00#diff-7274b7c6c87526542ef9087f2e997dfaR411 that solve this specific problem of getting the buffers list ordered... but it doesn't look obvious. The related issue is https://github.com/junegunn/fzf.vim/issues/100
That is quite similar to the workaround I had in my mind, except that I wasn't thinking to use a timestamp, just a window variable (w:old_alternate) to set on BufLeave with that buffer's alternate, so a new buffer in the window can look into that. I just didn't want to have to do this for every BufLeave
Any plans on merging this @francoiscabrol?