Reputation: 16065
I want to set up isort
to be used in Vim via the ALE plugin. I've added this shortcut to my .vimrc
:
nnoremap <leader>I :ALEFix isort<CR>
However, when I activate it nothing happens. I have isort
installed both globally and in the virtualenv. Could anyone give me a hint how to debug/solve this issue?
Upvotes: 2
Views: 1302
Reputation: 369
From ALE's README.md
ALE can fix files with the ALEFix command. Functions need to be configured either in each buffer with a b:ale_fixers, or globally with g:ale_fixers. The recommended way to configure fixers is to define a List in an ftplugin file.
The proper way of configuring isort
is by setting g:ale_fixers
in your vimrc
/ init.vim
or b:ale_fixers
in ftplugin/python.vim
.
E.g.
" setting it globally
let g:ale_fixers = {
\ 'python': ['black', 'isort'],
\ }
Any command line options you want to pass to isort you do it by setting g:ale_python_isort_options
.
let g:ale_python_isort_options = '--profile black -l 100'
If you want to automatically fix files when you save them, you need to turn a setting on in vimrc.
" Set this variable to 1 to fix files when you save them.
let g:ale_fix_on_save = 1
Upvotes: 10