From b529cfbd04c02e31cfa88f2c8d88b5ff532d4f7d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 25 Jul 2022 15:42:07 +0100 Subject: Update runtime files --- .github/CODEOWNERS | 7 + runtime/autoload/bitbake.vim | 95 +++++++++ runtime/autoload/python.vim | 228 +++++++++++++++++++++ runtime/doc/autocmd.txt | 2 +- runtime/doc/builtin.txt | 16 +- runtime/doc/ft_sql.txt | 8 +- runtime/doc/gui_x11.txt | 2 +- runtime/doc/insert.txt | 18 +- runtime/doc/map.txt | 23 ++- runtime/doc/options.txt | 2 +- runtime/doc/pi_netrw.txt | 2 +- runtime/doc/repeat.txt | 2 +- runtime/doc/tags | 1 + runtime/doc/todo.txt | 22 +- runtime/doc/undo.txt | 10 +- runtime/ftplugin/bitbake.vim | 16 ++ runtime/ftplugin/expect.vim | 24 +++ runtime/ftplugin/html.vim | 60 +++--- runtime/indent/bitbake.vim | 22 ++ runtime/indent/expect.vim | 11 + runtime/indent/python.vim | 203 +----------------- runtime/indent/testdir/bitbake.in | 19 ++ runtime/indent/testdir/bitbake.ok | 19 ++ .../pack/dist/opt/shellmenu/plugin/shellmenu.vim | 166 +++++++-------- runtime/synmenu.vim | 4 + runtime/syntax/bitbake.vim | 126 ++++++++++++ runtime/syntax/html.vim | 219 +++++++++++--------- runtime/syntax/make.vim | 12 +- 28 files changed, 879 insertions(+), 460 deletions(-) create mode 100644 runtime/autoload/bitbake.vim create mode 100644 runtime/autoload/python.vim create mode 100644 runtime/ftplugin/bitbake.vim create mode 100644 runtime/ftplugin/expect.vim create mode 100644 runtime/indent/bitbake.vim create mode 100644 runtime/indent/expect.vim create mode 100644 runtime/indent/testdir/bitbake.in create mode 100644 runtime/indent/testdir/bitbake.ok create mode 100644 runtime/syntax/bitbake.vim diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 16b73fa857..3b41c8be25 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -109,12 +109,15 @@ runtime/ftplugin/css.vim @dkearns runtime/ftplugin/cucumber.vim @tpope runtime/ftplugin/dosbatch.vim @mrdubya runtime/ftplugin/eiffel.vim @dkearns +runtime/ftplugin/expect.vim @dkearns runtime/ftplugin/erlang.vim @hcs42 runtime/ftplugin/eruby.vim @tpope @dkearns +runtime/ftplugin/fennel.vim @gpanders runtime/ftplugin/fetchmail.vim @dkearns runtime/ftplugin/fpcmake.vim @dkearns runtime/ftplugin/freebasic.vim @dkearns runtime/ftplugin/fstab.vim @rid9 +runtime/ftplugin/gdb.vim @xeyownt runtime/ftplugin/git.vim @tpope runtime/ftplugin/gitcommit.vim @tpope runtime/ftplugin/gitconfig.vim @tpope @@ -124,6 +127,7 @@ runtime/ftplugin/go.vim @dbarnett runtime/ftplugin/gprof.vim @dpelle runtime/ftplugin/haml.vim @tpope runtime/ftplugin/hgcommit.vim @k-takata +runtime/ftplugin/html.vim @dkearns runtime/ftplugin/i3config.vim @hiqua runtime/ftplugin/icon.vim @dkearns runtime/ftplugin/indent.vim @dkearns @@ -297,8 +301,10 @@ runtime/syntax/eiffel.vim @jocelyn runtime/syntax/elmfilt.vim @cecamp runtime/syntax/erlang.vim @hcs42 runtime/syntax/eruby.vim @tpope @dkearns +runtime/syntax/expect.vim @dkearns runtime/syntax/exports.vim @cecamp runtime/syntax/falcon.vim @steveno +runtime/syntax/fennel.vim @gpanders runtime/syntax/fetchmail.vim @dkearns runtime/syntax/forth.vim @jkotlinski runtime/syntax/fpcmake.vim @dkearns @@ -316,6 +322,7 @@ runtime/syntax/groff.vim @jmarshall runtime/syntax/haml.vim @tpope runtime/syntax/haskell.vim @coot runtime/syntax/hgcommit.vim @k-takata +runtime/syntax/html.vim @dkearns runtime/syntax/i3config.vim @hiqua runtime/syntax/icon.vim @dkearns runtime/syntax/indent.vim @dkearns diff --git a/runtime/autoload/bitbake.vim b/runtime/autoload/bitbake.vim new file mode 100644 index 0000000000..bb3fc5c0e2 --- /dev/null +++ b/runtime/autoload/bitbake.vim @@ -0,0 +1,95 @@ +" Support for bitbake indenting, see runtime/indent/bitbake.vim + +function s:is_bb_python_func_def(lnum) + let stack = synstack(a:lnum, 1) + if len(stack) == 0 + return 0 + endif + + return synIDattr(stack[0], "name") == "bbPyFuncDef" +endfunction + +function bitbake#Indent(lnum) + if !has('syntax_items') + return -1 + endif + + let stack = synstack(a:lnum, 1) + if len(stack) == 0 + return -1 + endif + + let name = synIDattr(stack[0], "name") + + " TODO: support different styles of indentation for assignments. For now, + " we only support like this: + " VAR = " \ + " value1 \ + " value2 \ + " " + " + " i.e. each value indented by shiftwidth(), with the final quote " completely unindented. + if name == "bbVarValue" + " Quote handling is tricky. kernel.bbclass has this line for instance: + " EXTRA_OEMAKE = " HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" " HOSTCPP="${BUILD_CPP}"" + " Instead of trying to handle crazy cases like that, just assume that a + " double-quote on a line by itself (following an assignment) means the + " user is closing the assignment, and de-dent. + if getline(a:lnum) =~ '^\s*"$' + return 0 + endif + + let prevstack = synstack(a:lnum - 1, 1) + if len(prevstack) == 0 + return -1 + endif + + let prevname = synIDattr(prevstack[0], "name") + + " Only indent if there was actually a continuation character on + " the previous line, to avoid misleading indentation. + let prevlinelastchar = synIDattr(synID(a:lnum - 1, col([a:lnum - 1, "$"]) - 1, 1), "name") + let prev_continued = prevlinelastchar == "bbContinue" + + " Did the previous line introduce an assignment? + if index(["bbVarDef", "bbVarFlagDef"], prevname) != -1 + if prev_continued + return shiftwidth() + endif + endif + + if !prev_continued + return 0 + endif + + " Autoindent can take it from here + return -1 + endif + + if index(["bbPyDefRegion", "bbPyFuncRegion"], name) != -1 + let ret = python#GetIndent(a:lnum, function('s:is_bb_python_func_def')) + " Should normally always be indented by at least one shiftwidth; but allow + " return of -1 (defer to autoindent) or -2 (force indent to 0) + if ret == 0 + return shiftwidth() + elseif ret == -2 + return 0 + endif + return ret + endif + + " TODO: GetShIndent doesn't detect tasks prepended with 'fakeroot' + " Need to submit a patch upstream to Vim to provide an extension point. + " Unlike the Python indenter, the Sh indenter is way too large to copy and + " modify here. + if name == "bbShFuncRegion" + return GetShIndent() + endif + + " TODO: + " + heuristics for de-denting out of a bbPyDefRegion? e.g. when the user + " types an obvious BB keyword like addhandler or addtask, or starts + " writing a shell task. Maybe too hard to implement... + + return -1 +endfunction diff --git a/runtime/autoload/python.vim b/runtime/autoload/python.vim new file mode 100644 index 0000000000..7e7bca6fb6 --- /dev/null +++ b/runtime/autoload/python.vim @@ -0,0 +1,228 @@ +" Support for Python indenting, see runtime/indent/python.vim + +let s:keepcpo= &cpo +set cpo&vim + +" See if the specified line is already user-dedented from the expected value. +function s:Dedented(lnum, expected) + return indent(a:lnum) <= a:expected - shiftwidth() +endfunction + +let s:maxoff = 50 " maximum number of lines to look backwards for () + +" Some other filetypes which embed Python have slightly different indent +" rules (e.g. bitbake). Those filetypes can pass an extra funcref to this +" function which is evaluated below. +function python#GetIndent(lnum, ...) + let ExtraFunc = a:0 > 0 ? a:1 : 0 + + " If this line is explicitly joined: If the previous line was also joined, + " line it up with that one, otherwise add two 'shiftwidth' + if getline(a:lnum - 1) =~ '\\$' + if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$' + return indent(a:lnum - 1) + endif + return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (shiftwidth() * 2)) + endif + + " If the start of the line is in a string don't change the indent. + if has('syntax_items') + \ && synIDattr(synID(a:lnum, 1, 1), "name") =~ "String$" + return -1 + endif + + " Search backwards for the previous non-empty line. + let plnum = prevnonblank(v:lnum - 1) + + if plnum == 0 + " This is the first non-empty line, use zero indent. + return 0 + endif + + call cursor(plnum, 1) + + " Identing inside parentheses can be very slow, regardless of the searchpair() + " timeout, so let the user disable this feature if he doesn't need it + let disable_parentheses_indenting = get(g:, "pyindent_disable_parentheses_indenting", 0) + + if disable_parentheses_indenting == 1 + let plindent = indent(plnum) + let plnumstart = plnum + else + " searchpair() can be slow sometimes, limit the time to 150 msec or what is + " put in g:pyindent_searchpair_timeout + let searchpair_stopline = 0 + let searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150) + + " If the previous line is inside parenthesis, use the indent of the starting + " line. + " Trick: use the non-existing "dummy" variable to break out of the loop when + " going too far back. + let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW', + \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if parlnum > 0 + if a:0 > 0 && ExtraFunc(parlnum) + " We may have found the opening brace of a bitbake Python task, e.g. 'python do_task {' + " If so, ignore it here - it will be handled later. + let parlnum = 0 + let plindent = indent(plnum) + let plnumstart = plnum + else + let plindent = indent(parlnum) + let plnumstart = parlnum + endif + else + let plindent = indent(plnum) + let plnumstart = plnum + endif + + " When inside parenthesis: If at the first line below the parenthesis add + " two 'shiftwidth', otherwise same as previous line. + " i = (a + " + b + " + c) + call cursor(a:lnum, 1) + let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if p > 0 + if a:0 > 0 && ExtraFunc(p) + " Currently only used by bitbake + " Handle first non-empty line inside a bitbake Python task + if p == plnum + return shiftwidth() + endif + + " Handle the user actually trying to close a bitbake Python task + let line = getline(a:lnum) + if line =~ '^\s*}' + return -2 + endif + + " Otherwise ignore the brace + let p = 0 + else + if p == plnum + " When the start is inside parenthesis, only indent one 'shiftwidth'. + let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if pp > 0 + return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) + endif + return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2)) + endif + if plnumstart == p + return indent(plnum) + endif + return plindent + endif + endif + endif + + + " Get the line and remove a trailing comment. + " Use syntax highlighting attributes when possible. + let pline = getline(plnum) + let pline_len = strlen(pline) + if has('syntax_items') + " If the last character in the line is a comment, do a binary search for + " the start of the comment. synID() is slow, a linear search would take + " too long on a long line. + if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)$" + let min = 1 + let max = pline_len + while min < max + let col = (min + max) / 2 + if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)$" + let max = col + else + let min = col + 1 + endif + endwhile + let pline = strpart(pline, 0, min - 1) + endif + else + let col = 0 + while col < pline_len + if pline[col] == '#' + let pline = strpart(pline, 0, col) + break + endif + let col = col + 1 + endwhile + endif + + " If the previous line ended with a colon, indent this line + if pline =~ ':\s*$' + return plindent + shiftwidth() + endif + + " If the previous line was a stop-execution statement... + if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>' + " See if the user has already dedented + if s:Dedented(a:lnum, indent(plnum)) + " If so, trust the user + return -1 + endif + " If not, recommend one dedent + return indent(plnum) - shiftwidth() + endif + + " If the current line begins with a keyword that lines up with "try" + if getline(a:lnum) =~ '^\s*\(except\|finally\)\>' + let lnum = a:lnum - 1 + while lnum >= 1 + if getline(lnum) =~ '^\s*\(try\|except\)\>' + let ind = indent(lnum) + if ind >= indent(a:lnum) + return -1 " indent is already less than this + endif + return ind " line up with previous try or except + endif + let lnum = lnum - 1 + endwhile + return -1 " no matching "try"! + endif + + " If the current line begins with a header keyword, dedent + if getline(a:lnum) =~ '^\s*\(elif\|else\)\>' + + " Unless the previous line was a one-liner + if getline(plnumstart) =~ '^\s*\(for\|if\|elif\|try\)\>' + return plindent + endif + + " Or the user has already dedented + if s:Dedented(a:lnum, plindent) + return -1 + endif + + return plindent - shiftwidth() + endif + + " When after a () construct we probably want to go back to the start line. + " a = (b + " + c) + " here + if parlnum > 0 + " ...unless the user has already dedented + if s:Dedented(a:lnum, plindent) + return -1 + else + return plindent + endif + endif + + return -1 +endfunction + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 5d76ff3a31..d85fb89bce 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1275,7 +1275,7 @@ User Never executed automatically. To be used for if exists('#User#MyEvent') doautocmd User MyEvent endif - +< *SigUSR1* SigUSR1 After the SIGUSR1 signal has been detected. Could be used if other ways of notifying Vim diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index dc68def416..d182f47d90 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -293,7 +293,7 @@ index({object}, {expr} [, {start} [, {ic}]]) Number index in {object} where {expr} appears input({prompt} [, {text} [, {completion}]]) String get input from the user -inputdialog({prompt} [, {text} [, {completion}]]) +inputdialog({prompt} [, {text} [, {cancelreturn}]]) String like input() but in a GUI dialog inputlist({textlist}) Number let the user pick from a choice list inputrestore() Number restore typeahead @@ -1149,7 +1149,7 @@ blob2list({blob}) *blob2list()* Can also be used as a |method|: > GetBlob()->blob2list() - +< *browse()* browse({save}, {title}, {initdir}, {default}) Put up a file requester. This only works when "has("browse")" @@ -2316,7 +2316,9 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined, To check for a supported command always check the return value to be 2. :2match The |:2match| command. - :3match The |:3match| command. + :3match The |:3match| command (but you + probably should not use it, it is + reserved for internal usage) #event autocommand defined for this event #event#pattern autocommand defined for this event and pattern (the pattern is taken @@ -5773,8 +5775,10 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]]) message will appear and the match will not be added. An ID is specified as a positive integer (zero excluded). IDs 1, 2 and 3 are reserved for |:match|, |:2match| and |:3match|, - respectively. If the {id} argument is not specified or -1, - |matchadd()| automatically chooses a free ID. + respectively. 3 is reserved for use by the + |matchparen|polugin. + If the {id} argument is not specified or -1, |matchadd()| + automatically chooses a free ID. The optional {dict} argument allows for further custom values. Currently this is used to specify a match specific @@ -7475,7 +7479,7 @@ searchcount([{options}]) *searchcount()* " to 1) let result = searchcount() < - The function is useful to add the count to |statusline|: > + The function is useful to add the count to 'statusline': > function! LastSearchCount() abort let result = searchcount(#{recompute: 0}) if empty(result) diff --git a/runtime/doc/ft_sql.txt b/runtime/doc/ft_sql.txt index 73d619c5d0..0bf98861e6 100644 --- a/runtime/doc/ft_sql.txt +++ b/runtime/doc/ft_sql.txt @@ -506,7 +506,7 @@ documentation. Assuming you have followed the dbext-tutorial you can press t to display a list of tables. There is a delay while dbext is creating the table list. After the list is displayed press . This will remove both the -popup window and the table name already chosen when the list became active. > +popup window and the table name already chosen when the list became active. 4.3.1 Table Completion: *sql-completion-tables* @@ -514,7 +514,7 @@ Press t to display a list of tables from within the database you have connected via the dbext plugin. NOTE: All of the SQL completion popups support typing a prefix before pressing the key map. This will limit the contents of the popup window to just items -beginning with those characters. > +beginning with those characters. 4.3.2 Column Completion: *sql-completion-columns* @@ -587,13 +587,13 @@ popup a list of columns for the customer table. It does this by looking back to the beginning of the select statement and finding a list of the tables specified in the FROM clause. In this case it notes that in the string "customer c", "c" is an alias for the customer table. The optional "AS" -keyword is also supported, "customer AS c". > +keyword is also supported, "customer AS c". 4.3.3 Procedure Completion: *sql-completion-procedures* Similar to the table list, p, will display a list of stored -procedures stored within the database. > +procedures stored within the database. 4.3.4 View Completion: *sql-completion-views* diff --git a/runtime/doc/gui_x11.txt b/runtime/doc/gui_x11.txt index 942037a64c..14ed9f5c96 100644 --- a/runtime/doc/gui_x11.txt +++ b/runtime/doc/gui_x11.txt @@ -680,7 +680,7 @@ Of these three, Vim uses PRIMARY when reading and writing the "* register register. Vim does not access the SECONDARY selection. This applies both to the GUI and the terminal version. For non-X11 systems -the plus and the star register both us the system clipboard. +the plus and the star register both use the system clipboard. Examples: (assuming the default option values) - Select a URL in Visual mode in Vim. Go to your browser and click the diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index b376af700b..51cfa46975 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -388,10 +388,10 @@ CTRL-G CTRL-J cursor one line down, insert start column *i_CTRL-G_CTRL-J* CTRL-O execute one command, return to Insert mode *i_CTRL-O* CTRL-\ CTRL-O like CTRL-O but don't move the cursor *i_CTRL-\_CTRL-O* CTRL-L when 'insertmode' is set: go to Normal mode *i_CTRL-L* -CTRL-G u break undo sequence, start new change *i_CTRL-G_u* -CTRL-G U don't break undo with next left/right cursor *i_CTRL-G_U* - movement, if the cursor stays within the - same line +CTRL-G u close undo sequence, start new change *i_CTRL-G_u* +CTRL-G U don't start a new undo block with the next *i_CTRL-G_U* + left/right cursor movement, if the cursor + stays within the same line ----------------------------------------------------------------------- Note: If the cursor keys take you out of Insert mode, check the 'noesckeys' @@ -428,8 +428,8 @@ that, with CTRL-O u. Another example: > :inoremap u -This breaks undo at each line break. It also expands abbreviations before -this. +This starts a new undo block at each line break. It also expands +abbreviations before this. An example for using CTRL-G U: > @@ -443,9 +443,9 @@ An example for using CTRL-G U: > inoremap repeat('U', col('$') - col('.')) inoremap ( ()U -This makes it possible to use the cursor keys in Insert mode, without breaking -the undo sequence and therefore using |.| (redo) will work as expected. -Also entering a text like (with the "(" mapping from above): +This makes it possible to use the cursor keys in Insert mode, without starting +a new undo block and therefore using |.| (redo) will work as expected. Also +entering a text like (with the "(" mapping from above): Lorem ipsum (dolor diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index e4332b8d4a..69557d6146 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -682,19 +682,22 @@ two bytes 0xc3 0xa1. You don't want the 0xc3 byte to be mapped then or otherwise it would be impossible to type the รก character. ** *mapleader* -To define a mapping which uses the "mapleader" variable, the special string -"" can be used. It is replaced with the string value of "mapleader". -If "mapleader" is not set or empty, a backslash is used instead. Example: > - :map A oanother line +To define a mapping which uses the "g:mapleader" variable, the special string +"" can be used. It is replaced with the string value of +"g:mapleader". If "g:mapleader" is not set or empty, a backslash is used +instead. Example: > + map A oanother line Works like: > - :map \A oanother line -But after: > - :let mapleader = "," + map \A oanother line +But after (legacy script): > + let mapleader = "," +Or (Vim9 script): > + g:mapleader = "," It works like: > - :map ,A oanother line + map ,A oanother line -Note that the value of "mapleader" is used at the moment the mapping is -defined. Changing "mapleader" after that has no effect for already defined +Note that the value of "g:mapleader" is used at the moment the mapping is +defined. Changing "g:mapleader" after that has no effect for already defined mappings. ** *maplocalleader* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index cd9d7bd806..762a84224e 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4843,7 +4843,7 @@ A jump table for the options with a short description can be found at |Q_op|. help. (Note that previously setting the global option to the empty value did this, which is now deprecated.) When the first character is ":", the command is invoked as a Vim - Ex command prefixed with [count]. + Ex command with [count] added as an argument if it is not zero. When "man", "man -s" or an Ex command is used, Vim will automatically translate a count for the "K" command and pass it as the first argument. For "man -s" the "-s" is removed when there is no count. diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 2b1897fe10..71c752ac42 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -3918,7 +3918,7 @@ netrw: * Installed |g:netrw_clipboard| setting * Installed option bypass for |'guioptions'| a/A settings - * Changed popup_beval() to |popup_atcursor|() + * Changed popup_beval() to |popup_atcursor()| in netrw#ErrorMsg (lacygoill). Apparently popup_beval doesn't reliably close the popup when the mouse is moved. diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index d0d9c35da6..f9d0b66982 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -231,7 +231,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. Examples: > :4,5source :10,18source ++clear - +< *:source!* :so[urce]! {file} Read Vim commands from {file}. These are commands that are executed from Normal mode, like you type diff --git a/runtime/doc/tags b/runtime/doc/tags index ad35a71227..df1a64fb8d 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -10228,6 +10228,7 @@ undo undo.txt /*undo* undo-blocks undo.txt /*undo-blocks* undo-branches undo.txt /*undo-branches* undo-break undo.txt /*undo-break* +undo-close-block undo.txt /*undo-close-block* undo-commands undo.txt /*undo-commands* undo-persistence undo.txt /*undo-persistence* undo-redo undo.txt /*undo-redo* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 594e83c505..20dbce9547 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -38,6 +38,20 @@ browser use: https://github.com/vim/vim/issues/1234 *known-bugs* -------------------- Known bugs and current work ----------------------- +PR to consider: +- Fix CTRL-[ for Win32 on Belgian keyboard #10687 (closes #10454) +- stricter parsing for has('patch-x.y.z') #10752 +- cmdheight=0 #10675 Does it work properly? +- add splitscroll #10682 Useful? Any trouble? Null Chilly says it's OK. + suggestion: names instead of numbers for the option value + +Support virtual text: +- clear b_textprop_text when buffer is cleared +- Remove and free text when textprop is removed with negative ID. +- "gj" does not work correctly +- placement at the end of the line: after the text (text_align: "end"), right + aligned (text_align: "right") + Further Vim9 improvements, possibly after launch: - Use Vim9 for more runtime files. - Check performance with callgrind and kcachegrind. @@ -224,6 +238,10 @@ entry separately. #6609 Multiplexers (screen, tmux) can request it to the underlying terminal, and pass it on with modifications. +When scheme can't be found by configure there is no clear "not found" message: + configure:5769: checking MzScheme install prefix + configure:5781: result: + Can "CSI nr X" be used instead of outputting spaces? Is it faster? #8002 Typed keys invisible after calling interrupt() from a timer. #10631 @@ -1160,9 +1178,6 @@ cmap using execute() has side effects. (Killthemule, 2016 Aug 17, #983) Patch to order results from taglist(). (Duncan McDougall, 2016 Oct 25) -Syntax highlighting for messages with RFC3339 timestamp (#946) -Did maintainer reply? - ml_get errors when reloading file. (Chris Desjardins, 2016 Apr 19) Also with latest version. @@ -3761,6 +3776,7 @@ Syntax highlighting: - use TextMate, vscode uses it. #9087 - Other people don't like it. Vscode is asked to switch to treesitter: https://github.com/microsoft/vscode/issues/50140 + - sublime grammar? 8 Make ":syn off" use 'runtimepath' instead of $VIMRUNTIME. (Gary Johnson) Should do the same for ":syn on" and ":syn manual". 8 Support "containedin" argument for ":syn include", so that the defined diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt index 34d8054333..cc33482473 100644 --- a/runtime/doc/undo.txt +++ b/runtime/doc/undo.txt @@ -105,13 +105,13 @@ change again. But you can do something like this: > After this a "u" command will undo the delete command and the previous change. - *undo-break* -To do the opposite, break a change into two undo blocks, in Insert mode use -CTRL-G u. This is useful if you want an insert command to be undoable in + *undo-break* *undo-close-block* +To do the opposite, use a new undo block for the next change, in Insert mode +use CTRL-G u. This is useful if you want an insert command to be undoable in parts. E.g., for each sentence. |i_CTRL-G_u| -Setting the value of 'undolevels' also breaks undo. Even when the new value -is equal to the old value. In |Vim9| script: > +Setting the value of 'undolevels' also closes the undo block. Even when the +new value is equal to the old value. In |Vim9| script: > &undolevels = &undolevels In legacy script: > let &undolevels = &undolevels diff --git a/runtime/ftplugin/bitbake.vim b/runtime/ftplugin/bitbake.vim new file mode 100644 index 0000000000..99fe334627 --- /dev/null +++ b/runtime/ftplugin/bitbake.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin file +" Language: Bitbake +" Maintainer: Gregory Anders +" Repository: https://github.com/openembedded/bitbake +" Latest Revision: 2022-07-23 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=#%s +setlocal comments=:# +setlocal suffixesadd=.bb,.bbclass + +let b:undo_ftplugin = "setl cms< com< sua<" diff --git a/runtime/ftplugin/expect.vim b/runtime/ftplugin/expect.vim new file mode 100644 index 0000000000..a4c6af96ce --- /dev/null +++ b/runtime/ftplugin/expect.vim @@ -0,0 +1,24 @@ +" Vim filetype plugin file +" Language: Expect +" Maintainer: Doug Kearns +" Last Change: 2022 Jul 16 + +if exists("b:did_ftplugin") + finish +endif + +" Syntax is similar to Tcl +runtime! ftplugin/tcl.vim + +let s:cpo_save = &cpo +set cpo&vim + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Expect Command Files (*.exp)\t*.exp\n" .. + \ "All Files (*.*)\t*.*\n" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8 diff --git a/runtime/ftplugin/html.vim b/runtime/ftplugin/html.vim index 3179aa2e88..94cb62653f 100644 --- a/runtime/ftplugin/html.vim +++ b/runtime/ftplugin/html.vim @@ -1,16 +1,14 @@ " Vim filetype plugin file -" Language: html -" -" This runtime file is looking for a new maintainer. -" -" Former maintainer: Dan Sharp -" Last Changed: 20 Jan 2009 - -if exists("b:did_ftplugin") | finish | endif +" Language: HTML +" Maintainer: Doug Kearns +" Previous Maintainer: Dan Sharp +" Last Changed: 2022 Jul 20 + +if exists("b:did_ftplugin") + finish +endif let b:did_ftplugin = 1 -" Make sure the continuation lines below do not cause problems in -" compatibility mode. let s:save_cpo = &cpo set cpo-=C @@ -18,36 +16,40 @@ setlocal matchpairs+=<:> setlocal commentstring= setlocal comments=s: -if exists("g:ft_html_autocomment") && (g:ft_html_autocomment == 1) - setlocal formatoptions-=t formatoptions+=croql +let b:undo_ftplugin = "setlocal comments< commentstring< matchpairs<" + +if get(g:, "ft_html_autocomment", 0) + setlocal formatoptions-=t formatoptions+=croql + let b:undo_ftplugin ..= " | setlocal formatoptions<" endif if exists('&omnifunc') setlocal omnifunc=htmlcomplete#CompleteTags call htmlcomplete#DetectOmniFlavor() + let b:undo_ftplugin ..= " | setlocal omnifunc<" endif -" HTML: thanks to Johannes Zellner and Benji Fisher. -if exists("loaded_matchit") - let b:match_ignorecase = 1 - let b:match_words = '<:>,' . - \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' . - \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' . - \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' +" HTML: thanks to Johannes Zellner and Benji Fisher. +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_ignorecase = 1 + let b:match_words = ',' .. + \ '<:>,' .. + \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .. + \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .. + \ '<\@<=\([^/!][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' + let b:html_set_match_words = 1 + let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words b:html_set_match_words" endif " Change the :browse e filter to primarily show HTML-related files. -if has("gui_win32") - let b:browsefilter="HTML Files (*.html,*.htm)\t*.htm;*.html\n" . - \ "JavaScript Files (*.js)\t*.js\n" . - \ "Cascading StyleSheets (*.css)\t*.css\n" . - \ "All Files (*.*)\t*.*\n" +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "HTML Files (*.html *.htm)\t*.htm;*.html\n" .. + \ "JavaScript Files (*.js)\t*.js\n" .. + \ "Cascading StyleSheets (*.css)\t*.css\n" .. + \ "All Files (*.*)\t*.*\n" + let b:html_set_browsefilter = 1 + let b:undo_ftplugin ..= " | unlet! b:browsefilter b:html_set_browsefilter" endif -" Undo the stuff we changed. -let b:undo_ftplugin = "setlocal commentstring< matchpairs< omnifunc< comments< formatoptions<" . - \ " | unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter" - -" Restore the saved compatibility options. let &cpo = s:save_cpo unlet s:save_cpo diff --git a/runtime/indent/bitbake.vim b/runtime/indent/bitbake.vim new file mode 100644 index 0000000000..f45ba74816 --- /dev/null +++ b/runtime/indent/bitbake.vim @@ -0,0 +1,22 @@ +" Vim indent file +" Language: BitBake +" Copyright: Copyright (C) 2019 Agilent Technologies, Inc. +" Maintainer: Chris Laplante +" License: You may redistribute this under the same terms as Vim itself + +if exists("b:did_indent") + finish +endif + +runtime! indent/sh.vim + +setlocal indentexpr=bitbake#Indent(v:lnum) +setlocal autoindent +setlocal nolisp +setlocal shiftwidth=4 +setlocal expandtab +setlocal indentkeys+=<:>,=elif,=except,0=\" + +let b:undo_indent .= ' inde< ai< lisp< sw< et< indk<' + +let b:did_indent = 1 diff --git a/runtime/indent/expect.vim b/runtime/indent/expect.vim new file mode 100644 index 0000000000..f2a1f05917 --- /dev/null +++ b/runtime/indent/expect.vim @@ -0,0 +1,11 @@ +" Vim indent file +" Language: Expect +" Maintainer: Doug Kearns +" Last Change: 2022 Jul 16 + +if exists("b:did_indent") + finish +endif + +" Syntax is similar to Tcl +runtime! indent/tcl.vim diff --git a/runtime/indent/python.vim b/runtime/indent/python.vim index 668122993e..8c3d0b0670 100644 --- a/runtime/indent/python.vim +++ b/runtime/indent/python.vim @@ -14,7 +14,7 @@ let b:did_indent = 1 setlocal nolisp " Make sure lisp indenting doesn't supersede us setlocal autoindent " indentexpr isn't much help otherwise -setlocal indentexpr=GetPythonIndent(v:lnum) +setlocal indentexpr=python#GetIndent(v:lnum) setlocal indentkeys+=<:>,=elif,=except let b:undo_indent = "setl ai< inde< indk< lisp<" @@ -23,206 +23,11 @@ let b:undo_indent = "setl ai< inde< indk< lisp<" if exists("*GetPythonIndent") finish endif -let s:keepcpo= &cpo -set cpo&vim - -" Come here when loading the script the first time. - -let s:maxoff = 50 " maximum number of lines to look backwards for () - -" See if the specified line is already user-dedented from the expected value. -function s:Dedented(lnum, expected) - return indent(a:lnum) <= a:expected - shiftwidth() -endfunction +" Keep this for backward compatibility, new scripts should use +" python#GetIndent() function GetPythonIndent(lnum) - - " If this line is explicitly joined: If the previous line was also joined, - " line it up with that one, otherwise add two 'shiftwidth' - if getline(a:lnum - 1) =~ '\\$' - if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$' - return indent(a:lnum - 1) - endif - return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (shiftwidth() * 2)) - endif - - " If the start of the line is in a string don't change the indent. - if has('syntax_items') - \ && synIDattr(synID(a:lnum, 1, 1), "name") =~ "String$" - return -1 - endif - - " Search backwards for the previous non-empty line. - let plnum = prevnonblank(v:lnum - 1) - - if plnum == 0 - " This is the first non-empty line, use zero indent. - return 0 - endif - - call cursor(plnum, 1) - - " Identing inside parentheses can be very slow, regardless of the searchpair() - " timeout, so let the user disable this feature if he doesn't need it - let disable_parentheses_indenting = get(g:, "pyindent_disable_parentheses_indenting", 0) - - if disable_parentheses_indenting == 1 - let plindent = indent(plnum) - let plnumstart = plnum - else - " searchpair() can be slow sometimes, limit the time to 150 msec or what is - " put in g:pyindent_searchpair_timeout - let searchpair_stopline = 0 - let searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150) - - " If the previous line is inside parenthesis, use the indent of the starting - " line. - " Trick: use the non-existing "dummy" variable to break out of the loop when - " going too far back. - let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW', - \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if parlnum > 0 - let plindent = indent(parlnum) - let plnumstart = parlnum - else - let plindent = indent(plnum) - let plnumstart = plnum - endif - - " When inside parenthesis: If at the first line below the parenthesis add - " two 'shiftwidth', otherwise same as previous line. - " i = (a - " + b - " + c) - call cursor(a:lnum, 1) - let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', - \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if p > 0 - if p == plnum - " When the start is inside parenthesis, only indent one 'shiftwidth'. - let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', - \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if pp > 0 - return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) - endif - return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2)) - endif - if plnumstart == p - return indent(plnum) - endif - return plindent - endif - - endif - - - " Get the line and remove a trailing comment. - " Use syntax highlighting attributes when possible. - let pline = getline(plnum) - let pline_len = strlen(pline) - if has('syntax_items') - " If the last character in the line is a comment, do a binary search for - " the start of the comment. synID() is slow, a linear search would take - " too long on a long line. - if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)$" - let min = 1 - let max = pline_len - while min < max - let col = (min + max) / 2 - if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)$" - let max = col - else - let min = col + 1 - endif - endwhile - let pline = strpart(pline, 0, min - 1) - endif - else - let col = 0 - while col < pline_len - if pline[col] == '#' - let pline = strpart(pline, 0, col) - break - endif - let col = col + 1 - endwhile - endif - - " If the previous line ended with a colon, indent this line - if pline =~ ':\s*$' - return plindent + shiftwidth() - endif - - " If the previous line was a stop-execution statement... - if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>' - " See if the user has already dedented - if s:Dedented(a:lnum, indent(plnum)) - " If so, trust the user - return -1 - endif - " If not, recommend one dedent - return indent(plnum) - shiftwidth() - endif - - " If the current line begins with a keyword that lines up with "try" - if getline(a:lnum) =~ '^\s*\(except\|finally\)\>' - let lnum = a:lnum - 1 - while lnum >= 1 - if getline(lnum) =~ '^\s*\(try\|except\)\>' - let ind = indent(lnum) - if ind >= indent(a:lnum) - return -1 " indent is already less than this - endif - return ind " line up with previous try or except - endif - let lnum = lnum - 1 - endwhile - return -1 " no matching "try"! - endif - - " If the current line begins with a header keyword, dedent - if getline(a:lnum) =~ '^\s*\(elif\|else\)\>' - - " Unless the previous line was a one-liner - if getline(plnumstart) =~ '^\s*\(for\|if\|elif\|try\)\>' - return plindent - endif - - " Or the user has already dedented - if s:Dedented(a:lnum, plindent) - return -1 - endif - - return plindent - shiftwidth() - endif - - " When after a () construct we probably want to go back to the start line. - " a = (b - " + c) - " here - if parlnum > 0 - " ...unless the user has already dedented - if s:Dedented(a:lnum, plindent) - return -1 - else - return plindent - endif - endif - - return -1 - + return python#GetIndent(a:lnum) endfunction -let &cpo = s:keepcpo -unlet s:keepcpo - " vim:sw=2 diff --git a/runtime/indent/testdir/bitbake.in b/runtime/indent/testdir/bitbake.in new file mode 100644 index 0000000000..afd19be182 --- /dev/null +++ b/runtime/indent/testdir/bitbake.in @@ -0,0 +1,19 @@ +# vim: set filetype=bitbake : + +# START_INDENT +FOO = " \ + bar \ + baz \ + qux \ + " + +do_configure() { +oe_conf +} + +python do_task() { +def foo(x): +if y: +print(x) +} +# END_INDENT diff --git a/runtime/indent/testdir/bitbake.ok b/runtime/indent/testdir/bitbake.ok new file mode 100644 index 0000000000..1bc5a18c6f --- /dev/null +++ b/runtime/indent/testdir/bitbake.ok @@ -0,0 +1,19 @@ +# vim: set filetype=bitbake : + +# START_INDENT +FOO = " \ + bar \ + baz \ + qux \ +" + +do_configure() { + oe_conf +} + +python do_task() { + def foo(x): + if y: + print(x) +} +# END_INDENT diff --git a/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim b/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim index b53261f097..04b48b9ce8 100644 --- a/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim +++ b/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim @@ -15,89 +15,89 @@ let s:cpo_save = &cpo set cpo&vim -imenu Stmts.for for in dodoneki kk0elli -imenu Stmts.case case in) ;;esacbki k0elli -imenu Stmts.if if thenfiki kk0elli -imenu Stmts.if-else if thenelsefiki kki kk0elli -imenu Stmts.elif elif thenki kk0elli -imenu Stmts.while while dodoneki kk0elli -imenu Stmts.break break -imenu Stmts.continue continue -imenu Stmts.function () {}ki k0i -imenu Stmts.return return -imenu Stmts.return-true return 0 -imenu Stmts.return-false return 1 -imenu Stmts.exit exit -imenu Stmts.shift shift -imenu Stmts.trap trap -imenu Test.existence [ -e ]hi -imenu Test.existence\ -\ file [ -f ]hi -imenu Test.existence\ -\ file\ (not\ empty) [ -s ]hi -imenu Test.existence\ -\ directory [ -d ]hi -imenu Test.existence\ -\ executable [ -x ]hi -imenu Test.existence\ -\ readable [ -r ]hi -imenu Test.existence\ -\ writable [ -w ]hi -imenu Test.String\ is\ empty [ x = "x$" ]hhi -imenu Test.String\ is\ not\ empty [ x != "x$" ]hhi -imenu Test.Strings\ is\ equal [ "" = "" ]hhhhhhhi -imenu Test.Strings\ is\ not\ equal [ "" != "" ]hhhhhhhhi -imenu Test.Values\ is\ greater\ than [ -gt ]hhhhhhi -imenu Test.Values\ is\ greater\ equal [ -ge ]hhhhhhi -imenu Test.Values\ is\ equal [ -eq ]hhhhhhi -imenu Test.Values\ is\ not\ equal [ -ne ]hhhhhhi -imenu Test.Values\ is\ less\ than [ -lt ]hhhhhhi -imenu Test.Values\ is\ less\ equal [ -le ]hhhhhhi -imenu ParmSub.Substitute\ word\ if\ parm\ not\ set ${:-}hhi -imenu ParmSub.Set\ parm\ to\ word\ if\ not\ set ${:=}hhi -imenu ParmSub.Substitute\ word\ if\ parm\ set\ else\ nothing ${:+}hhi -imenu ParmSub.If\ parm\ not\ set\ print\ word\ and\ exit ${:?}hhi -imenu SpShVars.Number\ of\ positional\ parameters ${#} -imenu SpShVars.All\ positional\ parameters\ (quoted\ spaces) ${*} -imenu SpShVars.All\ positional\ parameters\ (unquoted\ spaces) ${@} -imenu SpShVars.Flags\ set ${-} -imenu SpShVars.Return\ code\ of\ last\ command ${?} -imenu SpShVars.Process\ number\ of\ this\ shell ${$} -imenu SpShVars.Process\ number\ of\ last\ background\ command ${!} -imenu Environ.HOME ${HOME} -imenu Environ.PATH ${PATH} -imenu Environ.CDPATH ${CDPATH} -imenu Environ.MAIL ${MAIL} -imenu Environ.MAILCHECK ${MAILCHECK} -imenu Environ.PS1 ${PS1} -imenu Environ.PS2 ${PS2} -imenu Environ.IFS ${IFS} -imenu Environ.SHACCT ${SHACCT} -imenu Environ.SHELL ${SHELL} -imenu Environ.LC_CTYPE ${LC_CTYPE} -imenu Environ.LC_MESSAGES ${LC_MESSAGES} -imenu Builtins.cd cd -imenu Builtins.echo echo -imenu Builtins.eval eval -imenu Builtins.exec exec -imenu Builtins.export export -imenu Builtins.getopts getopts -imenu Builtins.hash hash -imenu Builtins.newgrp newgrp -imenu Builtins.pwd pwd -imenu Builtins.read read -imenu Builtins.readonly readonly -imenu Builtins.return return -imenu Builtins.times times -imenu Builtins.type type -imenu Builtins.umask umask -imenu Builtins.wait wait -imenu Set.set set -imenu Set.unset unset -imenu Set.mark\ modified\ or\ modified\ variables set -a -imenu Set.exit\ when\ command\ returns\ non-zero\ exit\ code set -e -imenu Set.Disable\ file\ name\ generation set -f -imenu Set.remember\ function\ commands set -h -imenu Set.All\ keyword\ arguments\ are\ placed\ in\ the\ environment set -k -imenu Set.Read\ commands\ but\ do\ not\ execute\ them set -n -imenu Set.Exit\ after\ reading\ and\ executing\ one\ command set -t -imenu Set.Treat\ unset\ variables\ as\ an\ error\ when\ substituting set -u -imenu Set.Print\ shell\ input\ lines\ as\ they\ are\ read set -v -imenu Set.Print\ commands\ and\ their\ arguments\ as\ they\ are\ executed set -x +imenu ShellMenu.Statements.for for in dodoneki kk0elli +imenu ShellMenu.Statements.case case in) ;;esacbki k0elli +imenu ShellMenu.Statements.if if thenfiki kk0elli +imenu ShellMenu.Statements.if-else if thenelsefiki kki kk0elli +imenu ShellMenu.Statements.elif elif thenki kk0elli +imenu ShellMenu.Statements.while while dodoneki kk0elli +imenu ShellMenu.Statements.break break +imenu ShellMenu.Statements.continue continue +imenu ShellMenu.Statements.function () {}ki k0i +imenu ShellMenu.Statements.return return +imenu ShellMenu.Statements.return-true return 0 +imenu ShellMenu.Statements.return-false return 1 +imenu ShellMenu.Statements.exit exit +imenu ShellMenu.Statements.shift shift +imenu ShellMenu.Statements.trap trap +imenu ShellMenu.Test.Existence [ -e ]hi +imenu ShellMenu.Test.Existence\ -\ file [ -f ]hi +imenu ShellMenu.Test.Existence\ -\ file\ (not\ empty) [ -s ]hi +imenu ShellMenu.Test.Existence\ -\ directory [ -d ]hi +imenu ShellMenu.Test.Existence\ -\ executable [ -x ]hi +imenu ShellMenu.Test.Existence\ -\ readable [ -r ]hi +imenu ShellMenu.Test.Existence\ -\ writable [ -w ]hi +imenu ShellMenu.Test.String\ is\ empty [ x = "x$" ]hhi +imenu ShellMenu.Test.String\ is\ not\ empty [ x != "x$" ]hhi +imenu ShellMenu.Test.Strings\ are\ equal [ "" = "" ]hhhhhhhi +imenu ShellMenu.Test.Strings\ are\ not\ equal [ "" != "" ]hhhhhhhhi +imenu ShellMenu.Test.Value\ is\ greater\ than [ -gt ]hhhhhhi +imenu ShellMenu.Test.Value\ is\ greater\ equal [ -ge ]hhhhhhi +imenu ShellMenu.Test.Values\ are\ equal [ -eq ]hhhhhhi +imenu ShellMenu.Test.Values\ are\ not\ equal [ -ne ]hhhhhhi +imenu ShellMenu.Test.Value\ is\ less\ than [ -lt ]hhhhhhi +imenu ShellMenu.Test.Value\ is\ less\ equal [ -le ]hhhhhhi +imenu ShellMenu.ParmSub.Substitute\ word\ if\ parm\ not\ set ${:-}hhi +imenu ShellMenu.ParmSub.Set\ parm\ to\ word\ if\ not\ set ${:=}hhi +imenu ShellMenu.ParmSub.Substitute\ word\ if\ parm\ set\ else\ nothing ${:+}hhi +imenu ShellMenu.ParmSub.If\ parm\ not\ set\ print\ word\ and\ exit ${:?}hhi +imenu ShellMenu.SpShVars.Number\ of\ positional\ parameters ${#} +imenu ShellMenu.SpShVars.All\ positional\ parameters\ (quoted\ spaces) ${*} +imenu ShellMenu.SpShVars.All\ positional\ parameters\ (unquoted\ spaces) ${@} +imenu ShellMenu.SpShVars.Flags\ set ${-} +imenu ShellMenu.SpShVars.Return\ code\ of\ last\ command ${?} +imenu ShellMenu.SpShVars.Process\ number\ of\ this\ shell ${$} +imenu ShellMenu.SpShVars.Process\ number\ of\ last\ background\ command ${!} +imenu ShellMenu.Environ.HOME ${HOME} +imenu ShellMenu.Environ.PATH ${PATH} +imenu ShellMenu.Environ.CDPATH ${CDPATH} +imenu ShellMenu.Environ.MAIL ${MAIL} +imenu ShellMenu.Environ.MAILCHECK ${MAILCHECK} +imenu ShellMenu.Environ.PS1 ${PS1} +imenu ShellMenu.Environ.PS2 ${PS2} +imenu ShellMenu.Environ.IFS ${IFS} +imenu ShellMenu.Environ.SHACCT ${SHACCT} +imenu ShellMenu.Environ.SHELL ${SHELL} +imenu ShellMenu.Environ.LC_CTYPE ${LC_CTYPE} +imenu ShellMenu.Environ.LC_MESSAGES ${LC_MESSAGES} +imenu ShellMenu.Builtins.cd cd +imenu ShellMenu.Builtins.echo echo +imenu ShellMenu.Builtins.eval eval +imenu ShellMenu.Builtins.exec exec +imenu ShellMenu.Builtins.export export +imenu ShellMenu.Builtins.getopts getopts +imenu ShellMenu.Builtins.hash hash +imenu ShellMenu.Builtins.newgrp newgrp +imenu ShellMenu.Builtins.pwd pwd +imenu ShellMenu.Builtins.read read +imenu ShellMenu.Builtins.readonly readonly +imenu ShellMenu.Builtins.return return +imenu ShellMenu.Builtins.times times +imenu ShellMenu.Builtins.type type +imenu ShellMenu.Builtins.umask umask +imenu ShellMenu.Builtins.wait wait +imenu ShellMenu.Set.set set +imenu ShellMenu.Set.unset unset +imenu ShellMenu.Set.Mark\ created\ or\ modified\ variables\ for\ export set -a +imenu ShellMenu.Set.Exit\ when\ command\ returns\ non-zero\ status set -e +imenu ShellMenu.Set.Disable\ file\ name\ expansion set -f +imenu ShellMenu.Set.Locate\ and\ remember\ commands\ when\ being\ looked\ up set -h +imenu ShellMenu.Set.All\ assignment\ statements\ are\ placed\ in\ the\ environment\ for\ a\ command set -k +imenu ShellMenu.Set.Read\ commands\ but\ do\ not\ execute\ them set -n +imenu ShellMenu.Set.Exit\ after\ reading\ and\ executing\ one\ command set -t +imenu ShellMenu.Set.Treat\ unset\ variables\ as\ an\ error\ when\ substituting set -u +imenu ShellMenu.Set.Print\ shell\ input\ lines\ as\ they\ are\ read set -v +imenu ShellMenu.Set.Print\ commands\ and\ their\ arguments\ as\ they\ are\ executed set -x " Restore the previous value of 'cpoptions'. let &cpo = s:cpo_save diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index 06e37258e7..dd191d8299 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -13,6 +13,10 @@ def SetSyn(name: string) g:use_fvwm_2 = name == "fvwm2" filetype = "fvwm" endif + if name == "whitespace" + " do not replace the filetype but add whitespace on top + filetype = &ft .. ".whitespace" + endif if !exists("s:syntax_menu_synonly") exe "set ft=" .. filetype if exists("g:syntax_manual") diff --git a/runtime/syntax/bitbake.vim b/runtime/syntax/bitbake.vim new file mode 100644 index 0000000000..30f34474ad --- /dev/null +++ b/runtime/syntax/bitbake.vim @@ -0,0 +1,126 @@ +" Vim syntax file +" Language: BitBake bb/bbclasses/inc +" Author: Chris Larson +" Ricardo Salveti +" Copyright: Copyright (C) 2004 Chris Larson +" Copyright (C) 2008 Ricardo Salveti +" +" This file is licensed under the MIT license, see COPYING.MIT in +" this source distribution for the terms. +" +" Syntax highlighting for bb, bbclasses and inc files. +" +" It's an entirely new type, just has specific syntax in shell and python code + +if v:version < 600 + finish +endif +if exists("b:current_syntax") + finish +endif + +syn include @python syntax/python.vim +unlet! b:current_syntax + +" BitBake syntax + +" Matching case +syn case match + +" Indicates the error when nothing is matched +syn match bbUnmatched "." + +" Comments +syn cluster bbCommentGroup contains=bbTodo,@Spell +syn keyword bbTodo COMBAK FIXME TODO XXX contained +syn match bbComment "#.*$" contains=@bbCommentGroup + +" String helpers +syn match bbQuote +['"]+ contained +syn match bbDelimiter "[(){}=]" contained +syn match bbArrayBrackets "[\[\]]" contained + +" BitBake strings +syn match bbContinue "\\$" +syn region bbString matchgroup=bbQuote start=+"+ skip=+\\$+ end=+"+ contained contains=bbTodo,bbContinue,bbVarDeref,bbVarPyValue,@Spell +syn region bbString matchgroup=bbQuote start=+'+ skip=+\\$+ end=+'+ contained contains=bbTodo,bbContinue,bbVarDeref,bbVarPyValue,@Spell + +" Vars definition +syn match bbExport "^export" nextgroup=bbIdentifier skipwhite +syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite +syn match bbIdentifier "[a-zA-Z0-9\-_\.\/\+]\+" display contained +syn match bbVarDeref "${[a-zA-Z0-9\-_:\.\/\+]\+}" contained +syn match bbVarEq "\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)" contained nextgroup=bbVarValue +syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.\/\+][${}a-zA-Z0-9\-_:\.\/\+]*\)\s*\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbOverrideOperator,bbVarDeref nextgroup=bbVarEq +syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref,bbVarPyValue +syn region bbVarPyValue start=+${@+ skip=+\\$+ end=+}+ contained contains=@python + +" Vars metadata flags +syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.+]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag +syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(:=\|=\|.=\|=.|+=\|=+\|?=\)\@=" contained contains=bbIdentifier nextgroup=bbVarEq + +" Includes and requires +syn keyword bbInclude inherit include require contained +syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref +syn match bbIncludeLine "^\(inherit\|include\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest + +" Add taks and similar +syn keyword bbStatement addtask deltask addhandler after before EXPORT_FUNCTIONS contained +syn match bbStatementRest ".*$" skipwhite contained contains=bbStatement +syn match bbStatementLine "^\(addtask\|deltask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest + +" OE Important Functions +syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained + +" Generic Functions +syn match bbFunction "\h[0-9A-Za-z_\-\.]*" display contained contains=bbOEFunctions + +syn keyword bbOverrideOperator append prepend remove contained + +" BitBake shell metadata +syn include @shell syntax/sh.vim +unlet! b:current_syntax + +syn keyword bbShFakeRootFlag fakeroot contained +syn match bbShFuncDef "^\(fakeroot\s*\)\?\([\.0-9A-Za-z_:${}\-\.]\+\)\(python\)\@ -" Previous Maintainer: Claudio Fleiner -" Repository: https://notabug.org/jorgesumle/vim-html-syntax -" Last Change: 2021 Mar 02 -" Included patch #7900 to fix comments -" Included patch #7916 to fix a few more things -" +" Language: HTML +" Maintainer: Doug Kearns +" Previous Maintainers: Jorge Maldonado Ventura +" Claudio Fleiner +" Last Change: 2022 Jul 20 " Please check :help html.vim for some comments and a description of the options @@ -23,6 +20,9 @@ set cpo&vim syntax spell toplevel +syn include @htmlXml syntax/xml.vim +unlet b:current_syntax + syn case ignore " mark illegal characters @@ -30,13 +30,13 @@ syn match htmlError "[<>&]" " tags -syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc -syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc -syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=javaScriptExpression,@htmlPreproc -syn region htmlEndTag start=++ contains=htmlTagN,htmlTagError -syn region htmlTag start=+<[^/]+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster -syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster -syn match htmlTagN contained +][^ \t>]*"hs=s+1 contains=javaScriptExpression,@htmlPreproc +syn region htmlEndTag start=++ contains=htmlTagN,htmlTagError +syn region htmlTag start=+<[^/]+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster +syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster +syn match htmlTagN contained +]<"ms=s+1 @@ -47,13 +47,13 @@ syn keyword htmlTagName contained cite code dd dfn dir div dl dt font syn keyword htmlTagName contained form hr html img syn keyword htmlTagName contained input isindex kbd li link map menu syn keyword htmlTagName contained meta ol option param pre p samp span -syn keyword htmlTagName contained select small sub sup +syn keyword htmlTagName contained select small strike sub sup syn keyword htmlTagName contained table td textarea th tr tt ul var xmp -syn match htmlTagName contained "\<\(b\|i\|u\|h[1-6]\|em\|strong\|head\|body\|title\)\>" +syn match htmlTagName contained "\<\%(b\|i\|u\|h[1-6]\|em\|strong\|head\|body\|title\)\>" " new html 4.0 tags -syn keyword htmlTagName contained abbr acronym bdo button col label -syn keyword htmlTagName contained colgroup fieldset iframe ins legend +syn keyword htmlTagName contained abbr acronym bdo button col colgroup +syn keyword htmlTagName contained del fieldset iframe ins label legend syn keyword htmlTagName contained object optgroup q s tbody tfoot thead " new html 5 tags @@ -65,6 +65,15 @@ syn keyword htmlTagName contained progress rb rp rt rtc ruby section syn keyword htmlTagName contained slot source summary template time track syn keyword htmlTagName contained video wbr +" svg and math tags +syn keyword htmlMathTagName contained math +syn keyword htmlSvgTagName contained svg + +syn region htmlMath start="" end="" contains=@htmlXml transparent keepend +syn region htmlSvg start="" end="" contains=@htmlXml transparent keepend + +syn cluster xmlTagHook add=htmlMathTagName,htmlSvgTagName + " legal arg names syn keyword htmlArg contained action syn keyword htmlArg contained align alink alt archive background bgcolor @@ -77,7 +86,7 @@ syn keyword htmlArg contained marginwidth maxlength method name prompt syn keyword htmlArg contained rel rev rows rowspan scrolling selected shape syn keyword htmlArg contained size src start target text type url syn keyword htmlArg contained usemap ismap valign value vlink vspace width wrap -syn match htmlArg contained "\<\(http-equiv\|href\|title\)="me=e-1 +syn match htmlArg contained "\<\%(http-equiv\|href\|title\)="me=e-1 " aria attributes exe 'syn match htmlArg contained "\" +syn keyword htmlArg contained frameborder noresize pagex pagey above below +syn keyword htmlArg contained left top visibility clip id noshade +syn match htmlArg contained "\" " Microsoft extensions syn keyword htmlTagName contained marquee " html 4.0 arg names -syn match htmlArg contained "\<\(accept-charset\|label\)\>" +syn match htmlArg contained "\<\%(accept-charset\|label\)\>" syn keyword htmlArg contained abbr acce