Skip to content

Instantly share code, notes, and snippets.

@sirosen
Created April 8, 2019 21:17
Show Gist options
  • Save sirosen/0f287cbc14713159cee902623682ffaa to your computer and use it in GitHub Desktop.
Save sirosen/0f287cbc14713159cee902623682ffaa to your computer and use it in GitHub Desktop.
vimrc autodetect py_autoformat
" ALE conf
let g:ale_fixers = {
\ '*': [],
\ 'python': ['isort', 'black'],
\}
let g:airline#extensions#ale#enabled = 1
" if a '.__py_autoformat' file is in the cwd or a parent of the cwd, enable ALE fix_on_save and tune for black
augroup py_ft
au!
autocmd BufNewFile,BufRead *.py if !empty(findfile("\.\_\_py\_autoformat", ".;")) | let g:ale_fix_on_save = 1 | set textwidth=90 | endif
autocmd BufNewFile,BufRead *.py set foldnestmax=1 foldlevel=1 foldmethod=indent
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment