]> Sergey Matveev's repositories - dotfiles.git/commitdiff
Move to vim9script
authorSergey Matveev <stargrave@stargrave.org>
Thu, 30 Jun 2022 16:02:28 +0000 (19:02 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 30 Jun 2022 19:24:15 +0000 (22:24 +0300)
47 files changed:
vim/.vim/after/ftplugin/c/autos.vim [new file with mode: 0644]
vim/.vim/autoload/go/jump.vim [new file with mode: 0644]
vim/.vim/autoload/mutt.vim [new file with mode: 0644]
vim/.vim/ftdetect/hjson.vim
vim/.vim/ftdetect/mutt.vim
vim/.vim/ftdetect/tex.vim [deleted file]
vim/.vim/ftplugin/c/autos.vim
vim/.vim/ftplugin/go/motion.vim
vim/.vim/ftplugin/hjson/autos.vim [new file with mode: 0644]
vim/.vim/ftplugin/mutt/autos.vim [new file with mode: 0644]
vim/.vim/ftplugin/plaintex/autos.vim [new file with mode: 0644]
vim/.vim/ftplugin/python/autos.vim
vim/.vim/ftplugin/python/pdb.vim [new file with mode: 0644]
vim/.vim/ftplugin/vim/autos.vim [new file with mode: 0644]
vim/.vim/pack/stargrave/start/align/autoload/align.vim
vim/.vim/pack/stargrave/start/align/plugin/align.vim
vim/.vim/pack/stargrave/start/buftabline/autoload/buftabline.vim
vim/.vim/pack/stargrave/start/buftabline/plugin/buftabline.vim
vim/.vim/pack/stargrave/start/chnglstnav/autoload/chnglstnav.vim
vim/.vim/pack/stargrave/start/chnglstnav/plugin/chnglstnav.vim
vim/.vim/pack/stargrave/start/ctags/autoload/ctags.vim
vim/.vim/pack/stargrave/start/ctags/plugin/ctags.vim
vim/.vim/pack/stargrave/start/defsplit/autoload/defsplit.vim
vim/.vim/pack/stargrave/start/defsplit/plugin/defsplit.vim
vim/.vim/pack/stargrave/start/fileline/autoload/fileline.vim
vim/.vim/pack/stargrave/start/fileline/plugin/fileline.vim
vim/.vim/pack/stargrave/start/go-gogetdoc/autoload/go/getdoc.vim
vim/.vim/pack/stargrave/start/go-gogetdoc/ftplugin/go/gogetdoc.vim
vim/.vim/pack/stargrave/start/nonhumanhl/autoload/nonhumanhl.vim
vim/.vim/pack/stargrave/start/nonhumanhl/plugin/nonhumanhl.vim
vim/.vim/pack/stargrave/start/py-importcompl/autoload/python/importcompl.vim
vim/.vim/pack/stargrave/start/py-importcompl/autoload/python/unused.vim
vim/.vim/pack/stargrave/start/py-importcompl/ftplugin/python/importcompl.vim
vim/.vim/pack/stargrave/start/py-pep8/autoload/python/pep8.vim
vim/.vim/pack/stargrave/start/py-pep8/ftplugin/python/pep8.vim
vim/.vim/pack/stargrave/start/py-testname/autoload/python/testname.vim
vim/.vim/pack/stargrave/start/py-testname/ftplugin/python/testname.vim
vim/.vim/pack/stargrave/start/whereami/autoload/whereami.vim
vim/.vim/pack/stargrave/start/whereami/plugin/whereami.vim
vim/.vim/pack/stargrave/start/zshfe/autoload/zshfe.vim [new file with mode: 0644]
vim/.vim/pack/stargrave/start/zshfe/plugin/zshfe.vim
vim/.vim/plugin/disables.vim
vim/.vim/plugin/exted.vim
vim/.vim/plugin/ggrep.vim
vim/.vim/plugin/grep.vim
vim/.vim/plugin/lsp.vim
vim/.vim/plugin/netrw.vim

diff --git a/vim/.vim/after/ftplugin/c/autos.vim b/vim/.vim/after/ftplugin/c/autos.vim
new file mode 100644 (file)
index 0000000..96369aa
--- /dev/null
@@ -0,0 +1 @@
+set commentstring=//\ %s
diff --git a/vim/.vim/autoload/go/jump.vim b/vim/.vim/autoload/go/jump.vim
new file mode 100644 (file)
index 0000000..90c00d8
--- /dev/null
@@ -0,0 +1,9 @@
+vim9script
+
+export def Do(motion: string)
+    var saved = @/
+    mark '
+    execute motion
+    call histdel("/", -1)
+    @/ = saved
+enddef
diff --git a/vim/.vim/autoload/mutt.vim b/vim/.vim/autoload/mutt.vim
new file mode 100644 (file)
index 0000000..367c6d7
--- /dev/null
@@ -0,0 +1,9 @@
+vim9script
+
+export def KillSignature()
+    cursor(1, 1)
+    search('^[>|] \?-- \?$')
+    if getpos(".")[1] != 1
+        normal d}
+    endif
+enddef
index 8181fc286a111b13630de0ff64aa02bafd05b54c..65ed94625851d12b74b0603394a5539f6bea3335 100644 (file)
@@ -1,2 +1 @@
-autocmd BufNewFile,BufRead *.hjson setlocal shiftwidth=2
-autocmd BufNewFile,BufRead *.hjson setlocal commentstring=#\ %s
+autocmd BufNewFile,BufRead *.hjson set filetype=hjson
index e7061746023a5970074fa63c07f2fed5fb8e38b1..4e4dc757de054dce5947b38ab6906f1f46e37a01 100644 (file)
@@ -1,12 +1 @@
-function! s:KillSignature() abort
-    call cursor(1, 1)
-    call search('^[>|] \?-- \?$')
-    if getpos(".")[1] != 1
-        normal d}
-    endif
-endfunction
-
-autocmd BufRead /tmp/mutt-* call s:KillSignature()
-autocmd BufRead /tmp/mutt-* setlocal textwidth=72
-autocmd BufRead /tmp/mutt-* setlocal commentstring=>%s
-autocmd BufRead /tmp/mutt-* silent %substitute /^> */>/e | set nohlsearch
+autocmd BufRead,BufNewFile /tmp/mutt-* set filetype=mutt
diff --git a/vim/.vim/ftdetect/tex.vim b/vim/.vim/ftdetect/tex.vim
deleted file mode 100644 (file)
index 19517da..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-autocmd BufNewFile,BufRead *.tex abbreviate framedo \begin{frame}<CR>\frametitle{TODO}<CR>\end{frame}<ESC>k>>wwlcw
-autocmd BufNewFile,BufRead *.tex abbreviate itemdo \begin{itemize}<CR>\item <CR>\end{itemize}<ESC>k>>$a
-autocmd BufNewFile,BufRead *.tex abbreviate cnter \begin{center}<CR>\end{center}<ESC>k$o
index 5b935260e2636887b9b2987ecd0d643dc357ce3a..6a804dbb74b43726e404126ec7a28c1904666d41 100644 (file)
@@ -1,4 +1,3 @@
-set commentstring=//\ %s
 let @e = "ywoassert(\epA!= NULL);\e"
 nmap [cl O// clang-format off<ESC>
 nmap ]cl o// clang-format on<ESC>
index 041347c73d8fbe3a9a9546d360934e5f062c71bc..410ce9a4b1b31bb1e35dd752dfa48d7881ae6251 100644 (file)
@@ -1,18 +1,6 @@
-nnoremap <silent> <buffer> ]] :call <SID>Go_jump('/^\(func\\|type\)')<cr>
-nnoremap <silent> <buffer> [[ :call <SID>Go_jump('?^\(func\\|type\)')<cr>
-nnoremap <silent> <buffer> ]m :call <SID>Go_jump('/^\s*\(func\\|type\)')<cr>
-nnoremap <silent> <buffer> [m :call <SID>Go_jump('?^\s*\(func\\|type\)')<cr>
-
-if exists('*<SID>Go_jump') | finish | endif
-
-fun! <SID>Go_jump(motion) range
-    let cnt = v:count1
-    let save = @/    " save last search pattern
-    mark '
-    while cnt > 0
-        silent! exe a:motion
-        let cnt = cnt - 1
-    endwhile
-    call histdel('/', -1)
-    let @/ = save    " restore last search pattern
-endfun
+vim9script
+if exists("*go#jump#Do") | finish | endif
+nnoremap <silent> <buffer> ]] :call go#jump#Do(':/^\(func\\|type\)')<CR>
+nnoremap <silent> <buffer> [[ :call go#jump#Do(':?^\(func\\|type\)')<CR>
+nnoremap <silent> <buffer> ]m :call go#jump#Do(':/^\s*\(func\\|type\)')<CR>
+nnoremap <silent> <buffer> [m :call go#jump#Do(':?^\s*\(func\\|type\)')<CR>
diff --git a/vim/.vim/ftplugin/hjson/autos.vim b/vim/.vim/ftplugin/hjson/autos.vim
new file mode 100644 (file)
index 0000000..069cc1c
--- /dev/null
@@ -0,0 +1,2 @@
+set shiftwidth=2
+set commentstring=#\ %s
diff --git a/vim/.vim/ftplugin/mutt/autos.vim b/vim/.vim/ftplugin/mutt/autos.vim
new file mode 100644 (file)
index 0000000..7708164
--- /dev/null
@@ -0,0 +1,6 @@
+vim9script
+mutt#KillSignature()
+set textwidth=72
+set commentstring=>%s
+set syntax=mail
+silent :%substitute /^> */>/e | set nohlsearch
diff --git a/vim/.vim/ftplugin/plaintex/autos.vim b/vim/.vim/ftplugin/plaintex/autos.vim
new file mode 100644 (file)
index 0000000..42d80e6
--- /dev/null
@@ -0,0 +1,3 @@
+abbreviate framedo \begin{frame}<CR>\frametitle{TODO}<CR>\end{frame}<ESC>k>>wwlcw
+abbreviate itemdo \begin{itemize}<CR>\item <CR>\end{itemize}<ESC>k>>$a
+abbreviate cnter \begin{center}<CR>\end{center}<ESC>k$o
index e956d2b665fe8255372ea9c647a6e63244704516..916b503fa6704788499e39f0a9e02a98645dfe37 100644 (file)
@@ -7,6 +7,4 @@ iabbrev <buffer> kargs *args, **kwargs
 iabbrev <buffer> pyldis # pylint: disable=
 iabbrev <buffer> deff def () -> None:<ESC>F(i
 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:\rbreakpoint()\rpass\e>>k>>kP"
-let @n = "ddV/except.*:\r<n3dd"
 syntax keyword pythonStatement match case
diff --git a/vim/.vim/ftplugin/python/pdb.vim b/vim/.vim/ftplugin/python/pdb.vim
new file mode 100644 (file)
index 0000000..b830cc2
--- /dev/null
@@ -0,0 +1,3 @@
+vim9script
+@b = ">gvctry:\e<<oexcept Exception as err:\rbreakpoint()\rpass\e>>k>>kP"
+@n = "ddV/except.*:\r<n3dd"
diff --git a/vim/.vim/ftplugin/vim/autos.vim b/vim/.vim/ftplugin/vim/autos.vim
new file mode 100644 (file)
index 0000000..21a0960
--- /dev/null
@@ -0,0 +1,2 @@
+set commentstring=#%s
+abbreviate <buffer> v9 vim9script
index f08ae8164924ed792a09fa0c3af56f660ceff35b..d31e1a11209d280cf61c919277960742129991aa 100644 (file)
@@ -1,13 +1,14 @@
-" something that won't be met anywhere
-let s:sep = "₀◎○ë"
+vim9script
 
-function! align#do(first, last, sep) abort
-    let in = []
-    for n in range(a:first, a:last)
-        let in = add(in, substitute(getline(n), a:sep, "\t" . s:sep, "g"))
+const Sep = "₀◎○ë" # something that won't be met anywhere
+
+export def Do(first: number, last: number, sep: string)
+    var in: list<string>
+    for n in range(first, last)
+        in = add(in, substitute(getline(n), sep, "\t" .. Sep, "g"))
     endfor
-    let out = systemlist("column -t -s \"\t\"", add(in, ""))
-    for n in range(a:first, a:last)
-        call setline(n, substitute(out[n - a:first], "  " . s:sep, escape(a:sep, "&"), "g"))
+    var out = systemlist("column -t -s \"\t\"", add(in, ""))
+    for n in range(first, last)
+        setline(n, substitute(out[n - first], "  " .. Sep, escape(sep, "&"), "g"))
     endfor
-endfunction
+enddef
index 5d95b1136a954012f077caa7de14d9aa39457732..82d5370290ef3b4603c6642fe300c000da894011 100644 (file)
@@ -1,2 +1,2 @@
-if exists("*align#do") | finish | endif
-command! -nargs=1 -range Align call align#do(<line1>, <line2>, <f-args>)
+if exists("*align#Do") | finish | endif
+command! -nargs=1 -range Align call align#Do(<line1>, <line2>, <f-args>)
index 7098d7b3404f2a1cf48587d8baea93e07cf62ef0..d4c6efc6a7540668337ad4d3ca78f548a246611d 100644 (file)
@@ -1,18 +1,27 @@
-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 . "%*")
+vim9script
+
+export def Do(): string
+    var bufsRaw = execute("buffers", "silent")
+    var bufs: list<string>
+    var leftIdx: number
+    var rightIdx: number
+    var filename: string
+    var linenum: string
+    var attrs: list<string>
+    var attr: string
+    var hl: string
+    for buf in split(bufsRaw, "\n")[ : 16]
+        leftIdx = stridx(buf, '"')
+        rightIdx = strridx(buf, '"')
+        filename = substitute(buf[leftIdx + 1 : rightIdx - 1], "%", "%%", "g")
+        linenum = split(buf[rightIdx : ], " ")[-1]
+        attrs = split(buf[ : leftIdx - 1], '\s\+')
+        attrs = map(attrs, 'substitute(v:val, "%", "%%", "g")')
+        attr = (len(attrs) == 1) ? attrs[0] : attrs[0] .. ":" .. join(attrs[1 :], "")
+        attr = "%#TabLine#" .. attr .. "%*"
+        if len(filename) > 20 | filename = "<" .. filename[-(20 - 1) :] | endif
+        hl = (match(attr, "%%") == -1) ? "%#TabLine#:" : "%#TabLineSel#"
+        bufs = add(bufs, attr .. hl .. filename .. ":" .. linenum .. "%*")
     endfor
     return join(bufs, "  ")
-endfunction
+enddef
index 60c067b7a9a16b077f3fa32ba6190c27751a659b..99c444e64c29bcbe3e6b009bda1c9577fa04fa4b 100644 (file)
@@ -1,3 +1,3 @@
-if exists("*buftabline#do") | finish | endif
+if exists("*buftabline#Do") | finish | endif
 set showtabline=2
-set tabline=%!buftabline#do()
+set tabline=%!buftabline#Do()
index 9bdf8402dc1217aca542086d33e1b527227adc40..cfd5ab6c31fdda331b1cd087078d29547d29d177 100644 (file)
@@ -1,4 +1,6 @@
-function! chnglstnav#do(...)
-    if a:0 == 0 | return | endif
-    execute "normal " . a:1 . (a:1 > 0 ? "g;" : "g,")
-endfunction
+vim9script
+
+export def Do(...args: list<number>)
+    if len(args) == 0 | return | endif
+    execute "normal " .. args[0] .. (args[0] > 0 ? "g;" : "g,")
+enddef
index 699fdd0c542f183e211e540d9c49f4b435c732e4..01ef650a2e812271be2b66b0450d48d141d4873b 100644 (file)
@@ -1,2 +1,2 @@
-if exists("*chnglstnav#do") | finish | endif
-nmap <End> :changes<CR>:call chnglstnav#do()<Left>
+if exists("*chnglstnav#Do") | finish | endif
+nmap <End> :changes<CR>:call chnglstnav#Do()<Left>
index dc6f90ea6fc2f27844d07b6a9f1784e679b4d811..0119014c42c90c327305b9120aa729f0e466a463 100644 (file)
@@ -1,35 +1,37 @@
-" 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.
+vim9script
 
-function! ctags#do(lang, onlyCmd, verbose) abort
-    let dst = tagfiles()
-    if len(dst) == 0
+# 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.
+
+export def Do(lang: string, onlyCmd: bool, verbose: bool)
+    var dsts = tagfiles()
+    if len(dsts) == 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], "/")
+    var dst = sort(dsts, (a, b) => len(a) > len(b) ? 1 : len(a) == len(b) ? 0 : -1)[0]
+    var src = "/" .. join(split(dst, "/")[: -3], "/")
     if dst[0] != "/"
-        let dst = getcwd() . "/.tags/tags"
-        let src = getcwd()
+        dst = getcwd() .. "/.tags/tags"
+        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
+    var cmdline = [
+        "uctags",
+        "--languages=" .. lang,
+        "--python-kinds=-i",
+        "--c++-kinds=+p",
+        "--recurse",
+    ]
+    if verbose == v:true | cmdline += ["--verbose"] | endif
+    cmdline += ["-f", dst, src]
+    if onlyCmd == v:true
         echo join(cmdline, " ")
         return
     endif
-    execute "!" . join(cmdline, " ")
-    if a:verbose != v:true | redraw! | endif
-endfunction
+    execute "!" .. join(cmdline, " ")
+    if verbose != v:true | redraw! | endif
+enddef
index 644e50a7618fd4f6691213016f8e07039bfaf9de..0f63d9e54cfe6cf2528b27c90dab13a07663f961 100644 (file)
@@ -1,4 +1,4 @@
-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)
+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 a1590073ad2ced133ec4607db678311a1f75cbab..74337e8f2c0e3f54371ef7d0b0914e11ee4f6f9d 100644 (file)
@@ -1,92 +1,97 @@
-" 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: "{}", "[]".
+vim9script
 
-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
+# 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: "{}", "[]".
+
+def BracketFind(brsAllowable: list<string>, line: string, offset: number): number
+    var possible: list<number>
+    var found: number
+    for bracket in brsAllowable
+        found = stridx(line, bracket, offset)
+        if found != -1 | possible += [found] | endif
     endfor
     return min(possible)
-endfunction
+enddef
+
+const Brs = {"(": ")", "[": "]", "{": "}"}
 
-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(".")
+export def Do(brsAllowable: list<string>, singleLineComma: bool, ...args: list<number>)
+    var skip = len(args) == 0 ? 0 : args[1]
+    var shift = get(b:, "defsplit_shift", "    ")
+    var line = getline(".")
+    var prfx: string
     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
+            prfx = strpart(line, 0, i)
+            if line[i : i + 3] ==# "def " ||
+                line[i : i + 5] ==# "class " ||
+                line[i : i + 9] ==# "async def "
+                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]])
+    var brfirst = BracketFind(brsAllowable, line, 0)
+    var 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
+        brfirst = BracketFind(brsAllowable, line, brfirst + 1)
+        brlast = strridx(line, Brs[line[brfirst]], brlast - 1)
+        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
+    var [curly, round, squar, outbuf] = [0, 0, 0, ""]
+    var ready = [strpart(line, 0, brfirst + 1)]
+    var trailingComma = v:true
+    for c in split(line[brfirst + 1 : brlast - 1], '\zs')
+        if c ==# "*" | trailingComma = v:false | endif
         if outbuf ==# "" && c ==# " " | continue | endif
-        let outbuf .= c
+        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
+            ready = add(ready, prfx .. shift .. outbuf)
+            outbuf = ""
+        elseif c ==# "[" | squar += 1
+        elseif c ==# "]" | squar -= 1
+        elseif c ==# "(" | round += 1
+        elseif c ==# ")" | round -= 1
+        elseif c ==# "{" | curly += 1
+        elseif c ==# "}" | curly -= 1
         endif
     endfor
-    if trailing_comma && !(a:single_line_comma == v:true && len(ready) == 1)
-        let outbuf = outbuf . ","
+    if trailingComma && !(singleLineComma == v:true && len(ready) == 1)
+        outbuf = outbuf .. ","
     endif
-    let ready = add(ready, prfx . shift . outbuf)
-    let ready = add(ready, prfx . strpart(line, brlast))
-    call append(line("."), ready)
+    ready = add(ready, prfx .. shift .. outbuf)
+    ready = add(ready, prfx .. strpart(line, brlast))
+    append(line("."), ready)
     normal "_dd
-endfunction
+enddef
index 876599dcf1b91c73473ba3ec79ba43fe5a74e891..f01362bc3f1e82c1aeaedd1b996a5fa64aec6849 100644 (file)
@@ -1,6 +1,6 @@
-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>)
+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 193328c316597afda3dd833b4681eb0817929a66..d5b1d9ab3e4812ccd0d374899b6d0738dc1592a0 100644 (file)
@@ -1,17 +1,19 @@
-" Simplified version of http://www.vim.org/scripts/script.php?script_id=2184
-" that does not replace current window
+vim9script
 
-function! fileline#goto() abort
-    let file = bufname("%")
+# Simplified version of http://www.vim.org/scripts/script.php?script_id=2184
+# that does not replace current window
+
+export def Goto()
+    var file = bufname("%")
     if filereadable(file) | return | endif
-    let names = matchlist(file, '\(.\{-1,}\):\%(\(\d\+\)\%(:\(\d*\):\?\)\?\)\?$')
+    var names = matchlist(file, '\(.\{-1,}\):\%(\(\d\+\)\%(:\(\d*\):\?\)\?\)\?$')
     if empty(names) | return | endif
-    let file_name = names[1]
-    let line_num = names[2] == "" ? "0" : names[2]
-    let col_num = names[3] == "" ? "0" : names[3]
-    if !filereadable(file_name) | return | endif
-    let nr = bufnr("%")
-    exec "keepalt edit +" . line_num . " " . file_name
-    exec "normal! " . col_num . "|"
-    exec "bdelete " . nr
-endfunction
+    var fileName = names[1]
+    var lineNum = names[2] == "" ? "0" : names[2]
+    var colNum = names[3] == "" ? "0" : names[3]
+    if !filereadable(fileName) | return | endif
+    var nr = bufnr("%")
+    execute "keepalt edit +" .. lineNum .. " " .. fileName
+    execute "normal! " .. colNum .. "|"
+    execute "bdelete " .. nr
+enddef
index 62bf31a1ef5e23aec2516d55c230a37c4b5552fd..6dc2c0736b73861ef33b638dc4fff22a0a0ef86b 100644 (file)
@@ -1,3 +1,3 @@
-if exists("*fileline#goto") | finish | endif
-autocmd! BufNewFile *:* nested call fileline#goto()
-autocmd! BufRead *:* nested call fileline#goto()
+if exists("*fileline#Goto") | finish | endif
+autocmd! BufNewFile *:* nested call fileline#Goto()
+autocmd! BufRead *:* nested call fileline#Goto()
index 922c9cdb8d5305f904b9d80b92861aa8454e38e5..6c5555e853b6bc4afb2043875993d02324904243 100644 (file)
@@ -1,34 +1,36 @@
-" Popup documentation of specified object under the cursor
-" Requires github.com/zmb3/gogetdoc in the $PATH
+vim9script
 
-function! go#getdoc#status()
+# Popup documentation of specified object under the cursor
+# Requires github.com/zmb3/gogetdoc in the $PATH
+
+export def Status(): string
     if exists("b:gogetdoc_job") && job_status(b:gogetdoc_job) == "run" | return "GD" | endif
     return ""
-endfunction
+enddef
 
-function! go#getdoc#got(ch) abort
-    let msgs = []
-    while ch_status(a:ch) == "buffered"
-        let msgs = add(msgs, ch_read(a:ch))
+export def Got(ch: channel)
+    var msgs: list<string>
+    while ch_status(ch) == "buffered"
+        msgs = add(msgs, ch_read(ch))
     endwhile
-    if exists("b:godocid") | call popup_close(b:godocid) | endif
+    if exists("b:godocid") | 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
+    msgs = msgs[2 :]
+    b:godocid = popup_atcursor(msgs[2 : -2],
+        {"wrap": 0, "title": msgs[0], "move": "word"})
+enddef
 
-function! go#getdoc#do() abort
+export def Do()
     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
+    var pos = line2byte(line(".")) + col(".") - 2
+    var 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
+    b:gogetdoc_job = job_start(cmdline, {
+        "in_mode": "nl",
+        "err_io": "null",
+        "close_cb": "go#getdoc#Got",
+    })
+enddef
index eedec71b6f1e0e1d07658efaeca56dbbb85eb581..a93c58fc3f31175ec4ab16bc58fa96a5a57ddb0a 100644 (file)
@@ -1,3 +1,3 @@
-if exists("*go#getdoc#do") | finish | endif
-let b:mein_status_func=function("go#getdoc#status")
-nmap <buffer> <silent> <CR> :call go#getdoc#do()<CR>
+if exists("*go#getdoc#Do") | finish | endif
+let b:mein_status_func=function("go#getdoc#Status")
+nmap <buffer> <silent> <CR> :call go#getdoc#Do()<CR>
index c2ac7fc8ae2e4096a289d4d617038d88c3e09ad8..038b8c4592ca91df0e722dcb5cccad546a3c4029 100644 (file)
@@ -1,5 +1,5 @@
-function! nonhumanhl#load()
+vim9script
+export def Load()
     highlight nonhuman ctermbg=blue ctermfg=red
-    autocmd BufReadPost * syntax match nonhuman
-        \ "[^\u0000-\u007Fа-яА-ЯёЁäÄöÖüÜßẞ]" containedin=ALL
-endfunction
+    autocmd BufReadPost * syntax match nonhuman "[^\u0000-\u007Fа-яА-ЯёЁäÄöÖüÜßẞ]" containedin=ALL
+enddef
index 7d4e88bb4b19b9fdcb49b86712c208a066cc46c0..38a0ff4d19d5ca53e029490a8655615297793e23 100644 (file)
@@ -1,2 +1,3 @@
-if exists("*nonhumanhl#load") | finish | endif
-call nonhumanhl#load()
+vim9script
+if exists("*nonhumanhl#Load") | finish | endif
+nonhumanhl#Load()
index e516ad662bc5ce2794fa247d82e8b8b6407e382d..48c166a4499eaf2c3a5c7ca432bf4fe76ca595ce 100644 (file)
@@ -1,72 +1,75 @@
-" 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 python#importcompl#all()
-" 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.
+vim9script
 
-let s:git_grep_cmd = "git grep -H --line-number --ignore-case --no-color "
+# 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 python#importcompl#all()
+# 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.
 
-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
+const gitGrepCmd = "git grep -H --line-number --ignore-case --no-color "
 
-function! python#importcompl#do() abort
+export def Do(): string
     normal diw
-    let output = system(s:git_grep_cmd . '"^from .* import .*' . @" . '" -- "*.py" "**/*.py"')
-    let suggestions = []
+    var output = system(gitGrepCmd .. '"^from .* import .*' .. @" .. '" -- "*.py" "**/*.py"')
+    var suggestions: list<string>
+    var m: list<string>
     for line in split(output, "\n")
         if stridx(line, "unused-import") != -1 | continue | endif
-        let m = matchlist(line, '^.*:\d\+:\(.*\)$')
+        m = matchlist(line, '^.*:\d\+:\(.*\)$')
         if len(m) == 0 | continue | endif
-        call insert(suggestions, m[1])
+        insert(suggestions, m[1])
     endfor
-    call sort(suggestions, "python#importcompl#sortByLen")
-    call uniq(suggestions)
-    call reverse(suggestions)
-    call complete(col('.'), suggestions)
-    return ''
-endfunction
+    sort(suggestions, (s1: string, s2: string): number => {
+        if len(s1) == len(s2) | return 0 | endif
+        if len(s1) > len(s2) | return 1 | endif
+        return -1
+    })
+    uniq(suggestions)
+    reverse(suggestions)
+    complete(col("."), suggestions)
+    return ""
+enddef
 
-function! python#importcompl#all() abort
-    let output = system(s:git_grep_cmd . '"^from .* import" -- "*.py" "**/*.py"')
-    let imports = {}
+export def All()
+    var output = system(gitGrepCmd .. '"^from .* import" -- "*.py" "**/*.py"')
+    var imports = {}
+    var ms: list<string>
     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]
+            '^.*:\d\+:\(from .* import \(\w\+\).*\)$',
+            '^.*:\d\+:\(from .* import \w\+ as \(\w\+\).*\)$',
+        ]
+            ms = matchlist(line, regexp)
+            if len(ms) == 0 | break | endif
+            imports[ms[2]] = ms[1]
         endfor
     endfor
-
-    let lines = getloclist(winnr())
-    if len(lines) == 0 | let lines = getqflist() | endif
-    let result = []
+    var lines = getloclist(winnr())
+    if len(lines) == 0 | lines = getqflist() | endif
+    var result: list<string>
+    var m: string
     for line in lines
         if line.text !~ "^undefined name" | continue | endif
-        let m = line.text[strridx(line.text[:-2], "'")+1:-2]
+        m = line.text[strridx(line.text[: -2], "'") + 1 : -2]
         if len(m) == 0 || !has_key(imports, m) | continue | endif
-        call insert(result, imports[m])
+        insert(result, imports[m])
     endfor
-    call sort(result, "i")
-    call uniq(result)
-    call append(".", result)
-endfunction
+    sort(result, "i")
+    uniq(result)
+    append(".", result)
+enddef
index a44a0213f5de9f313186f81d2a23860ed7f72cab..25ef8cbb6ed1aa5c6221e9d86b8bf7bf178893c6 100644 (file)
@@ -1,6 +1,8 @@
-function! python#unused#remove() abort
-    call setqflist(filter(getqflist(), {idx, val ->
-        \ stridx(val.text, "unused-import") != -1 ||
-        \ stridx(val.text, "imported but unused") != -1}))
+vim9script
+
+export def Remove()
+    setqflist(filter(getqflist(), (idx, val) =>
+        stridx(val.text, "unused-import") != -1 ||
+        stridx(val.text, "imported but unused") != -1))
     cdo d
-endfunction
+enddef
index 956d5228e5805b5ce83ef1de04f6409b60b9070e..25cf83eac23cbb2796031b05233aa040a74a32da 100644 (file)
@@ -1,4 +1,4 @@
-if exists("*python#importcompl#do") | finish | endif
-inoremap <F3> <C-R>=python#importcompl#do()<CR>
-cnoremap <F3> call python#importcompl#all()<CR>
-cnoremap <F4> call python#unused#remove()<CR>
+if exists("*python#importcompl#Do") | finish | endif
+inoremap <F3> <C-R>=python#importcompl#Do()<CR>
+cnoremap <F3> call python#importcompl#All()<CR>
+cnoremap <F4> call python#unused#Remove()<CR>
index 389e2ec93fd6595453c180231a93699fb59afac9..5075c35da2f89eaebbbb2bc857453ed90e1bd71a 100644 (file)
@@ -1,18 +1,21 @@
-" 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.
+vim9script
 
-function! python#pep8#do() abort
+# 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.
+
+export def Do()
     set makeprg=PATH=$PATH\ pycodestyle\ --select=E,W\ %
     silent make
     sign unplace *
-    let l:id = 1
+    var _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
+        execute(":sign place " .. _id .. " name=P8 line=" .. item.lnum ..
+                " buffer=" .. item.bufnr)
+        _id = _id + 2
     endfor
     redraw!
     copen
-endfunction
+enddef
index 8340721eebedd06510e43738c38fd6de04cc4ec2..0115125637c906e67b43776d0999a40de30ac451 100644 (file)
@@ -1,3 +1,3 @@
-if exists("*python#pep8#do") | finish | endif
+if exists("*python#pep8#Do") | finish | endif
 sign define P8 text=P8 texthl=Error
-map <buffer> <F5> :call python#pep8#do()<CR>
+map <buffer> <F5> :call python#pep8#Do()<CR>
index 66610dc83321bdaeabe46cefb6caf76020865392..921321a54aa933a7a6ffba031c5a228dbb9d65e8 100644 (file)
@@ -1,19 +1,21 @@
-" 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.
+vim9script
 
-function! python#testname#get() abort
-    let l:pos = getpos(".")
-    let l:postfix = matchstr(getline(search(".*\s*def .*[Tt]est", "b")), '\w\+(')[:-2]
-    let l:postfix = matchstr(getline(search("^\s*class", "bn")), '\w\+(')[:-2] . "." . l:postfix
-    call setpos(".", l:pos)
-    let l:base = join([""] + split(getcwd(), "/")[:-1], "/")
-    let l:prefix = substitute(expand("%:p:r")[len(l:base)+1:], "/", ".", "g")
-    let l:name = l:prefix . ":" . l:postfix
-    let @* = l:name
-    echomsg l:name
-endfunction
+# 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.
+
+export def Get()
+    var pos = getpos(".")
+    var postfix = matchstr(getline(search(".*\s*def .*[Tt]est", "b")), '\w\+(')[: -2]
+    postfix = matchstr(getline(search("^\s*class", "bn")), '\w\+(')[: -2] .. "." .. postfix
+    setpos(".", pos)
+    var base = join([""] + split(getcwd(), "/")[: -1], "/")
+    var prefix = substitute(expand("%:p:r")[len(base) + 1 :], "/", ".", "g")
+    var name = prefix .. ":" .. postfix
+    @* = name
+    echomsg name
+enddef
index 7ec780230136d338038ab694825af2e0aa3bc9b6..e3d8f87a74a3bad0d8571c8fafb299a2bea2aae8 100644 (file)
@@ -1,2 +1,2 @@
-if exists("*python#testname#get") | finish | endif
-nmap <buffer> <leader>t :call python#testname#get()<CR>
+if exists("*python#testname#Get") | finish | endif
+nmap <buffer> <leader>t :call python#testname#Get()<CR>
index 5b5b1d86920b5ae5cd731e5a4f6aebc9cd31cda9..ba888d48dc2695b01a3d0b80e37f48226798c944 100644 (file)
@@ -1,14 +1,16 @@
-function! whereami#pwdLoad()
-    let g:whereami_pwdL=trim(system("pwd -L"))
-    let g:whereami_pwdP=trim(system("pwd -P"))
-endfunction
+vim9script
 
-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):]
+export def PwdLoad()
+    g:whereami_pwdL = trim(system("pwd -L"))
+    g:whereami_pwdP = trim(system("pwd -P"))
+enddef
+
+export def Do(fmt: string)
+    var fullpath = expand("%:p")
+    if fullpath[ : len(g:whereami_pwdP) - 1] ==# g:whereami_pwdP
+        fullpath = g:whereami_pwdL .. fullpath[len(g:whereami_pwdP) : ]
     endif
-    let where = printf(a:fmt, fullpath, line("."))
-    let @* = where
+    var where = printf(fmt, fullpath, line("."))
+    @* = where
     echomsg where
-endfunction
+enddef
index 33981349176e2fd2643be57d23443db67b86bc86..c3c972b4ce71d5d18aa14fe70c990e580ef3ece1 100644 (file)
@@ -1,4 +1,4 @@
 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>
+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>
diff --git a/vim/.vim/pack/stargrave/start/zshfe/autoload/zshfe.vim b/vim/.vim/pack/stargrave/start/zshfe/autoload/zshfe.vim
new file mode 100644 (file)
index 0000000..bb94dd6
--- /dev/null
@@ -0,0 +1,7 @@
+vim9script
+
+export def Do(query: string, opencmd: string)
+    silent var result = systemlist(g:zshfe_path .. " " .. query)
+    if len(result) == 0 | return | endif
+    execute opencmd .. " " .. result[0][: -2]
+enddef
index d85d531e07fb230ade35bc5a07d46d6613ee4fee..cb05d99e930bf5d390446f5b1866e2a01e54c379 100644 (file)
@@ -1,21 +1,17 @@
-" zsh file completion caller
-" Maintainer: Sergey Matveev <stargrave@stargrave.org>
-" License: GNU General Public License version 3 of the License or later
+vim9script
 
-if exists("*<SID>zshfe") | finish | endif
+# zsh file completion caller
+# Maintainer: Sergey Matveev <stargrave@stargrave.org>
+# License: GNU General Public License version 3 of the License or later
+
+if exists("*zshfe#Do") | finish | endif
 if !exists("g:zshfe_path")
-    let g:zshfe_path=expand("<sfile>:p:h") . "/zshfe.zsh"
+    g:zshfe_path = expand("<sfile>:p:h") .. "/zshfe.zsh"
 endif
 
-function! s:zshfe(query, opencmd)
-    silent let result = systemlist(g:zshfe_path . " " . a:query)
-    if len(result) == 0 | return | endif
-    exec a:opencmd . " " . result[0][:-2]
-endfunction
-
-command! -nargs=1 Fe call s:zshfe(<f-args>, "edit")
-command! -nargs=1 Fsp call s:zshfe(<f-args>, "split")
-command! -nargs=1 Fvs call s:zshfe(<f-args>, "vsplit")
+command! -nargs=1 Fe call zshfe#Do(<f-args>, "edit")
+command! -nargs=1 Fsp call zshfe#Do(<f-args>, "split")
+command! -nargs=1 Fvs call zshfe#Do(<f-args>, "vsplit")
 
 nmap <Leader>e :Fe 
 nmap <Leader><space> :Fsp 
index a412e42d5dd2824b328335a969a5d793a2e2a062..bb39d028a14bd0378b2c54f154561fa95d9266f9 100644 (file)
@@ -1,7 +1,9 @@
-let g:loaded_2html_plugin = 1
-let g:loaded_getscriptPlugin = 1
-let g:loaded_logipat = 1
-let g:loaded_rrhelper = 1
-let g:loaded_spellfile_plugin = 1
-let g:loaded_vimballPlugin = 1
-let g:loaded_vimball = 1
+vim9script
+
+g:loaded_2html_plugin = 1
+g:loaded_getscriptPlugin = 1
+g:loaded_logipat = 1
+g:loaded_rrhelper = 1
+g:loaded_spellfile_plugin = 1
+g:loaded_vimballPlugin = 1
+g:loaded_vimball = 1
index e24524ecdf47bad86abe695489c799db98610521..e0f00790fd7dddb30f678765811af55a08c96568 100644 (file)
@@ -1,7 +1,2 @@
-if exists("*<SID>exted") | finish | endif
-
-function! s:exted(ext)
-    execute "edit %<." . a:ext
-endfunction
-
-command! -nargs=1 Ee silent call s:exted(<f-args>)
+vim9script
+command -nargs=1 Ee execute "edit %<." .. <f-args>
index e2f43fbec8a7e28980424c413b9b9dff370c676e..26f3d17524fd7f1926f98847c82558f542d0c68a 100644 (file)
@@ -1,9 +1,6 @@
-if exists("*<SID>Vmg") | finish | endif
+vim9script
 
-function! s:Vmg(pattern)
-    silent execute 'Ggrep "' . a:pattern . '"'
+command! -nargs=* -complete=file Vmg {
+    silent execute "Ggrep \"" .. <q-args> .. '"'
     copen
-    redraw!
-endfunction
-
-command! -nargs=* -complete=file Vmg call s:Vmg(<q-args>)
+}
index 140f8fcf89578b58521fc83a23bdbbee0b74059d..333a9d7214553fb08eddadc4d179876ec88ccc41 100644 (file)
@@ -1,10 +1,8 @@
-if exists("*<SID>Vim") | finish | endif
+vim9script
 
-function! s:Vim(pattern)
+command! -nargs=* -complete=file Vim {
     set grepprg=grep\ -Rns\ --binary-files=without-match\ --exclude-dir=.git\ --exclude-dir=.tags\ $*\ /dev/null\ .
-    execute "silent grep \"" . a:pattern . "\""
+    execute "silent grep \"" .. <q-args> .. "\""
     copen
     redraw!
-endfunction
-
-command! -nargs=* -complete=file Vim call s:Vim(<q-args>)
+}
index 1928046941157257f7e6d251d1b51478a863ada6..1f5586b3c4b9558c3f1cd9d2a674efea5a74a743 100644 (file)
@@ -1,27 +1,29 @@
-" go get golang.org/x/tools/gopls@latest
-" pip install 'python-language-server[all]'
+vim9script
 
-let g:lsc_enable_autocomplete = v:false
-let g:lsc_server_commands = {
-    \ "c": {"command": "clangd --log=error"},
-    \ "cpp": {"command": "clangd --log=error"},
-    \ "go": {"command": "gopls", "log_level": -1},
-    \ "python": {
-    \     "command": "pyls",
-    \     "workspace_config": {"pyls": {
-    \         "configurationSources": ["flake8"],
-    \         "plugins": {
-    \             "mccabe": {"enabled": v:false},
-    \         },
-    \     }},
-    \     "enabled": v:false,
-    \ },
-\ }
-let g:lsc_auto_map = {
-    \ "GoToDefinition": "gd",
-    \ "GoToDefinitionSplit": "<C-W>gd",
-    \ "ShowHover": v:true,
-    \ "Completion": "omnifunc",
-\ }
+# go get golang.org/x/tools/gopls@latest
+# pip install 'python-language-server[all]'
+
+g:lsc_enable_autocomplete = v:false
+g:lsc_server_commands = {
+    c: {command: "clangd --log=error"},
+    cpp: {command: "clangd --log=error"},
+    go: {command: "gopls", log_level: -1},
+    python: {
+        command: "pyls",
+        workspace_config: {pyls: {
+            configurationSources: ["flake8"],
+            plugins: {
+                mccabe: {enabled: v:false},
+            },
+        }},
+        enabled: v:false,
+    },
+}
+g:lsc_auto_map = {
+    GoToDefinition: "gd",
+    GoToDefinitionSplit: "<C-W>gd",
+    ShowHover: v:true,
+    Completion: "omnifunc",
+}
 
 map <F6> :LSClientAllDiagnostics<CR>
index a724061835184376659f789821229ca8739008ed..9b71a8d6afe587a30327e32c3284efc4037950e8 100644 (file)
@@ -1,12 +1,14 @@
+vim9script
 if exists("g:loaded_mein_netrw") | finish | endif
-let g:loaded_mein_netrw = 1
+g:loaded_mein_netrw = 1
 
-let g:netrw_banner = 0
-let g:netrw_bufsettings = "noma nomod nowrap ro nobl"
+g:netrw_banner = 0
+g:netrw_bufsettings = "noma nomod nowrap ro nobl"
 
-function! WinClose(islocal)
+def g:WinClose(islocal: number): string
     close
-endfunction
-let g:Netrw_UserMaps = [["<Del>", "WinClose"]]
+    return ""
+enddef
+g:Netrw_UserMaps = [["<Del>", "g:WinClose"]]
 
 autocmd VimLeave * call delete("/home/stargrave/.vim/.netrwhist")