thoughtbot/dotfiles

ALE config causes Multiple Cursors plugin to be slow

stevehanson opened this issue · 2 comments

This isn't really an issue with these dotfiles as much as a heads-up that they are causing an issue with a popular plugin, vim-multiple-cursors. I'm mostly submitting this for reference for other people trying to debug this issue.

These dotfiles currently have this ALE configuration, which causes ALE to lint when insert mode is toggled:

augroup vimrcEx
  autocmd!
  " ...

  " ALE linting events
  if g:has_async
    set updatetime=1000
    let g:ale_lint_on_text_changed = 0
    autocmd CursorHold * call ale#Lint()
    autocmd CursorHoldI * call ale#Lint()
    autocmd InsertEnter * call ale#Lint()
    autocmd InsertLeave * call ale#Lint()
  else
    echoerr "The thoughtbot dotfiles require NeoVim or Vim 8"
  endif
augroup END

Since the Multiple Cursors plugin internally goes in and out of insert mode frequently, the result is that using multiple cursors is very slow, taking up to several seconds to respond to keystrokes. I'm using Nvim 0.2.2.

I personally like the ALE defaults and would be in favor of removing the ALE customization from these dotfiles, though I understand that others might disagree. Happy to supply a PR to do that.

If the maintainers of this repo are not in favor of removing the customizations, here is some code that can be used in dotfiles.local to override this behavior with the ALE default behavior:

let g:ale_lint_on_text_changed = 1
autocmd! vimrcEx CursorHold *
autocmd! vimrcEx CursorHoldI *
autocmd! vimrcEx InsertEnter *
autocmd! vimrcEx InsertLeave *

Hi @stevehanson, could you submit your suggested code snippet as a README change so that users can make use of this if they are using a plugin with similar weight like multiple cursors? I don't think removing the defaults will be popular, but your workaround is slick and I'm sure there will be others who would like to use the defaults as you are.

@geoffharcourt sounds good. I just submitted #610 with the readme updates. Overriding the ALE config is now simpler than what I had suggested here, since the ALE config has now been isolated into its own augroup.