]> Sergey Matveev's repositories - dotfiles.git/blobdiff - vim/.vim/autoload/python/pep8.vim
Vim scripts refactoring
[dotfiles.git] / vim / .vim / autoload / python / pep8.vim
diff --git a/vim/.vim/autoload/python/pep8.vim b/vim/.vim/autoload/python/pep8.vim
new file mode 100644 (file)
index 0000000..389e2ec
--- /dev/null
@@ -0,0 +1,18 @@
+" PEP8 caller
+" Maintainer: Sergey Matveev <stargrave@stargrave.org>
+" License: GNU General Public License version 3 of the License or later
+"
+" Call pycodestyle utility and fill quickfix window with its results.
+
+function! python#pep8#do() abort
+    set makeprg=PATH=$PATH\ pycodestyle\ --select=E,W\ %
+    silent make
+    sign unplace *
+    let l:id = 1
+    for item in getqflist()
+        execute(':sign place '.l:id.' name=P8 line='.l:item.lnum.' buffer='.l:item.bufnr)
+        let l:id = l:id + 2
+    endfor
+    redraw!
+    copen
+endfunction