pla*_*etp 2 python vim virtualenv isort vim-ale
我想通过ALE插件设置isort在 Vim 中使用。我已将此快捷方式添加到我的:.vimrc
nnoremap <leader>I :ALEFix isort<CR>
Run Code Online (Sandbox Code Playgroud)
但是,当我激活它时,什么也没有发生。我已经isort在全局和 virtualenv 中安装了。谁能给我提示如何调试/解决这个问题?
来自 ALE 的README.md
ALE 可以使用 ALEFix 命令修复文件。需要使用 ab:ale_fixers 在每个缓冲区中配置函数,或者使用 g:ale_fixers 全局配置函数。配置修复程序的推荐方法是在 ftplugin 文件中定义一个列表。
正确的配置方法isort是g:ale_fixers在vimrc/init.vim或.b:ale_fixersftplugin/python.vim
例如
" setting it globally
let g:ale_fixers = {
\ 'python': ['black', 'isort'],
\ }
Run Code Online (Sandbox Code Playgroud)
您想要传递给 isort 的任何命令行选项都可以通过设置来完成g:ale_python_isort_options。
let g:ale_python_isort_options = '--profile black -l 100'
Run Code Online (Sandbox Code Playgroud)
如果你想在保存文件时自动修复文件,你需要在 vimrc 中打开一个设置。
" Set this variable to 1 to fix files when you save them.
let g:ale_fix_on_save = 1
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1081 次 |
| 最近记录: |