47 lines
1.6 KiB
VimL
47 lines
1.6 KiB
VimL
|
|
" Python
|
|
"
|
|
|
|
" For pylint (make sure to pip3 install pylint)
|
|
" au BufRead *.py set makeprg=pylint\ --reports=n\ --output-format=parseable\ %:p
|
|
" au BufRead *.py set errorformat=%f:%l:\ %m
|
|
|
|
autocmd FileType python set makeprg=pylint\ --reports=n\ --msg-template=\"{path}:{line}:\ {msg_id}\ {symbol},\ {obj}\ {msg}\"\ %:p
|
|
autocmd FileType python set errorformat=%f:%l:\ %m
|
|
|
|
highlight BadWhitespace ctermbg=red guibg=red
|
|
|
|
" Python, PEP-008
|
|
au BufRead,BufNewFile *.py,*.pyw set expandtab
|
|
au BufRead,BufNewFile *.py,*.pyw set textwidth=139
|
|
au BufRead,BufNewFile *.py,*.pyw set tabstop=4
|
|
au BufRead,BufNewFile *.py,*.pyw set softtabstop=4
|
|
au BufRead,BufNewFile *.py,*.pyw set shiftwidth=4
|
|
au BufRead,BufNewFile *.py,*.pyw set autoindent
|
|
au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
|
|
au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /\s\+$/
|
|
au BufNewFile *.py,*.pyw let fileformat=unix
|
|
au BufRead,BufNewFile *.py,*.pyw let b:comment_leader = '#'
|
|
|
|
autocmd BufWritePost *.py call Flake8()
|
|
|
|
let g:flake8_show_in_gutter=1 " show
|
|
|
|
|
|
" How can I open a NERDTree automatically when vim starts up if no files were specified?
|
|
|
|
autocmd StdinReadPre * let s:std_in=1
|
|
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
|
|
|
|
" How can I map a specific key or shortcut to open NERDTree?
|
|
map <C-n> :NERDTreeToggle<CR>
|
|
|
|
" How can I close vim if the only window left open is a NERDTree?
|
|
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree. isTabTree()) | q | endif
|
|
|
|
|
|
" Easier VIM split navigations
|
|
nnoremap <C-J> <C-W><C-J>
|
|
nnoremap <C-K> <C-W><C-K>
|
|
nnoremap <C-L> <C-W><C-L>
|
|
nnoremap <C-H> <C-W><C-H>
|