Skip to content

Conflict with FastFold plugin slows down window switching a lot. #64

Closed
@rcaputo

Description

@rcaputo

I've been looking into a slowdown in the FastFold plugin when switching to a ledger window. It turns out that it may be dueling autocmd handlers. The discussion is at Konfekt/FastFold#48 and it begins to get interesting for vim-ledger at Konfekt/FastFold#48 (comment)

The very short version is that ftdetect/ledger.vim should avoid setting the filetype on BufEnter, only on BufRead.

This is working very well for me:

% cat ftdetect/ledger.vim
autocmd BufRead *.ldg,*.ledger setlocal filetype=ledger | compiler ledger

The medium version is that windo will trigger BufEnter on a ledger. If that windo is invoked as part of autocmd FileType, it will complete a loop with vim-ledger:

  • Ledger autocmd BufEnter does setlocal filetype.
  • FastFold autocmd FileType triggers Ledger's BufEnter.
  • This locks up vim for several seconds depending on the size of the ledger file.

To be fair, FastFold uses noautocmd windo. For some reason I haven't determined it's still triggering autocmds.

You can see the looping happen in the verbose.log, which I've excerpted at Konfekt/FastFold#48 (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