File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed
Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -75,4 +75,33 @@ line-length = 100
7575
7676### Editor Integration
7777
78- (This section to come!)
78+ #### Vim/Neovim
79+
80+ 1 . Install the [ ALE] ( https://github.com/dense-analysis/ale ) plugin. This is a
81+ popular asynchronous lint engine for Vim and Neovim and already does most of
82+ the heavy lifting for us. It supports many different ways to lint and fix
83+ code. Check out the documentation (` :help ale ` ) for more information.
84+ 2 . Because ` ni-python-styleguide ` is a wrapper around ` flake8 ` , you can add the
85+ following vim configuration lines to wherever you configure your vim project
86+ (you can do it in your ` init.vim ` or ` vimrc ` file, but then it will apply to
87+ all Python code you edit):
88+
89+ ``` vim
90+ let g:ale_python_flake8_executable = 'ni-python-styleguide'
91+ let g:ale_python_flake8_options = 'lint'
92+ let g:ale_linters = {'python': ['flake8']}
93+ let g:ale_python_black_executable = 'ni-python-styleguide'
94+ let g:ale_python_black_options = 'fix'
95+ let g:ale_fixers = {'python': ['isort', 'black']}
96+ ```
97+
98+ Note: You can set all of these with ` b: ` as well.
99+
100+ 3 . You can make ALE auto-fix issues, e.g., when hitting F8, or when saving:
101+
102+ ``` vim
103+ let g:ale_fix_on_save = 1 " Fix on save
104+ nmap <F8> <Plug>(ale_fix) " Fix on F8
105+ ```
106+
107+ Change all of these to your taste.
You can’t perform that action at this time.
0 commit comments