]> Sergey Matveev's repositories - dotfiles.git/commitdiff
Vim scripts refactoring
authorSergey Matveev <stargrave@stargrave.org>
Tue, 29 Jun 2021 09:11:53 +0000 (12:11 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 29 Jun 2021 09:46:32 +0000 (12:46 +0300)
40 files changed:
vim/.vim/autoload/buftabline.vim [new file with mode: 0644]
vim/.vim/autoload/chnglstnav.vim [new file with mode: 0644]
vim/.vim/autoload/ctags.vim [new file with mode: 0644]
vim/.vim/autoload/defsplit.vim [new file with mode: 0644]
vim/.vim/autoload/fileline.vim [moved from vim/.vim/plugin/file_line.vim with 79% similarity]
vim/.vim/autoload/go/getdoc.vim [new file with mode: 0644]
vim/.vim/autoload/python/importcompl.vim [new file with mode: 0644]
vim/.vim/autoload/python/lint.vim [moved from vim/.vim/ftplugin/python/pylint.vim with 74% similarity]
vim/.vim/autoload/python/pep8.vim [new file with mode: 0644]
vim/.vim/autoload/python/testname.vim [new file with mode: 0644]
vim/.vim/autoload/python/unused.vim [new file with mode: 0644]
vim/.vim/autoload/whereami.vim [new file with mode: 0644]
vim/.vim/ftdetect/mutt.vim
vim/.vim/ftplugin/c/autos.vim
vim/.vim/ftplugin/go/autos.vim
vim/.vim/ftplugin/go/fmt.vim
vim/.vim/ftplugin/go/gogetdoc.vim
vim/.vim/ftplugin/html/autos.vim
vim/.vim/ftplugin/python/autos.vim
vim/.vim/ftplugin/python/ignores.vim
vim/.vim/ftplugin/python/importcompl.vim
vim/.vim/ftplugin/python/lint.vim [new file with mode: 0644]
vim/.vim/ftplugin/python/pep8.vim
vim/.vim/ftplugin/python/testname.vim
vim/.vim/ftplugin/python/unused_remover.vim [deleted file]
vim/.vim/ftplugin/texinfo/autos.vim
vim/.vim/plugin/bracketedpaste.vim [new file with mode: 0644]
vim/.vim/plugin/buftabline.vim
vim/.vim/plugin/chnglstnav.vim
vim/.vim/plugin/ctags.vim
vim/.vim/plugin/defsplit.vim
vim/.vim/plugin/exted.vim
vim/.vim/plugin/fileline.vim [new file with mode: 0644]
vim/.vim/plugin/ggrep.vim
vim/.vim/plugin/grep.vim
vim/.vim/plugin/lsp.vim
vim/.vim/plugin/pastemode.vim [deleted file]
vim/.vim/plugin/whereami.vim
vim/.vim/plugin/zshfe.vim
vim/.vimrc

diff --git a/vim/.vim/autoload/buftabline.vim b/vim/.vim/autoload/buftabline.vim
new file mode 100644 (file)
index 0000000..7098d7b
--- /dev/null
@@ -0,0 +1,18 @@
+function! buftabline#do()
+    let bufsRaw = execute("buffers", "silent")
+    let bufs = []
+    for buf in split(bufsRaw, "\n")[:16]
+        let leftIdx = stridx(buf, '"')
+        let rightIdx = strridx(buf, '"')
+        let filename = substitute(buf[leftIdx + 1 : rightIdx - 1], "%", "%%", "g")
+        let linenum = split(buf[rightIdx:], " ")[-1]
+        let attrs = split(buf[:leftIdx-1], '\s\+')
+        let attrs = map(attrs, 'substitute(v:val, "%", "%%", "g")')
+        let attrs = (len(attrs) == 1) ? attrs[0] : attrs[0] . ":" . join(attrs[1:], "")
+        let attrs = "%#TabLine#" . attrs . "%*"
+        if len(filename) > 20 | let filename = "<" . filename[-(20-1):] | endif
+        let hl = (match(attrs, "%%") == -1) ? "%#TabLine#:" : "%#TabLineSel#"
+        let bufs = add(bufs, attrs . hl . filename . ":" . linenum . "%*")
+    endfor
+    return join(bufs, "  ")
+endfunction
diff --git a/vim/.vim/autoload/chnglstnav.vim b/vim/.vim/autoload/chnglstnav.vim
new file mode 100644 (file)
index 0000000..9bdf840
--- /dev/null
@@ -0,0 +1,4 @@
+function! chnglstnav#do(...)
+    if a:0 == 0 | return | endif
+    execute "normal " . a:1 . (a:1 > 0 ? "g;" : "g,")
+endfunction
diff --git a/vim/.vim/autoload/ctags.vim b/vim/.vim/autoload/ctags.vim
new file mode 100644 (file)
index 0000000..dc6f90e
--- /dev/null
@@ -0,0 +1,35 @@
+" Universal Ctags creator
+" Maintainer: Sergey Matveev <stargrave@stargrave.org>
+" License: GNU General Public License version 3 of the License or later
+"
+" Create "tags" file in your project's root first.
+" Then :Ctags LANG to fill it.
+
+function! ctags#do(lang, onlyCmd, verbose) abort
+    let dst = tagfiles()
+    if len(dst) == 0
+        echohl WarningMsg | echomsg "No tagfiles" | echohl None
+        return
+    endif
+    let dst = sort(dst, {a, b -> len(a) > len(b) ? 1 : len(a) == len(b) ? 0 : -1})[0]
+    let src = "/" . join(split(dst, "/")[:-3], "/")
+    if dst[0] != "/"
+        let dst = getcwd() . "/.tags/tags"
+        let src = getcwd()
+    endif
+    let cmdline = [
+        \"uctags",
+        \"--languages=" . a:lang,
+        \"--python-kinds=-i",
+        \"--c++-kinds=+p",
+        \"--recurse",
+    \]
+    if a:verbose == v:true | let cmdline += ["--verbose"] | endif
+    let cmdline += ["-f", dst, src]
+    if a:onlyCmd == v:true
+        echo join(cmdline, " ")
+        return
+    endif
+    execute "!" . join(cmdline, " ")
+    if a:verbose != v:true | redraw! | endif
+endfunction
diff --git a/vim/.vim/autoload/defsplit.vim b/vim/.vim/autoload/defsplit.vim
new file mode 100644 (file)
index 0000000..a159007
--- /dev/null
@@ -0,0 +1,92 @@
+" Python function call splitter
+" Maintainer: Sergey Matveev <stargrave@stargrave.org>
+" License: GNU General Public License version 3 of the License or later
+"
+" This plugin splits Python function call on several lines.
+"
+"   def foobar(self, foo: str, bar: Some[thing, too]) -> None:
+" to
+"   def foobar(
+"           self,
+"           foo: str,
+"           bar: Some[thing, too],
+"   ) -> None:
+"
+"   foo(bar, baz)[0]
+" to
+"   foo(
+"       bar,
+"       baz,
+"   )[0]
+"
+" You can un-split it using :Undefsplit command on the line where
+" splitting starts.
+"
+" :Defsplit has optional argument specifying how many opening round
+" parenthesis must be skipped.
+" :Defsplit 1 on foo(baz(baz(...))) produces
+"    foo(baz(
+"        baz(...),
+"    ))
+"
+" Also there is :Brsplit command behaving similarly, but it splits other
+" types of brackets: "{}", "[]".
+
+function! s:bracket_find(brs_allowable, line, offset)
+    let possible = []
+    for bracket in a:brs_allowable
+        let found = stridx(a:line, bracket, a:offset)
+        if found != -1 | let possible += [found] | endif
+    endfor
+    return min(possible)
+endfunction
+
+function! defsplit#do(brs_allowable, single_line_comma, ...) abort
+    if a:0 == 0 | let skip = 0 | else | let skip = str2nr(a:1) | endif
+    let shift = get(b:, "defsplit_shift", "    ")
+    let line = getline(".")
+    for i in range(len(line))
+        if line[i] != shift[0]
+            let prfx = strpart(line, 0, i)
+            if line[i : i+3] ==# "def " ||
+                \line[i : i+5] ==# "class " ||
+                \line[i : i+9] ==# "async def "
+                let shift .= shift
+            endif
+            break
+        endif
+    endfor
+    let brs = {"(": ")", "[": "]", "{": "}"}
+    let brfirst = s:bracket_find(a:brs_allowable, line, 0)
+    let brlast = strridx(line, brs[line[brfirst]])
+    while skip > 0
+        let brfirst = s:bracket_find(a:brs_allowable, line, brfirst + 1)
+        let brlast = strridx(line, brs[line[brfirst]], brlast - 1)
+        let skip -= 1
+    endwhile
+    let [curly, round, squar, outbuf] = [0, 0, 0, ""]
+    let ready = [strpart(line, 0, brfirst + 1)]
+    let trailing_comma = 1
+    for c in split(line[brfirst + 1 : brlast-1], '\zs')
+        if c ==# "*" | let trailing_comma = 0 | endif
+        if outbuf ==# "" && c ==# " " | continue | endif
+        let outbuf .= c
+        if c ==# "," && !curly && !round && !squar
+            let ready = add(ready, prfx . shift . outbuf)
+            let outbuf = ""
+        elseif c ==# "[" | let squar += 1
+        elseif c ==# "]" | let squar -= 1
+        elseif c ==# "(" | let round += 1
+        elseif c ==# ")" | let round -= 1
+        elseif c ==# "{" | let curly += 1
+        elseif c ==# "}" | let curly -= 1
+        endif
+    endfor
+    if trailing_comma && !(a:single_line_comma == v:true && len(ready) == 1)
+        let outbuf = outbuf . ","
+    endif
+    let ready = add(ready, prfx . shift . outbuf)
+    let ready = add(ready, prfx . strpart(line, brlast))
+    call append(line("."), ready)
+    normal "_dd
+endfunction
similarity index 79%
rename from vim/.vim/plugin/file_line.vim
rename to vim/.vim/autoload/fileline.vim
index 8d7c429b57d975d46ac4fcb8d3eb2c4b58ec5943..193328c316597afda3dd833b4681eb0817929a66 100644 (file)
@@ -1,9 +1,7 @@
 " Simplified version of http://www.vim.org/scripts/script.php?script_id=2184
 " that does not replace current window
 
-if exists('*<SID>gotoline') | finish | endif
-
-function! s:gotoline()
+function! fileline#goto() abort
     let file = bufname("%")
     if filereadable(file) | return | endif
     let names = matchlist(file, '\(.\{-1,}\):\%(\(\d\+\)\%(:\(\d*\):\?\)\?\)\?$')
@@ -17,6 +15,3 @@ function! s:gotoline()
     exec "normal! " . col_num . "|"
     exec "bdelete " . nr
 endfunction
-
-autocmd! BufNewFile *:* nested call s:gotoline()
-autocmd! BufRead *:* nested call s:gotoline()
diff --git a/vim/.vim/autoload/go/getdoc.vim b/vim/.vim/autoload/go/getdoc.vim
new file mode 100644 (file)
index 0000000..922c9cd
--- /dev/null
@@ -0,0 +1,34 @@
+" Popup documentation of specified object under the cursor
+" Requires github.com/zmb3/gogetdoc in the $PATH
+
+function! go#getdoc#status()
+    if exists("b:gogetdoc_job") && job_status(b:gogetdoc_job) == "run" | return "GD" | endif
+    return ""
+endfunction
+
+function! go#getdoc#got(ch) abort
+    let msgs = []
+    while ch_status(a:ch) == "buffered"
+        let msgs = add(msgs, ch_read(a:ch))
+    endwhile
+    if exists("b:godocid") | call popup_close(b:godocid) | endif
+    if len(msgs) == 0
+        echohl WarningMsg | echomsg "No go doc" | echohl None
+        return
+    endif
+    let msgs = msgs[2:]
+    let b:godocid = popup_atcursor(msgs[2:-2],
+        \ {"wrap": 0, "title": msgs[0], "move": "word"})
+endfunction
+
+function! go#getdoc#do() abort
+    if exists("b:gogetdoc_job") && job_status(b:gogetdoc_job) == "run" | return | endif
+    let pos = line2byte(line(".")) + col(".") - 2
+    let cmdline = "gogetdoc -pos " . expand("%p") . ":#" . pos
+    echomsg cmdline
+    let b:gogetdoc_job = job_start(cmdline, {
+        \"in_mode": "nl",
+        \"err_io": "null",
+        \"close_cb": "go#getdoc#got",
+    \})
+endfunction
diff --git a/vim/.vim/autoload/python/importcompl.vim b/vim/.vim/autoload/python/importcompl.vim
new file mode 100644 (file)
index 0000000..017d91a
--- /dev/null
@@ -0,0 +1,70 @@
+" Python imports insert completion
+" Maintainer: Sergey Matveev <stargrave@stargrave.org>
+" License: GNU General Public License version 3 of the License or later
+"
+" This plugin is intended for quick import-line insertion.
+" For example you have got "from foo.bar import Baz" import somewhere in
+" your Git-versioned code. In another file you can write "Baz" and then
+" press <F3> in insert mode. Completion menu will show you suggestions
+" of all import lines from your code containing Baz import.
+"
+" If you have Pylint or Pyflakes output in quickfix window, containing
+" unfedined variables errors, then you can you :call AllImportCompl()
+" function. It will go through the quickfix list and find all possible
+" imports, sort them and insert under current cursor position.
+"
+" It uses external "git grep" call and assumes that "canonical" Python
+" import format is used (single import per line).
+" You can use http://www.git.stargrave.org/?p=pyimportcan.git;a=blob;f=pyimportcan.pl
+" utility to convert existing imports to that format.
+
+let s:git_grep_cmd = "git grep -H --line-number --ignore-case --no-color "
+
+function! python#importcompl#sortByLen(s1, s2)
+    if len(a:s1) == len(a:s2) | return a:s1 > a:s2 | endif
+    return 1 ? len(a:s1) > len(a:s2) : -1
+endfunction
+
+function! python#importcompl#do() abort
+    normal diw
+    let output = system(s:git_grep_cmd . '"^from .* import .*' . @" . '" -- "*.py" "**/*.py"')
+    let suggestions = []
+    for line in split(output, "\n")
+        if stridx(line, "unused-import") != -1 | continue | endif
+        let m = matchlist(line, '^.*:\d\+:\(.*\)$')
+        if len(m) == 0 | continue | endif
+        call insert(suggestions, m[1])
+    endfor
+    call sort(suggestions, "python#importcompl#sortByLen")
+    call uniq(suggestions)
+    call reverse(suggestions)
+    call complete(col('.'), suggestions)
+    return ''
+endfunction
+
+function! python#importcompl#all() abort
+    let output = system(s:git_grep_cmd . '"^from .* import" -- "*.py" "**/*.py"')
+    let imports = {}
+    for line in split(output, "\n")
+        if stridx(line, "unused-import") != -1 | continue | endif
+        for regexp in [
+            \'^.*:\d\+:\(from .* import \(\w\+\).*\)$',
+            \'^.*:\d\+:\(from .* import \w\+ as \(\w\+\).*\)$',
+        \]
+            let m = matchlist(line, regexp)
+            if len(m) == 0 | break | endif
+            let imports[m[2]] = m[1]
+        endfor
+    endfor
+    let lines = getloclist(winnr())
+    if len(lines) == 0 | let lines = getqflist() | endif
+    let result = []
+    for line in lines
+        let m = matchlist(line.text, '\(E0602\|F821\).*' . "'" . '\(\w\+\)' . "'$")
+        if len(m) == 0 || !has_key(imports, m[2]) | continue | endif
+        call insert(result, imports[m[2]])
+    endfor
+    call sort(result, "i")
+    call uniq(result)
+    call append(".", result)
+endfunction
similarity index 74%
rename from vim/.vim/ftplugin/python/pylint.vim
rename to vim/.vim/autoload/python/lint.vim
index f0dd0a7ac0a3387e7368dfa0fa64d3f01699e669..dade81ef5cf92a8ff58d202eae6d848543867e73 100644 (file)
@@ -4,7 +4,6 @@
 "
 " This plugin allows you to asynchronously call pylint.
 "
-" * Add %{LintStatus()} to your statusline to see if pylint is running
 " * Press <F6> to start pylint on current file
 " * Press <S-F6> to open quickfix window with messages from pylint
 " * All lines with corresponding pylint existing warning will be highlighted
 "   Start pylint manually (<F6>) 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
+function! python#lint#status()
+    if exists("b:pylint_job") && job_status(b:pylint_job) == "run" | return "LN" | endif
     return ""
 endfunction
 
-function! s:qffill(ch)
+function! s:qffill(ch) abort
     let msgs = []
     while ch_status(a:ch) == 'buffered'
         let msgs = add(msgs, ch_read(a:ch))
@@ -31,7 +27,7 @@ endfunction
 
 sign define LN text=LN texthl=Error
 
-function! PylintFinish(ch)
+function! python#lint#finish(ch) abort
     let l:errorformat_bak = &errorformat
     set errorformat=%f:%l:\ [%t]%m,%f:%l:%m
     call s:qffill(a:ch)
@@ -50,8 +46,10 @@ function! PylintFinish(ch)
     endif
 endfunction
 
-function! PylintStart()
-    if exists("g:pylint_disable") || (exists("b:lint_job") && job_status(b:lint_job) == "run")
+function! python#lint#start() abort
+    if exists("g:pylint_disable") ||
+        \ (exists("b:pylint_job") &&
+        \ job_status(b:pylint_job) == "run")
         return
     endif
     let ignores = [
@@ -67,8 +65,8 @@ function! PylintStart()
         \"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 linter = get(g:, "pylint_linter", "pylint")
+    if linter == "flake8"
         let cmdline = [
             \"flake8",
             \"--ignore=E501",
@@ -76,7 +74,7 @@ function! PylintStart()
             \"--max-line-length=90",
             \expand("%p")
         \]
-    elseif g:pylint_linter == "pylint"
+    elseif linter == "pylint"
         let cmdline = [
             \"pylint",
             \"--jobs=4",
@@ -91,9 +89,6 @@ function! PylintStart()
         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 <F6> :unlet! g:pylint_disable<CR>:call PylintStart()<CR>
-map \e[32~ :redraw!<CR>:copen<CR>
-autocmd BufWritePost *.py call PylintStart()
+    let b:pylint_job = job_start(cmdline,
+        \ {"in_mode": "nl",  "err_io": "null", "close_cb": "python#lint#finish"})
+endfunction
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
diff --git a/vim/.vim/autoload/python/testname.vim b/vim/.vim/autoload/python/testname.vim
new file mode 100644 (file)
index 0000000..9cc598b
--- /dev/null
@@ -0,0 +1,22 @@
+" Nose-compatible test name preparer
+" Maintainer: Sergey Matveev <stargrave@stargrave.org>
+" License: GNU General Public License version 3 of the License or later
+"
+" When standing inside TestCase's test method, type <leader>t and full
+" Python (your.project.tests:TestCaseName.test_method_name) path will be
+" copied to clipboard ("*) register.
+
+function! python#testname#get() abort
+    normal mm
+    normal ?.*\s*def .*[Tt]est\r
+    normal ^f(Byw
+    let postfix = @"
+    normal [[f(Byw
+    let postfix = @" . "." . postfix
+    normal `m
+    let base = join([""] + split(getcwd(), "/")[:-1], "/")
+    let prefix = substitute(expand("%:p:r")[len(base)+1:], "/", ".", "g")
+    let name = prefix . ":" . postfix
+    let @* = name
+    echomsg name
+endfunction
diff --git a/vim/.vim/autoload/python/unused.vim b/vim/.vim/autoload/python/unused.vim
new file mode 100644 (file)
index 0000000..a44a021
--- /dev/null
@@ -0,0 +1,6 @@
+function! python#unused#remove() abort
+    call setqflist(filter(getqflist(), {idx, val ->
+        \ stridx(val.text, "unused-import") != -1 ||
+        \ stridx(val.text, "imported but unused") != -1}))
+    cdo d
+endfunction
diff --git a/vim/.vim/autoload/whereami.vim b/vim/.vim/autoload/whereami.vim
new file mode 100644 (file)
index 0000000..5b5b1d8
--- /dev/null
@@ -0,0 +1,14 @@
+function! whereami#pwdLoad()
+    let g:whereami_pwdL=trim(system("pwd -L"))
+    let g:whereami_pwdP=trim(system("pwd -P"))
+endfunction
+
+function! whereami#do(fmt) abort
+    let fullpath = expand("%:p")
+    if fullpath[:len(g:whereami_pwdP)-1] ==# g:whereami_pwdP
+        let fullpath = g:whereami_pwdL . fullpath[len(g:whereami_pwdP):]
+    endif
+    let where = printf(a:fmt, fullpath, line("."))
+    let @* = where
+    echomsg where
+endfunction
index d106b42111c9e096aed707d317e6404979bbb05e..d21c8da5e0eb1bb251e53692c953e6b10852b7c3 100644 (file)
@@ -1,4 +1,4 @@
-function! s:KillSignature()
+function! s:KillSignature() abort
     call cursor(1, 1)
     call search('^[>|] \?-- \?$')
     if getpos(".")[1] != 1
index 3e821d6ada561a6bc6f083f3202dfe8429b61c63..5f264f3b9fbf66404504381ae0c44028b87c0c75 100644 (file)
@@ -1,8 +1,8 @@
 setlocal commentstring=//\ %s
 
-abbreviate UCC unsigned char
-abbreviate u8 uint8_t *
-abbreviate U8 (uint8_t *)
+abbreviate <buffer> UCC unsigned char
+abbreviate <buffer> u8 uint8_t *
+abbreviate <buffer> U8 (uint8_t *)
 let @e = "ywoassert(\epA!= NULL);\e"
 
 setlocal equalprg=cfmt.sh
index faad3c9728cef8e5e50dd693988f04fcd1a1c239..f241d49d3c0832f3ec5c120c7b757338256f3120 100644 (file)
@@ -1,5 +1,5 @@
-set noexpandtab
-let g:defsplit_shift=" "
+setlocal noexpandtab
+let b:defsplit_shift=" "
 
 let @e = "^iif err = \eA; err != nil {\eo        "
 let @r = "oif err != nil {\r}\eO "
index 49d20dca637cd9bb0ddacf7ca43a8e48e74ea581..9ed68ad6c401c3a65895925924562adb448db55c 100644 (file)
@@ -30,9 +30,7 @@ if !exists("g:go_fmt_commands")
     let g:go_fmt_commands = 1
 endif
 
-if !exists("g:gofmt_command")
-    let g:gofmt_command = "goimports"
-endif
+let g:gofmt_command = get(g:, "gofmt_command", "goimports")
 
 if g:go_fmt_commands
     command! -buffer Fmt call s:GoFormat()
index 9105258bc3288fad8369abe68cc2007f1e7c8248..82496e5964163605905b61ee25090649cce3c090 100644 (file)
@@ -1,35 +1,3 @@
-" Popup documentation of specified object under the cursor
-" Requires github.com/zmb3/gogetdoc in the $PATH
-
-function! LintStatus()
-    if exists("b:gogetdoc_job") && job_status(b:gogetdoc_job) == "run" | return "GD" | endif
-    return ""
-endfunction
-
-function! GoGetDocGot(ch)
-    let msgs = []
-    while ch_status(a:ch) == "buffered"
-        let msgs = add(msgs, ch_read(a:ch))
-    endwhile
-    if exists("b:godocid") | call popup_close(b:godocid) | endif
-    if len(msgs) == 0
-        echohl WarningMsg | echomsg "No go doc" | echohl None
-        return
-    endif
-    let msgs = msgs[2:]
-    let b:godocid = popup_atcursor(msgs[2:-2], {"wrap": 0, "title": msgs[0], "move": "word"})
-endfunction
-
-function! s:GoGetDoc()
-    if exists("b:gogetdoc_job") && job_status(b:gogetdoc_job) == "run" | return | endif
-    let pos = line2byte(line(".")) + col(".") - 2
-    let cmdline = "gogetdoc -pos " . expand("%p") . ":#" . pos
-    echomsg cmdline
-    let b:gogetdoc_job = job_start(cmdline, {
-        \"in_mode": "nl",
-        \"err_io": "null",
-        \"close_cb": "GoGetDocGot",
-    \})
-endfunction
-
-nmap <buffer> <silent> <CR> :call <SID>GoGetDoc()<CR>
+if exists("*go#getdoc#do") | finish | endif
+let b:lint_status_func=function("go#getdoc#status")
+nmap <buffer> <silent> <CR> :call go#getdoc#do()<CR>
index 3e073e69d9193b71349964c555d8add4c00345c5..2470c62f7e6085aacc49decb7ef94ffa1c5e4c5c 100644 (file)
@@ -1 +1 @@
-abbreviate tto <em></em><ESC>F<i
+abbreviate <buffer> tto <em></em><ESC>F<i
index 89d3f7511ee33c7733bd79cd73e2085cbffba579..f66eb43b70bd974a82ed622bac5a7bde2ab73c74 100644 (file)
@@ -1,12 +1,12 @@
-iabbrev #u # coding: utf-8
-iabbrev tt # type: 
-iabbrev tti # type: ignore
-iabbrev trace import pdb ; pdb.set_trace()<CR>pass
-iabbrev embed import code ; code.interact(local=locals())
-iabbrev kargs *args, **kwargs
-iabbrev pyldis # pylint: disable=
-iabbrev deff def () -> None:<ESC>F(i
-iabbrev """ """<ESC>o"<ESC>2i"<ESC>kA
-nmap <leader>ss :set lazyredraw<CR>vip:sort u<CR>:'<,'>sort i<CR>:set nolazyredraw<CR>
+iabbrev <buffer> #u # coding: utf-8
+iabbrev <buffer> tt # type: 
+iabbrev <buffer> tti # type: ignore
+iabbrev <buffer> trace import pdb ; pdb.set_trace()<CR>pass
+iabbrev <buffer> embed import code ; code.interact(local=locals())
+iabbrev <buffer> kargs *args, **kwargs
+iabbrev <buffer> pyldis # pylint: disable=
+iabbrev <buffer> deff def () -> None:<ESC>F(i
+iabbrev <buffer> """ """<ESC>o"<ESC>2i"<ESC>kA
+nmap <buffer> <leader>ss :set lazyredraw<CR>vip:sort u<CR>:'<,'>sort i<CR>:set nolazyredraw<CR>
 let @b = ">gvctry:\e<<oexcept Exception as err:\rimport pdb ; pdb.set_trace()\rpass\e>>k>>kP"
 let @n = "ddV/except.*:\r<n3dd"
index cbc089fcf67c88816ed7ef0c2b55084487ee59af..fc306c61025acdbcf7ff27511bc14c824e4c70a3 100644 (file)
@@ -1 +1 @@
-set wildignore+=**/_build/*,**/.hypothesis
+setlocal wildignore+=**/_build/*,**/.hypothesis
index 353eeb79a9a3d267e54f3f2bcc869cec6e15a02e..d5678750eb6db646effc86c0fd46b036560874e0 100644 (file)
@@ -1,75 +1,2 @@
-" Python imports insert completion
-" Maintainer: Sergey Matveev <stargrave@stargrave.org>
-" License: GNU General Public License version 3 of the License or later
-"
-" This plugin is intended for quick import-line insertion.
-" For example you have got "from foo.bar import Baz" import somewhere in
-" your Git-versioned code. In another file you can write "Baz" and then
-" press <F3> in insert mode. Completion menu will show you suggestions
-" of all import lines from your code containing Baz import.
-"
-" If you have Pylint or Pyflakes output in quickfix window, containing
-" unfedined variables errors, then you can you :call AllImportCompl()
-" function. It will go through the quickfix list and find all possible
-" imports, sort them and insert under current cursor position.
-"
-" It uses external "git grep" call and assumes that "canonical" Python
-" import format is used (single import per line).
-" You can use http://www.git.stargrave.org/?p=pyimportcan.git;a=blob;f=pyimportcan.pl
-" utility to convert existing imports to that format.
-
-let s:git_grep_cmd = "git grep -H --line-number --ignore-case --no-color "
-
-if exists('g:loaded_importcompl') | finish | endif
-let g:loaded_importcompl = 1
-
-function! SortByLen(s1, s2)
-    if len(a:s1) == len(a:s2) | return a:s1 > a:s2 | endif
-    return 1 ? len(a:s1) > len(a:s2) : -1
-endfunction
-
-function! ImportCompl()
-    normal diw
-    let output = system(s:git_grep_cmd . '"^from .* import .*' . @" . '" -- "*.py" "**/*.py"')
-    let suggestions = []
-    for line in split(output, "\n")
-        if stridx(line, "unused-import") != -1 | continue | endif
-        let m = matchlist(line, '^.*:\d\+:\(.*\)$')
-        if len(m) == 0 | continue | endif
-        call insert(suggestions, m[1])
-    endfor
-    call sort(suggestions, "SortByLen")
-    call uniq(suggestions)
-    call reverse(suggestions)
-    call complete(col('.'), suggestions)
-    return ''
-endfunction
-
-inoremap <F3> <C-R>=ImportCompl()<CR>
-
-function! AllImportCompl()
-    let output = system(s:git_grep_cmd . '"^from .* import" -- "*.py" "**/*.py"')
-    let imports = {}
-    for line in split(output, "\n")
-        if stridx(line, "unused-import") != -1 | continue | endif
-        for regexp in [
-            \'^.*:\d\+:\(from .* import \(\w\+\).*\)$',
-            \'^.*:\d\+:\(from .* import \w\+ as \(\w\+\).*\)$',
-        \]
-            let m = matchlist(line, regexp)
-            if len(m) == 0 | break | endif
-            let imports[m[2]] = m[1]
-        endfor
-    endfor
-    let lines = getloclist(winnr())
-    if len(lines) == 0 | let lines = getqflist() | endif
-    let result = []
-    for line in lines
-        let m = matchlist(line.text, '\(E0602\|F821\).*' . "'" . '\(\w\+\)' . "'$")
-        if len(m) == 0 || !has_key(imports, m[2]) | continue | endif
-        call insert(result, imports[m[2]])
-    endfor
-    call sort(result, "i")
-    call uniq(result)
-    call append(".", result)
-endfunction
+if exists("*python#importcompl#do") | finish | endif
+inoremap <F3> <C-R>=python#importcompl#do()<CR>
diff --git a/vim/.vim/ftplugin/python/lint.vim b/vim/.vim/ftplugin/python/lint.vim
new file mode 100644 (file)
index 0000000..a7d696a
--- /dev/null
@@ -0,0 +1,6 @@
+if exists("*python#lint#start") | finish | endif
+let b:lint_status_func=function("python#lint#status")
+sign define LN text=LN texthl=Error
+map <F6> :unlet! g:pylint_disable<CR>:call python#lint#start()<CR>
+map \e[32~ :redraw!<CR>:copen<CR>
+autocmd BufWritePost *.py call python#lint#start()
index 7143e752f5d2c41090c9b3fce3a55f8a5d48f80f..8340721eebedd06510e43738c38fd6de04cc4ec2 100644 (file)
@@ -1,21 +1,3 @@
-" 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.
-
+if exists("*python#pep8#do") | finish | endif
 sign define P8 text=P8 texthl=Error
-function! s:pep8()
-    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
-
-map <F5> :call <SID>pep8()<CR>
+map <buffer> <F5> :call python#pep8#do()<CR>
index e388f1bbb36657425a991e6254aace7aa5ec3a0a..7ec780230136d338038ab694825af2e0aa3bc9b6 100644 (file)
@@ -1,24 +1,2 @@
-" Nose-compatible test name preparer
-" Maintainer: Sergey Matveev <stargrave@stargrave.org>
-" License: GNU General Public License version 3 of the License or later
-"
-" When standing inside TestCase's test method, type <leader>t and full
-" Python (your.project.tests:TestCaseName.test_method_name) path will be
-" copied to clipboard ("*) register.
-
-function! TestName()
-    normal mm
-    normal ?.*\s*def .*[Tt]est\r
-    normal ^f(Byw
-    let postfix = @"
-    normal [[f(Byw
-    let postfix = @" . "." . postfix
-    normal `m
-    let base = join([""] + split(getcwd(), "/")[:-1], "/")
-    let prefix = substitute(expand("%:p:r")[len(base)+1:], "/", ".", "g")
-    let name = prefix . ":" . postfix
-    let @* = name
-    echomsg name
-endfunction
-
-nmap <leader>t :call TestName()<CR>
+if exists("*python#testname#get") | finish | endif
+nmap <buffer> <leader>t :call python#testname#get()<CR>
diff --git a/vim/.vim/ftplugin/python/unused_remover.vim b/vim/.vim/ftplugin/python/unused_remover.vim
deleted file mode 100644 (file)
index 5e6b1ba..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-function! UnusedImportsRemover()
-    call setqflist(filter(getqflist(), "stridx(v:val.text, \"unused-import\") != -1 || stridx(v:val.text, \"imported but unused\") != -1"))
-    cdo d
-endfunction
index 0f57cfe94bcc258369d6776b704738bb17769202..b7664fdd4754cdf3f3c410861c3ef624ea255889 100644 (file)
@@ -1,2 +1,2 @@
-abbreviate \t @tab
+abbreviate <buffer> \t @tab
 setlocal commentstring=@c\ %s
diff --git a/vim/.vim/plugin/bracketedpaste.vim b/vim/.vim/plugin/bracketedpaste.vim
new file mode 100644 (file)
index 0000000..a80617f
--- /dev/null
@@ -0,0 +1,4 @@
+let &t_BE = "\e[?2004h"
+let &t_BD = "\e[?2004l"
+exec "set t_PS=\e[200~"
+exec "set t_PE=\e[201~"
index 4fb131802a35e025c992b2a148a7b3b66307f6c8..60c067b7a9a16b077f3fa32ba6190c27751a659b 100644 (file)
@@ -1,29 +1,3 @@
-if exists('*<SID>BufTabLine') | finish | endif
-
-function! s:BufTabline()
-    redir => bufsRaw
-    silent buffers
-    redir END
-    let bufs = []
-    for buf in split(bufsRaw, "\n")[:16]
-        let leftIdx = stridx(buf, '"')
-        let rightIdx = strridx(buf, '"')
-        let filename = substitute(buf[leftIdx + 1 : rightIdx - 1], "%", "%%", "g")
-        let linenum = split(buf[rightIdx:], " ")[-1]
-        let attrs = split(buf[:leftIdx-1], '\s\+')
-        let attrs = map(attrs, 'substitute(v:val, "%", "%%", "g")')
-        let attrs = (len(attrs) == 1) ? attrs[0] : attrs[0] . ":" . join(attrs[1:], "")
-        let attrs = "%#TabLine#" . attrs . "%*"
-        if len(filename) > 20 | let filename = "<" . filename[-(20-1):] | endif
-        let hl = (match(attrs, "%%") == -1) ? "%#TabLine#:" : "%#TabLineSel#"
-        let bufs = add(bufs, attrs . hl . filename . ":" . linenum . "%*")
-    endfor
-    return join(bufs, "  ")
-endfunction
-
-function! BufTabline()
-    return s:BufTabline()
-endfunction
-
+if exists("*buftabline#do") | finish | endif
 set showtabline=2
-set tabline=%!BufTabline()
+set tabline=%!buftabline#do()
index dac9e95f784b38d22be7611940aa48c763507d02..699fdd0c542f183e211e540d9c49f4b435c732e4 100644 (file)
@@ -1,9 +1,2 @@
-if exists('*<SID>Chng') | finish | endif
-
-function! s:Chng(...)
-    if a:0 == 0 | return | endif
-    execute "normal " . a:1 . (a:1 > 0 ? "g;" : "g,")
-endfunction
-
-command! -nargs=? Chng call s:Chng(<args>)
-nmap <End> :changes<CR>:Chng<Space>
+if exists("*chnglstnav#do") | finish | endif
+nmap <End> :changes<CR>:call chnglstnav#do()<Left>
index 268b27e4ea67e55ba7c6275a7492b3dca51d3c24..644e50a7618fd4f6691213016f8e07039bfaf9de 100644 (file)
@@ -1,41 +1,4 @@
-" Universal Ctags creator
-" Maintainer: Sergey Matveev <stargrave@stargrave.org>
-" License: GNU General Public License version 3 of the License or later
-"
-" Create "tags" file in your project's root first.
-" Then :Ctags LANG to fill it.
-
-if exists('*<SID>Ctags') | finish | endif
-
-function! s:Ctags(lang, onlyCmd, verbose)
-    let dst = tagfiles()
-    if len(dst) == 0
-        echohl WarningMsg | echomsg "No tagfiles" | echohl None
-        return
-    endif
-    let dst = sort(dst, {a, b -> len(a) > len(b) ? 1 : len(a) == len(b) ? 0 : -1})[0]
-    let src = "/" . join(split(dst, "/")[:-3], "/")
-    if dst[0] != "/"
-        let dst = getcwd() . "/.tags/tags"
-        let src = getcwd()
-    endif
-    let cmdline = [
-        \"uctags",
-        \"--languages=" . a:lang,
-        \"--python-kinds=-i",
-        \"--c++-kinds=+p",
-        \"--recurse",
-    \]
-    if a:verbose == v:true | let cmdline += ["--verbose"] | endif
-    let cmdline += ["-f", dst, src]
-    if a:onlyCmd == v:true
-        echo join(cmdline, " ")
-        return
-    endif
-    execute "!" . join(cmdline, " ")
-    if a:verbose != v:true | redraw! | endif
-endfunction
-
-command! -nargs=1 Ctags silent call s:Ctags(<f-args>, v:false, v:false)
-command! -nargs=1 Ctagsv silent call s:Ctags(<f-args>, v:true, v:false)
-command! -nargs=1 Ctagscmd call s:Ctags(<f-args>, v:true, v:true)
+if exists("*ctags#do") | finish | endif
+command! -nargs=1 Ctags silent call ctags#do(<f-args>, v:false, v:false)
+command! -nargs=1 Ctagsv silent call ctags#do(<f-args>, v:true, v:false)
+command! -nargs=1 Ctagscmd call ctags#do(<f-args>, v:true, v:true)
index 7beb26bc11949cddc49ebac403d6cbde96d988b7..876599dcf1b91c73473ba3ec79ba43fe5a74e891 100644 (file)
@@ -1,102 +1,6 @@
-" Python function call splitter
-" Maintainer: Sergey Matveev <stargrave@stargrave.org>
-" License: GNU General Public License version 3 of the License or later
-"
-" This plugin splits Python function call on several lines.
-"
-"   def foobar(self, foo: str, bar: Some[thing, too]) -> None:
-" to
-"   def foobar(
-"           self,
-"           foo: str,
-"           bar: Some[thing, too],
-"   ) -> None:
-"
-"   foo(bar, baz)[0]
-" to
-"   foo(
-"       bar,
-"       baz,
-"   )[0]
-"
-" You can un-split it using :Undefsplit command on the line where
-" splitting starts.
-"
-" :Defsplit has optional argument specifying how many opening round
-" parenthesis must be skipped.
-" :Defsplit 1 on foo(baz(baz(...))) produces
-"    foo(baz(
-"        baz(...),
-"    ))
-"
-" Also there is :Brsplit command behaving similarly, but it splits other
-" types of brackets: "{}", "[]".
-
-if !exists("g:defsplit_shift") | let g:defsplit_shift = "    " | endif
-if exists('*<SID>Defsplit') | finish | endif
-
-function! s:bracket_find(brs_allowable, line, offset)
-    let possible = []
-    for bracket in a:brs_allowable
-        let found = stridx(a:line, bracket, a:offset)
-        if found != -1 | let possible += [found] | endif
-    endfor
-    return min(possible)
-endfunction
-
-function! s:Defsplit(brs_allowable, single_line_comma, ...)
-    if a:0 == 0 | let skip = 0 | else | let skip = str2nr(a:1) | endif
-    let shift = g:defsplit_shift
-    let line = getline(".")
-    for i in range(len(line))
-        if line[i] != g:defsplit_shift[0]
-            let prfx = strpart(line, 0, i)
-            if line[i : i+3] ==# "def " ||
-                \line[i : i+5] ==# "class " ||
-                \line[i : i+9] ==# "async def "
-                let shift .= shift
-            endif
-            break
-        endif
-    endfor
-    let brs = {"(": ")", "[": "]", "{": "}"}
-    let brfirst = s:bracket_find(a:brs_allowable, line, 0)
-    let brlast = strridx(line, brs[line[brfirst]])
-    while skip > 0
-        let brfirst = s:bracket_find(a:brs_allowable, line, brfirst + 1)
-        let brlast = strridx(line, brs[line[brfirst]], brlast - 1)
-        let skip -= 1
-    endwhile
-    let [curly, round, squar, outbuf] = [0, 0, 0, ""]
-    let ready = [strpart(line, 0, brfirst + 1)]
-    let trailing_comma = 1
-    for c in split(line[brfirst + 1 : brlast-1], '\zs')
-        if c ==# "*" | let trailing_comma = 0 | endif
-        if outbuf ==# "" && c ==# " " | continue | endif
-        let outbuf .= c
-        if c ==# "," && !curly && !round && !squar
-            let ready = add(ready, prfx . shift . outbuf)
-            let outbuf = ""
-        elseif c ==# "[" | let squar += 1
-        elseif c ==# "]" | let squar -= 1
-        elseif c ==# "(" | let round += 1
-        elseif c ==# ")" | let round -= 1
-        elseif c ==# "{" | let curly += 1
-        elseif c ==# "}" | let curly -= 1
-        endif
-    endfor
-    if trailing_comma && !(a:single_line_comma == v:true && len(ready) == 1)
-        let outbuf = outbuf . ","
-    endif
-    let ready = add(ready, prfx . shift . outbuf)
-    let ready = add(ready, prfx . strpart(line, brlast))
-    call append(line("."), ready)
-    normal "_dd
-endfunction
-
-command! -nargs=? Defsplit call s:Defsplit(["("], v:false, <f-args>)
-command! -nargs=? Brsplit call s:Defsplit(["(", "[", "{"], v:false, <f-args>)
-command! -nargs=? Defsplits call s:Defsplit(["("], v:true, <f-args>)
-command! -nargs=? Brsplits call s:Defsplit(["(", "[", "{"], v:true, <f-args>)
-
+if exists("*defsplit#do") | finish | endif
+command! -nargs=? Defsplit call defsplit#do(["("], v:false, <f-args>)
+command! -nargs=? Brsplit call defsplit#do(["(", "[", "{"], v:false, <f-args>)
+command! -nargs=? Defsplits call defsplit#do(["("], v:true, <f-args>)
+command! -nargs=? Brsplits call defsplit#do(["(", "[", "{"], v:true, <f-args>)
 command! Undefsplit normal ^v%$J:keepp s/^\(.*\)\([([{]\) \(.*[^,]\),\?\([)\]}]\)\(.*\)$/\1\2\3\4\5<CR>:keepp s/, \?\([)\]}]\+\)$/\1/e<CR>:<CR>
index 3833a656784578012ee84943eb82966a0fed577e..e24524ecdf47bad86abe695489c799db98610521 100644 (file)
@@ -1,4 +1,4 @@
-if exists('*<SID>exted') | finish | endif
+if exists("*<SID>exted") | finish | endif
 
 function! s:exted(ext)
     execute "edit %<." . a:ext
diff --git a/vim/.vim/plugin/fileline.vim b/vim/.vim/plugin/fileline.vim
new file mode 100644 (file)
index 0000000..62bf31a
--- /dev/null
@@ -0,0 +1,3 @@
+if exists("*fileline#goto") | finish | endif
+autocmd! BufNewFile *:* nested call fileline#goto()
+autocmd! BufRead *:* nested call fileline#goto()
index 8a9bd8a5b70db4d8247446d045cf6b150be78747..4c71b70ec798fe3d103bcd551ac349007476b39b 100644 (file)
@@ -1,4 +1,4 @@
-if exists('*<SID>Vmg') | finish | endif
+if exists("*<SID>Vmg") | finish | endif
 
 function! s:Vmg(pattern)
     silent execute 'Ggrep "' . a:pattern . '"'
index f7a5f126d6e75f8eeadd34aabe30a9f2040af1ce..03903d740903ffb8f6b5f710c7d0c90e4884383d 100644 (file)
@@ -1,4 +1,4 @@
-if exists('*<SID>Vim') | finish | endif
+if exists("*<SID>Vim") | finish | endif
 
 function! s:Vim(pattern)
     set grepprg=grep\ -Rns\ --binary-files=without-match\ --exclude-dir=.git\ --exclude-dir=.tags\ $*\ /dev/null\ .
index d8c9167fe9e3a9c52b6686f07995466638b055d2..bcef27286c0acccd5837ce86168f19002fa99063 100644 (file)
@@ -1,4 +1,4 @@
-if exists('*<SID>on_lsp_buffer_enabled') | finish | endif
+if exists("*<SID>on_lsp_buffer_enabled") | finish | endif
 
 let g:lsp_auto_enable = 1
 
diff --git a/vim/.vim/plugin/pastemode.vim b/vim/.vim/plugin/pastemode.vim
deleted file mode 100644 (file)
index 78f42a0..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-if exists("g:loaded_mein_pastemode") | finish | endif
-let g:loaded_mein_pastemode = 1
-
-if &term =~ "screen.*"
-    let &t_ti = &t_ti . "\e[?2004h"
-    let &t_te = "\e[?2004l" . &t_te
-    function! XTermPasteBegin(ret)
-        set pastetoggle=<Esc>[201~
-        set paste
-        return a:ret
-    endfunction
-    map <expr> <Esc>[200~ XTermPasteBegin("i")
-    imap <expr> <Esc>[200~ XTermPasteBegin("")
-    cmap <Esc>[200~ <nop>
-    cmap <Esc>[201~ <nop>
-endif
index a6d53365224d2298347280a6c2f39790b9c4927e..33981349176e2fd2643be57d23443db67b86bc86 100644 (file)
@@ -1,27 +1,4 @@
-if exists('*<SID>pwdLoad') | finish | endif
-
-function! s:pwdLoad()
-    let g:mein_pwdL=trim(system("pwd -L"))
-    let g:mein_pwdP=trim(system("pwd -P"))
-endfunction
-
-autocmd VimEnter * call s:pwdLoad()
-
-function! s:WhereAmI(fmt)
-    let fullpath = expand("%:p")
-    if fullpath[:len(g:mein_pwdP)-1] ==# g:mein_pwdP
-        let fullpath = g:mein_pwdL . fullpath[len(g:mein_pwdP):]
-    endif
-    if a:fmt == "gnu"
-        let where = fullpath . ":" . line(".")
-    elseif a:fmt == "lldb"
-        let where = "breakpoint set --file " . fullpath . " --line " . line(".")
-    else
-        let where = "unknown fmt"
-    endif
-    let @* = where
-    echomsg where
-endfunction
-
-nmap <leader>w :call <SID>WhereAmI("gnu")<CR>
-nmap <leader>W :call <SID>WhereAmI("lldb")<CR>
+if exists("*whereami#pwdLoad") | finish | endif
+autocmd VimEnter * call whereami#pwdLoad()
+nmap <leader>w :call whereami#do("%s:%d")<CR>
+nmap <leader>W :call whereami#do("breakpoint set --file %s --line %d")<CR>
index cd9cc07d1479e154bc6f7b0274f2ccd1b96e75f0..af3540bb7b6377acdb1d92fc978f2ae00bd68e72 100644 (file)
@@ -2,7 +2,7 @@
 " Maintainer: Sergey Matveev <stargrave@stargrave.org>
 " License: GNU General Public License version 3 of the License or later
 
-if exists('*<SID>zshfe') | finish | endif
+if exists("*<SID>zshfe") | finish | endif
 if !exists("g:zshfe_path") | let g:zshfe_path=expand("~/.vim/plugin/zshfe.zsh") | endif
 
 function! s:zshfe(query, opencmd)
index 66b729b0ea068716dee5bbe414de7820fb346580..56b9a2113f383eec49547e8e6290f1919f452d43 100644 (file)
@@ -73,6 +73,7 @@ highlight CursorColumn ctermfg=cyan ctermbg=red
 " }}}
 
 " Statusline {{{
+let LintStatus = {-> exists("b:lint_status_func") ? b:lint_status_func() : ""}
 set laststatus=2
 set statusline=%F\ %m%r%h%w%k
 set statusline+=%{len(getqflist())?'[Q]':''}
@@ -85,10 +86,6 @@ set statusline+=%#Todo#%c%V:0x%B
 set statusline+=%#Comment#%o
 set statusline+=%#Error#%{LintStatus()}
 set statusline+=%*\ %P
-
-function! LintStatus() " it is overrided in ftplugins
-    return ""
-endfunction
 " }}}
 
 " View saving {{{