X-Git-Url: http://www.git.stargrave.org/?p=dotfiles.git;a=blobdiff_plain;f=vim%2F.vim%2Fftplugin%2Fpython%2Fpylint.vim;fp=vim%2F.vim%2Fftplugin%2Fpython%2Fpylint.vim;h=0000000000000000000000000000000000000000;hp=f0dd0a7ac0a3387e7368dfa0fa64d3f01699e669;hb=1280549be01e3ce72d9e0aeef6254a1ff14a25a3;hpb=86cacc081de452eb66d50f13261310b07f8ca2d4 diff --git a/vim/.vim/ftplugin/python/pylint.vim b/vim/.vim/ftplugin/python/pylint.vim deleted file mode 100644 index f0dd0a7..0000000 --- a/vim/.vim/ftplugin/python/pylint.vim +++ /dev/null @@ -1,99 +0,0 @@ -" Asynchronous pylint utility call -" Maintainer: Sergey Matveev -" License: GNU General Public License version 3 of the License or later -" -" This plugin allows you to asynchronously call pylint. -" -" * Add %{LintStatus()} to your statusline to see if pylint is running -" * Press to start pylint on current file -" * Press to open quickfix window with messages from pylint -" * All lines with corresponding pylint existing warning will be highlighted -" * If no warning and errors occurred, "pylint is clean" message will be shown -" * If existing quickfix window is found, then it won't be overwritten. -" Start pylint manually () to force its filling -" * After Python file is saved, pylint is automatically started - -if exists('g:loaded_pylint') | finish | endif -let g:loaded_pylint = 1 - -function! LintStatus() - if exists("b:lint_job") && job_status(b:lint_job) == "run" | return "LN" | endif - return "" -endfunction - -function! s:qffill(ch) - let msgs = [] - while ch_status(a:ch) == 'buffered' - let msgs = add(msgs, ch_read(a:ch)) - endwhile - cgetexpr msgs -endfunction - -sign define LN text=LN texthl=Error - -function! PylintFinish(ch) - let l:errorformat_bak = &errorformat - set errorformat=%f:%l:\ [%t]%m,%f:%l:%m - call s:qffill(a:ch) - let &errorformat=l:errorformat_bak - sign unplace * - let l:id = 2 - for item in getqflist() - if item.lnum == 0 | continue | endif - execute(':sign place '.l:id.' name=LN line='.l:item.lnum.' buffer='.l:item.bufnr) - let l:id = l:id + 2 - endfor - redraw! - if l:id == 2 - echohl MoreMsg | echomsg "pylint is clean" | echohl None - cclose - endif -endfunction - -function! PylintStart() - if exists("g:pylint_disable") || (exists("b:lint_job") && job_status(b:lint_job) == "run") - return - endif - let ignores = [ - \"locally-disabled", - \"no-init", - \"no-self-use", - \"too-few-public-methods", - \"missing-docstring", - \"too-many-instance-attributes", - \"invalid-name", - \"too-many-arguments", - \"too-many-locals", - \"too-many-public-methods", - \"no-value-for-parameter", - \] - if !exists("g:pylint_linter") | let g:pylint_linter = "pylint" | endif - if g:pylint_linter == "flake8" - let cmdline = [ - \"flake8", - \"--ignore=E501", - \"--format=%(path)s:%(row)d: [%(code)s] %(text)s", - \"--max-line-length=90", - \expand("%p") - \] - elseif g:pylint_linter == "pylint" - let cmdline = [ - \"pylint", - \"--jobs=4", - \"--reports=n", - \"--msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}", - \"--disable=" . join(ignores, ","), - \"--persistent=n", - \"--score=no", - \expand("%p") - \] - else - echohl WarningMsg | echomsg "Unknown linter specified" | echohl None - return - endif - let b:lint_job = job_start(cmdline, {"in_mode": "nl", "err_io": "null", "close_cb": "PylintFinish"}) -endfunction() - -map :unlet! g:pylint_disable:call PylintStart() -map [32~ :redraw!:copen -autocmd BufWritePost *.py call PylintStart()