mirror of
https://github.com/aquatix/dotfiles.git
synced 2025-12-07 00:05:10 +01:00
Compare commits
3 Commits
f91fecc57d
...
bf8a2f9a73
| Author | SHA1 | Date | |
|---|---|---|---|
| bf8a2f9a73 | |||
| 777cd6c46e | |||
| 2f0a76fa54 |
40
.vim/after/ftplugin/python.vim
Normal file
40
.vim/after/ftplugin/python.vim
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
python3 <<EOF
|
||||||
|
import vim
|
||||||
|
from importlib.util import find_spec
|
||||||
|
import os
|
||||||
|
import glob
|
||||||
|
|
||||||
|
def find_virtualenv(virtualenv_names):
|
||||||
|
cwd = vim.eval('getcwd()')
|
||||||
|
while cwd != '/':
|
||||||
|
for virtualenv_name in virtualenv_names:
|
||||||
|
venv_path = os.path.join(cwd, virtualenv_name)
|
||||||
|
if os.path.exists(venv_path):
|
||||||
|
return venv_path
|
||||||
|
|
||||||
|
cwd, _ignored = os.path.split(cwd)
|
||||||
|
|
||||||
|
return os.environ.get('VIRTUAL_ENV')
|
||||||
|
|
||||||
|
# If we have a virtualenv, check to see whether it contains pylint and the
|
||||||
|
# django module. If we don't, just try to import both. We can't even use
|
||||||
|
# ale's "ale_virtualenv_dir_names" here, because it's not set yet.
|
||||||
|
|
||||||
|
virtualenv_path = find_virtualenv(['virtualenv', 'venv']) #vim.eval('ale_virtualenv_dir_names')
|
||||||
|
|
||||||
|
if virtualenv_path:
|
||||||
|
has_pylint_django = glob.glob(os.path.join(virtualenv_path, 'lib/*/site-packages/pylint_django'))
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
find_spec('pylint_django')
|
||||||
|
has_pylint_django = True
|
||||||
|
except ImportError:
|
||||||
|
has_pylint_django = False
|
||||||
|
|
||||||
|
if has_pylint_django:
|
||||||
|
# No silly 80-char line limit. Sorry pep-8. Also, Django support. Disable 'invalid name', 'missing docstring'
|
||||||
|
vim.command("let g:ale_python_pylint_options='--max-line-length=120 --load-plugins pylint_django --disable=invalid-name,missing-docstring'")
|
||||||
|
else:
|
||||||
|
# No silly 80-char line limit. Sorry pep-8. Disable 'invalid name', 'missing docstring'
|
||||||
|
vim.command("let g:ale_python_pylint_options='--max-line-length=120 --disable=invalid-name,missing-docstring'")
|
||||||
|
EOF
|
||||||
@@ -120,3 +120,4 @@ automagisch
|
|||||||
gechild
|
gechild
|
||||||
wijkcoördinatoren
|
wijkcoördinatoren
|
||||||
lasagnette
|
lasagnette
|
||||||
|
Vlaskamp
|
||||||
|
|||||||
Binary file not shown.
17
.vimrc
17
.vimrc
@@ -295,6 +295,16 @@ Plugin 'zchee/deoplete-jedi'
|
|||||||
Plugin 'Shougo/neco-syntax'
|
Plugin 'Shougo/neco-syntax'
|
||||||
|
|
||||||
let g:deoplete#enable_at_startup = 1
|
let g:deoplete#enable_at_startup = 1
|
||||||
|
|
||||||
|
" Enable tab complete
|
||||||
|
function! s:check_back_space() abort "{{{
|
||||||
|
let col = col('.') - 1
|
||||||
|
return !col || getline('.')[col - 1] =~ '\s'
|
||||||
|
endfunction"}}}
|
||||||
|
inoremap <silent><expr> <TAB>
|
||||||
|
\ pumvisible() ? "\<C-n>" :
|
||||||
|
\ <SID>check_back_space() ? "\<TAB>" :
|
||||||
|
\ deoplete#manual_complete()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@@ -313,11 +323,8 @@ let g:ale_fixers = {}
|
|||||||
" Python specific settings
|
" Python specific settings
|
||||||
let g:ale_fixers.python = ['isort']
|
let g:ale_fixers.python = ['isort']
|
||||||
" No silly 80-char line limit. Sorry pep-8. Also, Django support. Disable 'invalid name', 'missing docstring'
|
" No silly 80-char line limit. Sorry pep-8. Also, Django support. Disable 'invalid name', 'missing docstring'
|
||||||
if exists('b:is_django')
|
"let g:ale_python_pylint_options="--max-line-length=120 --disable=invalid-name,missing-docstring"
|
||||||
let g:ale_python_pylint_options="--max-line-length=120 --load-plugins pylint_django --disable=invalid-name,missing-docstring"
|
" VIMHOME/after/ftplugin/python.vim takes care of this
|
||||||
else
|
|
||||||
let g:ale_python_pylint_options="--max-line-length=120 --disable=invalid-name,missing-docstring"
|
|
||||||
endif
|
|
||||||
" Show errors or warnings in the statusline
|
" Show errors or warnings in the statusline
|
||||||
let g:airline#extensions#ale#enabled = 1
|
let g:airline#extensions#ale#enabled = 1
|
||||||
" UI
|
" UI
|
||||||
|
|||||||
Reference in New Issue
Block a user