From 565a12a968fa83f22aa8b95df45868eeb1039d0b Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 26 Aug 2019 00:21:16 +0200 Subject: [PATCH] Move lang config in ftplugin to load automatically --- .vim/ale.vim | 6 ++---- .vim/ftplugin/python.vim | 26 ++++++++++++++++++-------- .vim/ftplugin/rust.vim | 4 ++++ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.vim/ale.vim b/.vim/ale.vim index 5a3c1e2..5c74b55 100644 --- a/.vim/ale.vim +++ b/.vim/ale.vim @@ -1,11 +1,9 @@ -let g:ale_linters = {} let g:ale_completion_enabled = 1 let g:ale_sign_error = "✗" let g:ale_sign_warning = "⚠" -" Rust linting options -let g:ale_rust_cargo_use_clippy = 1 " installed with `rustup component add clippy-preview` -let g:rustfmt_autosave = 1 " installed with `rustup component add rustfmt` +" Enable warnings about trailing whitespace for all files. +let b:ale_warn_about_trailing_whitespace = 1 " ALE colors highlight ALEWarning ctermbg=Yellow diff --git a/.vim/ftplugin/python.vim b/.vim/ftplugin/python.vim index f9a572c..a70d3d3 100644 --- a/.vim/ftplugin/python.vim +++ b/.vim/ftplugin/python.vim @@ -1,12 +1,22 @@ +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set textwidth=79 +set expandtab +set autoindent +set fileformat=unix +set number + " Enable folding on indent set foldmethod=indent set foldlevel=99 -au BufNewFile,BufRead *.py - \ set tabstop=4 - \ set softtabstop=4 - \ set shiftwidth=4 - \ set textwidth=79 - \ set expandtab - \ set autoindent - \ set fileformat=unix +" Lint and check types +let b:ale_linters = ['mypy', 'pyls', 'pylint'] +let g:ale_lint_on_save = 1 +let g:ale_list_window_size = 20 +" Fix syntax with autopep8. +let b:ale_fixers = ['autopep8'] +let g:ale_fix_on_save = 1 +" Use .venv as a global default +let g:ale_virtualenv_dir_names = ['.venv'] diff --git a/.vim/ftplugin/rust.vim b/.vim/ftplugin/rust.vim index c759f56..18da5dd 100644 --- a/.vim/ftplugin/rust.vim +++ b/.vim/ftplugin/rust.vim @@ -3,3 +3,7 @@ nmap gs (rust-def-split) nmap gx (rust-def-vertical) nmap gd (rust-doc) set number + +" linting options +let g:ale_rust_cargo_use_clippy = 1 " installed with `rustup component add clippy-preview` +let g:rustfmt_autosave = 1 " installed with `rustup component add rustfmt`