Skip to content

b:undo_ftplugin cannot undo window-local options in every window showing a buffer #21243

Description

@barrettruth

Steps to reproduce

Start Vim:

vim --clean

Then run:

:filetype plugin on
:setglobal colorcolumn=
:set filetype=fixture
:setlocal colorcolumn=73
:let b:undo_ftplugin = 'setlocal colorcolumn<'
:split
:set filetype=text
:windo echo win_getid() (empty(&l:colorcolumn) ? '<empty>' : &l:colorcolumn)
:messages

Actual behaviour

The current window has an empty colorcolumn, but the other window still has colorcolumn=73:

1001 <empty>
1000 73

Expected behaviour

Both windows should stop showing the filetype-specific color column when their shared buffer changes filetype. Generally, :help undo_ftplugin says that "the effect of the previous filetype should be undone" - and this isn't really true.

Obviously, we know that a buffer-scoped undo hook cannot fully undo window-local effects when the buffer is displayed in multiple windows. Just wanted to canonicalize this issue here as I found it today.

Note that this is distinct from #17113.

Version of Vim

9.1.1752

Environment

macOS arm64 + nix

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions