-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Add option to control whether tagstack is copied to new window #17589
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not much of an opinion on it, other what I mentioned below. @yegappan I think you might have some opinion here?
I'm used to the current behavior where the tag stack is copied to new windows While adding yet another option to Vim always warrants consideration, I don't |
Interesting, I haven't thought about this use-case myself. |
Instead of an option, could this be solved at the user-config level with an autocommand that clears the tagstack when a new window is opened? That would avoid making Vim itself more complicated (more options: more cognitive load). Heck, I’m not sure if any plugin authors rely on this behavior. |
|
The request is a bit similar to #17248. I don't think there is a way to clean the tag-stack. |
You mean something like ? I guess this would work too and command to clean tag stack seems useful in general.
True, I'm not sure how to check this... |
Are there examples of such modifiers in current Vim ? Sorry, I'm not really a Vim expert. |
Yes, although for some reason I thought there was a function API for clearing it because I remembered working with related stuff in https://github.com/benknoble/tag-tracks
Me neither at the moment. |
Yes, if you count |
Something I omitted from my first reply (below), you probably want the
|
|
Indeed, it makes sense for By the way, even with the current implementation, you can clear the tagstack only for :au BufWinEnter * call settagstack(0, {'items' : []})(In my case I’d use |
This could be used in autocommands like
autocmd WinNew * :call cleartagstack()
to auto-clear tagstacks of new windows.
|
I tried to address all review comments from @chrisbra. I've also added an example The final PR, I assume, will contain either option or command, not both. Using autocmd is fine with me, I'd appreciate if maintainers could comment whether this may be somehow inferior to a full-blown option. And I still need to figure out the crash for |
This may be up to some debate. E.g. if I'm in the middle of deep navigation stack for my app and decide to open a file from side project to check something, I'd personally prefer that side file to have a independent stack (e.g. to avoid accidentally returning to "inherited" stack when pressing Ctrl-T multiple times).
I'd say
Yup, in new patch I'm adding |
@h-east FWIW I suggested |
|
It may just be that I'm on mobile, but the indentation in C files from the cleartagstack patch looks odd. |
FYI I observe the following behaviours for different variants of
|
Oh, sorry about that. Any file in particular? In general I tried to follow the existing code. In particular formatting of |
|
Summary of current status:
If no one can see potential issues with I guess there is no need for any changes and PR can be closed (I could also experiment with it for some time and report my findings). |
|
Can you please try out the autocmd solution? It seems like it is enough and we shouldn't require any code changes here. But I'll leave this open so you can report back how well this approach works in practice. |
This is a simple fix for an old issue #5742.
Some people find that default Vim's behavior of copying entire tag stack when splitting a window with unrelated file is confusing. This PR adds a flag (
copytagstack) to give users control over this.Please note that, not being a Vim expert, I may miss some hidden issues. I'd be happy to improve/rewrite PR as necessary.