From 868d8d69627c4b8fd5225da0dff5905f75645946 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Thu, 24 Nov 2022 10:23:50 +0000 Subject: vim-patch:partial:b59ae59a5870 (#21170) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update runtime files https://github.com/vim/vim/commit/b59ae59a58706e454ef8c78276f021b1f58466e7 - Omit `map()` lambda arg comment. Not worth mentioning for legacy script (and is already hinted at below). - Cherry-pick latest `'thesaurusfunc'` example. - Skip `optwin.vim` `'keyprotocol'` change. - 🧜‍♀️ Co-authored-by: Bram Moolenaar --- runtime/doc/autocmd.txt | 9 +- runtime/doc/builtin.txt | 43 +- runtime/doc/digraph.txt | 2 +- runtime/doc/insert.txt | 44 +- runtime/doc/map.txt | 2 +- runtime/doc/options.txt | 8 +- runtime/doc/tips.txt | 2 +- runtime/ftplugin/lua.vim | 4 +- runtime/ftplugin/mermaid.vim | 49 + runtime/ftplugin/obse.vim | 70 + runtime/indent/obse.vim | 55 + runtime/optwin.vim | 2 +- runtime/syntax/mermaid.vim | 155 ++ runtime/syntax/obse.vim | 3360 +++++++++++++++++++++++++++++++++++++++++ runtime/syntax/swayconfig.vim | 28 +- 15 files changed, 3774 insertions(+), 59 deletions(-) create mode 100644 runtime/ftplugin/mermaid.vim create mode 100644 runtime/ftplugin/obse.vim create mode 100644 runtime/indent/obse.vim create mode 100644 runtime/syntax/mermaid.vim create mode 100644 runtime/syntax/obse.vim (limited to 'runtime') diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 9bb835e661..a39407aeca 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -823,8 +823,8 @@ QuickFixCmdPre Before a quickfix command is run (|:make|, QuickFixCmdPost Like QuickFixCmdPre, but after a quickfix command is run, before jumping to the first location. For |:cfile| and |:lfile| commands - it is run after error file is read and before - moving to the first error. + it is run after the error file is read and + before moving to the first error. See |QuickFixCmdPost-example|. *QuitPre* QuitPre When using `:quit`, `:wq` or `:qall`, before @@ -1065,8 +1065,9 @@ VimResume After Nvim resumes from |suspend| state. *VimSuspend* VimSuspend Before Nvim enters |suspend| state. *WinClosed* -WinClosed After closing a window. The pattern is - matched against the |window-ID|. Both +WinClosed When closing a window, just before it is + removed from the window layout. The pattern + is matched against the |window-ID|. Both and are set to the |window-ID|. After WinLeave. Non-recursive (event cannot trigger itself). diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index fdee409639..08c8e2e9d6 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -6921,29 +6921,38 @@ setbufvar({buf}, {varname}, {val}) *setbufvar()* setcellwidths({list}) *setcellwidths()* Specify overrides for cell widths of character ranges. This - tells Vim how wide characters are, counted in screen cells. - This overrides 'ambiwidth'. Example: > - setcellwidths([[0xad, 0xad, 1], - \ [0x2194, 0x2199, 2]]) - -< *E1109* *E1110* *E1111* *E1112* *E1113* *E1114* - The {list} argument is a list of lists with each three - numbers. These three numbers are [low, high, width]. "low" - and "high" can be the same, in which case this refers to one - character. Otherwise it is the range of characters from "low" - to "high" (inclusive). "width" is either 1 or 2, indicating - the character width in screen cells. - An error is given if the argument is invalid, also when a - range overlaps with another. + tells Vim how wide characters are when displayed in the + terminal, counted in screen cells. The values override + 'ambiwidth'. Example: > + call setcellwidths([ + \ [0x111, 0x111, 1], + \ [0x2194, 0x2199, 2], + \ ]) + +< The {list} argument is a List of Lists with each three + numbers: [{low}, {high}, {width}]. *E1109* *E1110* + {low} and {high} can be the same, in which case this refers to + one character. Otherwise it is the range of characters from + {low} to {high} (inclusive). *E1111* *E1114* Only characters with value 0x100 and higher can be used. + {width} must be either 1 or 2, indicating the character width + in screen cells. *E1112* + An error is given if the argument is invalid, also when a + range overlaps with another. *E1113* + If the new value causes 'fillchars' or 'listchars' to become invalid it is rejected and an error is given. - To clear the overrides pass an empty list: > - setcellwidths([]); + To clear the overrides pass an empty {list}: > + call setcellwidths([]) + < You can use the script $VIMRUNTIME/tools/emoji_list.vim to see - the effect for known emoji characters. + the effect for known emoji characters. Move the cursor + through the text to check if the cell widths of your terminal + match with what Vim knows about each emoji. If it doesn't + look right you need to adjust the {list} argument. + setcharpos({expr}, {list}) *setcharpos()* Same as |setpos()| but uses the specified column number as the diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt index eb3de0111f..ce0a929bc1 100644 --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -156,7 +156,7 @@ These are the RFC1345 digraphs for the one-byte characters. See the output of ":digraphs" for the others. EURO - + *euro* *euro-digraph* Exception: RFC1345 doesn't specify the euro sign. In Vim the digraph =e was added for this. Note the difference between latin1, where the digraph Cu is used for the currency sign, and latin9 (iso-8859-15), where the digraph =e is diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 0133824e76..e25f5901ef 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -857,29 +857,27 @@ invoked and what it should return. Here is an example that uses the "aiksaurus" command (provided by Magnus Groß): > - func Thesaur(findstart, base) - if a:findstart - let line = getline('.') - let start = col('.') - 1 - while start > 0 && line[start - 1] =~ '\a' - let start -= 1 - endwhile - return start - else - let res = [] - let h = '' - for l in split(system('aiksaurus ' .. shellescape(a:base)), '\n') - if l[:3] == '=== ' - let h = substitute(l[4:], ' =*$', '', '') - elseif l[0] =~ '\a' - call extend(res, map(split(l, ', '), {_, val -> {'word': val, 'menu': '('.h.')'}})) - endif - endfor - return res - endif - endfunc - - set thesaurusfunc=Thesaur + func Thesaur(findstart, base) + if a:findstart + return searchpos('\<', 'bnW', line('.'))[1] - 1 + endif + let res = [] + let h = '' + for l in systemlist('aiksaurus ' .. shellescape(a:base)) + if l[:3] == '=== ' + let h = '(' .. substitute(l[4:], ' =*$', ')', '') + elseif l ==# 'Alphabetically similar known words are: ' + let h = "\U0001f52e" + elseif l[0] =~ '\a' || (h ==# "\U0001f52e" && l[0] ==# "\t") + call extend(res, map(split(substitute(l, '^\t', '', ''), ', '), {_, val -> {'word': val, 'menu': h}})) + endif + endfor + return res + endfunc + + if exists('+thesaurusfunc') + set thesaurusfunc=Thesaur + endif Completing keywords in the current and included files *compl-keyword* diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index c4bacfd632..fe07c2e1c1 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1713,7 +1713,7 @@ When executed as: > This will invoke: > :call Myfunc("arg1","arg2") -< *q-args-example* +< *q-args-example* A more substantial example: > :function Allargs(command) : let i = 0 diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 0895d980f5..36eabfdcbf 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3349,9 +3349,13 @@ A jump table for the options with a short description can be found at |Q_op|. local to buffer Expression to be used to transform the string found with the 'include' option to a file name. Mostly useful to change "." to "/" for Java: > - :set includeexpr=substitute(v:fname,'\\.','/','g') + :setlocal includeexpr=substitute(v:fname,'\\.','/','g') < The "v:fname" variable will be set to the file name that was detected. - + Note the double backslash: the `:set` command first halves them, then + one remains in the value, where "\." matches a dot literally. For + simple character replacements `tr()` avoids the need for escaping: > + :setlocal includeexpr=tr(v:fname,'.','/') +< Also used for the |gf| command if an unmodified file name can't be found. Allows doing "gf" on the name after an 'include' statement. Also used for ||. diff --git a/runtime/doc/tips.txt b/runtime/doc/tips.txt index 5416ba5d89..559f31eb2d 100644 --- a/runtime/doc/tips.txt +++ b/runtime/doc/tips.txt @@ -454,7 +454,7 @@ the current window, try this custom `:HelpCurwin` command: > command -bar -nargs=? -complete=help HelpCurwin execute s:HelpCurwin() let s:did_open_help = v:false - + function s:HelpCurwin(subject) abort let mods = 'silent noautocmd keepalt' if !s:did_open_help diff --git a/runtime/ftplugin/lua.vim b/runtime/ftplugin/lua.vim index c6ce4a0615..88b1fc9d44 100644 --- a/runtime/ftplugin/lua.vim +++ b/runtime/ftplugin/lua.vim @@ -4,7 +4,7 @@ " Previous Maintainer: Max Ischenko " Contributor: Dorai Sitaram " C.D. MacEachern -" Last Change: 2022 Nov 16 +" Last Change: 2022 Nov 19 if exists("b:did_ftplugin") finish @@ -21,7 +21,7 @@ setlocal formatoptions-=t formatoptions+=croql let &l:define = '\ +" Last Change: 2022 Oct 13 + +if exists("b:did_ftplugin") + finish +endif + +let s:keepcpo= &cpo +set cpo&vim + +" Use mermaid live editor's style +setlocal expandtab +setlocal shiftwidth=2 +setlocal softtabstop=-1 +setlocal tabstop=4 + +" TODO: comments, formatlist stuff, based on what? +setlocal comments=b:#,fb:- +setlocal commentstring=#\ %s +setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:\\&^.\\{4\\} + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= "|setl cms< com< fo< flp< et< ts< sts< sw<" +else + let b:undo_ftplugin = "setl cms< com< fo< flp< et< ts< sts< sw<" +endif + +if !exists("g:no_plugin_maps") && !exists("g:no_markdown_maps") + nnoremap [[ :call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "bsW") + nnoremap ]] :call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "sW") + xnoremap [[ :exe "normal! gv"call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "bsW") + xnoremap ]] :exe "normal! gv"call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "sW") + let b:undo_ftplugin .= '|sil! nunmap [[|sil! nunmap ]]|sil! xunmap [[|sil! xunmap ]]' +endif + +" if has("folding") && get(g:, "markdown_folding", 0) +" setlocal foldexpr=MarkdownFold() +" setlocal foldmethod=expr +" setlocal foldtext=MarkdownFoldText() +" let b:undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<" +" endif + +let &cpo = s:keepcpo +unlet s:keepcpo + +" vim:set sw=2: diff --git a/runtime/ftplugin/obse.vim b/runtime/ftplugin/obse.vim new file mode 100644 index 0000000000..6d865f05ee --- /dev/null +++ b/runtime/ftplugin/obse.vim @@ -0,0 +1,70 @@ +" Vim filetype plugin file +" Language: Oblivion Language (obl) +" Original Creator: Kat +" Maintainer: Kat +" Created: August 08, 2021 +" Last Change: 13 November 2022 + +if exists("b:did_ftplugin") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +let b:undo_ftplugin = "setl com< cms<" + +noremap