Closed w0rp closed 7 years ago
Should it? As long as the plugin can react to change of global variables while being active the local vimrc plugin solves the problem (at least on per vim instance basis).
Yeah, that'll do the job. I won't implement this then. If anyone else asks how to handle this, I'll put it in the FAQ.
I just came here looking for the same way to have ale use eslint for 1 project and healthier for another.
You can use one of many Vim plugins that implement project configuration files and buffer-specific options in ALE. (Those that begin with b:
). You can also try using g:ale_pattern_options
to set options based on regular expression matches for paths.
Neovim has a way to run local .nvim.lua
, .nvimrc
or .exrc
files in the current directory, if the file is in the trust list. See :help 'exrc'
. Vim also has the exrc
option, but it doesn't seem to have a way to mark files as trusted, so Vim's implementation is considered dangerous and insecure, as mentioned in Vim's :help 'exrc'
.
Here's an example for Neovim, to disable ALE's automated fixing in a certain project. Create a file named .nvim.lua
in your current directory, with this line:
vim.g.ale_fix_on_save = 0
When you run Neovim in this directory for the first time, you will be asked whether you want to mark .nvim.lua
in this directory as trusted or not. If you trust it, the hash of the file is saved. If the file changes contents, you will be asked again if you trust it or not.
Some people want to configure ALE differently for different projects. Support should be added for loading a project configuration file before linting or fixing is done. It should work like so.
:source
the configuration file to run whatever VimL code is contained within.A variable might need to be set for the configuration file like
g:ale_active_buffer
for determining which buffer is being checked or fixed, as the current buffer (bufnr('')
) might be a different buffer from the buffer being checked or fixed.