Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rcaputo opened this issue Oct 27, 2017 · 1 comment
Closed

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

rcaputo opened this issue Oct 27, 2017 · 1 comment

Comments

@rcaputo
Copy link
Contributor

rcaputo commented Oct 27, 2017

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)

@kljohann
Copy link
Member

kljohann commented Nov 2, 2017

Thanks for tracking this down! After looking at filetype.vim shipped with vim I think we should switch to au BufNewFile,BufRead setf ledger. For setting the compiler option we should include the following in ftplugin/ledger.vim:

if !exists('current_compiler')
  compiler ledger
endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants