vim

Do not share vim navigation stack when opening new buffer


If I navigate to a vim tag via Ctrl-] and then open a new buffer e.g. via :new the vim tag stack of the new buffer is shared with the old one (i.e. :tags will show the stack of the old buffer and also Ctrl-T in the new buffer will return to the tags of the old buffer). Is there a way to change this behavior so that the new buffer has a clear (empty) tag history? Is there an option to clear tag history on opening a new buffer by default?


Solution

  • This is a known issue in Vim. It can be worked around with autocommand

    :au WinNew * call settagstack(winnr(), {'items' : []})
    

    (based on advice in related PR).