Skip to content

Run __mundo__ autocmds earlier #92

@BlueDrink9

Description

@BlueDrink9

I use some autocmds to set the default filetype for new buffers:

autocmd myVimrc BufNewFile * filetype detect | if &filetype == "" | setlocal ft=scratch | endif
" No names
autocmd myVimrc BufEnter {} if &filetype == "" | setlocal ft=scratch | endif
autocmd myVimrc BufEnter * if &filetype == "" | setlocal ft=conf

For some reason, the combination of the first and last autocmd in that list breaks mundo, causing the __mundo__ files to be opened as actual non-hidden new files, with ft=scratch.

Changing the MundoAug groups to BufNewFile instead of BufEnter fixes this:

autocmd BufNewFile __Mundo__ call s:MundoSettingsGraph()
autocmd BufNewFile __Mundo_Preview__ call s:MundoSettingsPreview()

This would mean re-entering an existing Mundo window wouldn't reapply the autocmd. That's potentially a benefit, since it is marginally more efficient if they only set local settings anyway (which can't be changed unless within the buffer), and wouldn't override user changes to buffer settings each time they re-enter it.

It also makes Mundo's ft setup etc more robust, since it's happening earlier in the setup process. It stops buggy vimrc or plugins from modifying the buffer if their autocmds fire first, for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions