Description
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
doessetlocal filetype
. - FastFold
autocmd FileType
triggers Ledger'sBufEnter
. - 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)