-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to set the alternate buffer? #25
Comments
You can try adding |
execute 'keepalt' a:cmd ... |
I think this is related to the issue I was about to report. It's pretty annoying: vinegar breaks Steps to reproduce
This is never what I want, and it's probably never what anyone wants. (Though as you say, it could well be netrw's fault.) |
Okay that's just ridiculous. The netrw buffer is the alternate buffer here. Skipping it might be a bit more DWIM but the existing behavior is definitely not "broken". |
Good point. I was just plain wrong when I said vinegar broke something -- sorry! However, just because it's not broken doesn't mean it couldn't be better. As I said, it seems to me that no vinegar user ever wants A policy of "never make netrw the alternate buffer for vinegar users" would solve both my problem and the original poster's. I don't know how hard it would be to implement, but it seems like it would clearly improve user experience. And making netrw better for users is, of course, the whole point of vinegar. |
Thinking about this more: I don't think you'd want to change I found that the issue has been discussed on the vim-dev Google group. Opinions were split for and against the Anyway... here is the solution.
Once I get the new netrw working, I've confirmed that it does the wrong thing without |
Fixing this with a preference in netrw seems like the correct solution, not a vinegar problem. @chiphogg's instructions work perfectly for me. |
@chiphogg |
I've recompiled Vim, pulled in netrw, tagged and checked out that commit, and added that altfile line to my vimrc, and |
Note that g:netrw_altfile = 1 still doesn't seem to keep the old file as the alternate one. If I try to use ctrl-^ after opening a new file with netrw, I get an error saying "No alternate file", when I'd obviously prefer to go back to the previous file. |
It has long annoyed me that once I've started to explore the directory of a file using my `-` mapping, I can't easily get back to the file with `<space><space>` (ie. `<leader><leader>`) or `<C-^>`. The same issue affects vim-vinegar (although I am not using right now). There is a workaround when using netrw, which is setting the `g:netrw_altfile` option, which causes netrw to use `:keepalt` under the covers: tpope/vim-vinegar#25 Anyway, I've added a similar option to NERDTree in my fork and have an open PR for it here: preservim/nerdtree#550 * roles/dotfiles/files/.vim/bundle/nerdtree 4ebbb53...9843fd3 (1): > Make window creation command configurable
It has long annoyed me that once I've started to explore the directory of a file using vim-vinegar's `-` mapping, I can't easily get back to the file with `<space><space>` (ie. `<leader><leader>`) or `<C-^>`. Thanks to @wincent [0], I have found a workaround: tpope/vim-vinegar#25 Unfortunately, this doesn't fix my other annoyance of netrw polluting the jumplist. Looking at `:help netrw` it looks like `g:netrw_keepj` intends to do this and it is defaulted to "keepj" (on), but it isn't quite as good as I would like. [0]: wincent/wincent@337792ff
So sorry for reviving this 6+ year old thread. But as @boblehest said, using |
I'm not sure I've understood the OP correctly but what I was looking for is a way to open netrw after pressing to a new window, leaving my current file in its place. I've tried @chiphogg without any success. Any ideas on what I'm doing wrong? Thanks |
A little indirect but |
Thanks, that is perfect. |
After only a few days using vinegar, I'm now quite addicted to hitting
-
to navigate around. It's a lot faster than what I used to do, so thank you!The one habit I can't break is that once I navigate to a new file, I want to flip back to the last one I was on, and I do
:b#
. This dumps me back into the file browser rather than to the last file. I get surprised every time, and end up having to open up Unite to browse my open buffers.Do I need to just break my bad habit, or does this make sense as something that vinegar could make behave better?
The text was updated successfully, but these errors were encountered: