Reputation: 6279
I'm using https://github.com/w0rp/ale plugin. But it makes vim less responsive... I have a bind for ALETooggle
on <leader>l
.
It would be nice to have it disabled by default and enable by keyboard shortcut when wanted, I tried to put ALEDisable
on my .vimrc
but it gives me the error below
Error detected while processing /Users/daniel/.vimrc:
line 94:
E492: Not an editor command: ALEDisable
Press ENTER or type command to continue
Here is a sample .vimrc
that would trigger the problem
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
Plugin 'w0rp/ale'
call vundle#end() " required
filetype plugin indent on " required
noremap <leader>l :ALEToggle<CR>
ALEDisable
Upvotes: 11
Views: 9733
Reputation: 693
The ALE plugin provides an option named g:ale_enabled
to disable ALE by default, so this way is plugin manager agnostic.
If you set g:ale_enabled
to 0
then ALE is disabled for any buffer.
Also the plugin provides an option to control ALE availability based on file name.
Here is an example found with :h g:ale_enabled
:
" Disable linting for all minified JS files.
let g:ale_pattern_options = {'\.min.js$': {'ale_enabled': 0}}
You can enable ALE using :ALEEnable
or :ALEToggle
when you want to enable it.
Upvotes: 19
Reputation: 3159
The most elegant solution is to use a better plugin manager like Plug or Dein. Why? Because they're well maintained and much more faster and efficient than the current plugin manager you use. And most importantly they support lazy loading of plugins with ease.
For your purpose of loading the plugin on map, you can do either of these :
Plug 'w0rp/ale', { 'on': 'ALEToggle' }
or
call dein#add('w0rp/ale',{'on_cmd': 'ALEToggle'})
the same lazy loading maybe possible with vundle too i guess, but believe me, it's worth using either vim-plug or dein, cause they're super fast and intuitive.
Upvotes: 2