From 6237ac84024f048ec60475276fbf0663d9d17879 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 30 Jul 2022 15:48:32 +0200 Subject: [PATCH] vim-patch:2ecbe53f452e (#19577) Update runtime files https://github.com/vim/vim/commit/2ecbe53f452e92e941aff623f6a0b72f80e43d07 --- runtime/doc/builtin.txt | 4 +- runtime/doc/change.txt | 2 + runtime/doc/spell.txt | 2 +- runtime/ftplugin/debchangelog.vim | 95 +++++++++++++++++-------------- runtime/ftplugin/desktop.vim | 13 +++++ runtime/ftplugin/swayconfig.vim | 16 ++++++ runtime/indent/html.vim | 2 +- runtime/indent/javascript.vim | 6 ++ runtime/syntax/autohotkey.vim | 17 +++--- runtime/syntax/debchangelog.vim | 12 ++-- runtime/syntax/debsources.vim | 12 ++-- runtime/syntax/i3config.vim | 12 +++- runtime/syntax/python.vim | 10 +++- runtime/syntax/swayconfig.vim | 92 ++++++++++++++++++++++++++++++ 14 files changed, 225 insertions(+), 70 deletions(-) create mode 100644 runtime/ftplugin/desktop.vim create mode 100644 runtime/ftplugin/swayconfig.vim create mode 100644 runtime/syntax/swayconfig.vim diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 668c738e0a..9d33c442c2 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -4907,8 +4907,8 @@ 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. 3 is reserved for use by the - |matchparen| plugin. + respectively. 3 is reserved for use by the |matchparen| + plugin. If the {id} argument is not specified or -1, |matchadd()| automatically chooses a free ID. diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index b905f53db7..a4ff4474e6 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -765,6 +765,8 @@ When the {string} starts with "\=" it is evaluated as an expression, see |sub-replace-expression|. You can use that for complex replacement or special characters. +The substitution is limited in recursion to 4 levels. *E1290* + Otherwise these characters in {string} have a special meaning: magic nomagic action ~ diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index bc45b0e511..23d5905ec3 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -92,7 +92,7 @@ zuW *zuG* *zuW* zuG Undo |zW| and |zG|, remove the word from the internal word list. Count used as with |zg|. - *:spe* *:spellgood* + *:spe* *:spellgood* *E1280* :[count]spe[llgood] {word} Add {word} as a good word to 'spellfile', like with |zg|. Without count the first name is used, with a diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim index a78f7811f1..cf8dd17c44 100644 --- a/runtime/ftplugin/debchangelog.vim +++ b/runtime/ftplugin/debchangelog.vim @@ -1,9 +1,9 @@ " Vim filetype plugin file (GUI menu, folding and completion) " Language: Debian Changelog -" Maintainer: Debian Vim Maintainers +" Maintainer: Debian Vim Maintainers " Former Maintainers: Michael Piefel " Stefano Zacchiroli -" Last Change: 2018-01-28 +" Last Change: 2022 Jul 25 " License: Vim License " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/debchangelog.vim @@ -35,6 +35,11 @@ if exists('g:did_changelog_ftplugin') finish endif +" Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise +" would not be recognized. See ":help 'cpoptions'". +let s:cpo_save = &cpo +set cpo&vim + " Don't load another plugin (this is global) let g:did_changelog_ftplugin = 1 @@ -101,13 +106,13 @@ endfunction " These functions implement the menus function NewVersion() " The new entry is unfinalised and shall be changed - amenu disable Changelog.New\ Version - amenu enable Changelog.Add\ Entry - amenu enable Changelog.Close\ Bug - amenu enable Changelog.Set\ Distribution - amenu enable Changelog.Set\ Urgency - amenu disable Changelog.Unfinalise - amenu enable Changelog.Finalise + amenu disable &Changelog.&New\ Version + amenu enable &Changelog.&Add\ Entry + amenu enable &Changelog.&Close\ Bug + amenu enable &Changelog.Set\ &Distribution + amenu enable &Changelog.Set\ &Urgency + amenu disable &Changelog.U&nfinalise + amenu enable &Changelog.&Finalise call append(0, substitute(getline(1), '-\([[:digit:]]\+\))', '-$$\1)', '')) call append(1, '') call append(2, '') @@ -117,7 +122,9 @@ function NewVersion() normal! 1G0 call search(')') normal! h - normal!  + " ':normal' doens't support key annotation () directly. + " Vim's manual recommends using ':exe' to use key annotation indirectly (backslash-escaping needed though). + exe "normal! \" call setline(1, substitute(getline(1), '-\$\$', '-', '')) if exists('g:debchangelog_fold_enable') foldopen @@ -161,13 +168,13 @@ endfunction function UnfinaliseMenu() " This means the entry shall be changed - amenu disable Changelog.New\ Version - amenu enable Changelog.Add\ Entry - amenu enable Changelog.Close\ Bug - amenu enable Changelog.Set\ Distribution - amenu enable Changelog.Set\ Urgency - amenu disable Changelog.Unfinalise - amenu enable Changelog.Finalise + amenu disable &Changelog.&New\ Version + amenu enable &Changelog.&Add\ Entry + amenu enable &Changelog.&Close\ Bug + amenu enable &Changelog.Set\ &Distribution + amenu enable &Changelog.Set\ &Urgency + amenu disable &Changelog.U&nfinalise + amenu enable &Changelog.&Finalise endfunction function Unfinalise() @@ -179,13 +186,13 @@ endfunction function FinaliseMenu() " This means the entry should not be changed anymore - amenu enable Changelog.New\ Version - amenu disable Changelog.Add\ Entry - amenu disable Changelog.Close\ Bug - amenu disable Changelog.Set\ Distribution - amenu disable Changelog.Set\ Urgency - amenu enable Changelog.Unfinalise - amenu disable Changelog.Finalise + amenu enable &Changelog.&New\ Version + amenu disable &Changelog.&Add\ Entry + amenu disable &Changelog.&Close\ Bug + amenu disable &Changelog.Set\ &Distribution + amenu disable &Changelog.Set\ &Urgency + amenu enable &Changelog.U&nfinalise + amenu disable &Changelog.&Finalise endfunction function Finalise() @@ -198,26 +205,26 @@ endfunction function MakeMenu() amenu &Changelog.&New\ Version :call NewVersion() - amenu Changelog.&Add\ Entry :call AddEntry() - amenu Changelog.&Close\ Bug :call CloseBug() - menu Changelog.-sep- + amenu &Changelog.&Add\ Entry :call AddEntry() + amenu &Changelog.&Close\ Bug :call CloseBug() + menu &Changelog.-sep- - amenu Changelog.Set\ &Distribution.&unstable :call Distribution("unstable") - amenu Changelog.Set\ Distribution.&frozen :call Distribution("frozen") - amenu Changelog.Set\ Distribution.&stable :call Distribution("stable") - menu Changelog.Set\ Distribution.-sep- - amenu Changelog.Set\ Distribution.frozen\ unstable :call Distribution("frozen unstable") - amenu Changelog.Set\ Distribution.stable\ unstable :call Distribution("stable unstable") - amenu Changelog.Set\ Distribution.stable\ frozen :call Distribution("stable frozen") - amenu Changelog.Set\ Distribution.stable\ frozen\ unstable :call Distribution("stable frozen unstable") + amenu &Changelog.Set\ &Distribution.&unstable :call Distribution("unstable") + amenu &Changelog.Set\ &Distribution.&frozen :call Distribution("frozen") + amenu &Changelog.Set\ &Distribution.&stable :call Distribution("stable") + menu &Changelog.Set\ &Distribution.-sep- + amenu &Changelog.Set\ &Distribution.frozen\ unstable :call Distribution("frozen unstable") + amenu &Changelog.Set\ &Distribution.stable\ unstable :call Distribution("stable unstable") + amenu &Changelog.Set\ &Distribution.stable\ frozen :call Distribution("stable frozen") + amenu &Changelog.Set\ &Distribution.stable\ frozen\ unstable :call Distribution("stable frozen unstable") - amenu Changelog.Set\ &Urgency.&low :call Urgency("low") - amenu Changelog.Set\ Urgency.&medium :call Urgency("medium") - amenu Changelog.Set\ Urgency.&high :call Urgency("high") + amenu &Changelog.Set\ &Urgency.&low :call Urgency("low") + amenu &Changelog.Set\ &Urgency.&medium :call Urgency("medium") + amenu &Changelog.Set\ &Urgency.&high :call Urgency("high") - menu Changelog.-sep- - amenu Changelog.U&nfinalise :call Unfinalise() - amenu Changelog.&Finalise :call Finalise() + menu &Changelog.-sep- + amenu &Changelog.U&nfinalise :call Unfinalise() + amenu &Changelog.&Finalise :call Finalise() if Finalised() call FinaliseMenu() @@ -228,7 +235,7 @@ endfunction augroup changelogMenu au BufEnter * if &filetype == "debchangelog" | call MakeMenu() | endif -au BufLeave * if &filetype == "debchangelog" | silent! aunmenu Changelog | endif +au BufLeave * if &filetype == "debchangelog" | silent! aunmenu &Changelog | endif augroup END " }}} @@ -380,4 +387,8 @@ setlocal omnifunc=DebCompleteBugs " }}} +" Restore the previous value of 'cpoptions'. +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: set foldmethod=marker: diff --git a/runtime/ftplugin/desktop.vim b/runtime/ftplugin/desktop.vim new file mode 100644 index 0000000000..bd6fd7097c --- /dev/null +++ b/runtime/ftplugin/desktop.vim @@ -0,0 +1,13 @@ +" Vim filetype plugin file +" Language: XDG desktop entry +" Maintainer: Eisuke Kawashima ( e.kawaschima+vim AT gmail.com ) +" Last Change: 2022-07-26 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = v:true + +setl comments=:# +setl commentstring=#%s +let b:undo_ftplugin = 'setl com< cms<' diff --git a/runtime/ftplugin/swayconfig.vim b/runtime/ftplugin/swayconfig.vim new file mode 100644 index 0000000000..45d6bdb3e5 --- /dev/null +++ b/runtime/ftplugin/swayconfig.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin file +" Language: sway config file +" Original Author: James Eapen +" Maintainer: James Eapen +" Version: 0.1 +" Last Change: 2022 June 07 + +if exists("b:did_ftplugin") + finish +endif + +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setlocal cms<" + +setlocal commentstring=#\ %s diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index a3c32d6342..65e0ffc40c 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -600,7 +600,7 @@ func s:Alien3() endif if b:hi_indent.scripttype == "javascript" " indent for further lines - return eval(b:hi_js1indent) + GetJavascriptIndent() + return GetJavascriptIndent() else return -1 endif diff --git a/runtime/indent/javascript.vim b/runtime/indent/javascript.vim index f3bf96aa97..8077442ed0 100644 --- a/runtime/indent/javascript.vim +++ b/runtime/indent/javascript.vim @@ -473,6 +473,12 @@ function GetJavascriptIndent() elseif num return s:Nat(num_ind + get(l:,'case_offset',s:sw()) + l:switch_offset + b_l + is_op) endif + + let nest = get(get(b:, 'hi_indent', {}), 'blocklnr') + if nest + return indent(nextnonblank(nest + 1)) + b_l + is_op + endif + return b_l + is_op endfunction diff --git a/runtime/syntax/autohotkey.vim b/runtime/syntax/autohotkey.vim index c6a68f7a21..a888394923 100644 --- a/runtime/syntax/autohotkey.vim +++ b/runtime/syntax/autohotkey.vim @@ -2,7 +2,7 @@ " Language: AutoHotkey script file " Maintainer: Michael Wong " https://github.com/mmikeww/autohotkey.vim -" Latest Revision: 2017-04-03 +" Latest Revision: 2022-07-25 " Previous Maintainers: SungHyun Nam " Nikolai Weibull @@ -31,7 +31,7 @@ syn region autohotkeyString \ matchgroup=autohotkeyStringDelimiter \ start=+"+ \ end=+"+ - \ contains=autohotkeyEscape + \ contains=autohotkeyEscape,autohotkeyMatchClass syn match autohotkeyVariable \ display @@ -49,9 +49,9 @@ syn keyword autohotkeyBuiltinVariable \ A_Sec A_MSec A_Now A_NowUTC A_TickCount \ A_IsSuspended A_IsPaused A_IsCritical A_BatchLines A_TitleMatchMode A_TitleMatchModeSpeed \ A_DetectHiddenWindows A_DetectHiddenText A_AutoTrim A_StringCaseSense - \ A_FileEncoding A_FormatInteger A_FormatFloat A_KeyDelay A_WinDelay A_ControlDelay - \ A_SendMode A_SendLevel A_StoreCapsLockMode A_KeyDelay A_KeyDelayDuration - \ A_KeyDelayPlay A_KeyDelayPlayDuration A_MouseDelayPlay + \ A_FileEncoding A_FormatInteger A_FormatFloat A_WinDelay A_ControlDelay + \ A_SendMode A_SendLevel A_StoreCapsLockMode A_KeyDelay A_KeyDuration + \ A_KeyDelayPlay A_KeyDurationPlay A_MouseDelayPlay \ A_MouseDelay A_DefaultMouseSpeed A_RegView A_IconHidden A_IconTip A_IconFile \ A_CoordModeToolTip A_CoordModePixel A_CoordModeMouse A_CoordModeCaret A_CoordModeMenu \ A_IconNumber @@ -73,6 +73,7 @@ syn keyword autohotkeyBuiltinVariable \ A_LoopFileShortName A_LoopFileDir A_LoopFileTimeModified A_LoopFileTimeCreated \ A_LoopFileTimeAccessed A_LoopFileAttrib A_LoopFileSize A_LoopFileSizeKB A_LoopFileSizeMB \ A_LoopRegType A_LoopRegKey A_LoopRegSubKey A_LoopRegTimeModified + \ A_TimeIdleKeyboard A_TimeIdleMouse A_ListLines A_ComSpec A_LoopFilePath A_Args syn match autohotkeyBuiltinVariable \ contained @@ -118,6 +119,7 @@ syn keyword autohotkeyCommand \ WinMinimizeAll WinMinimizeAllUndo WinMove WinRestore WinSet \ WinSetTitle WinShow WinWait WinWaitActive WinWaitNotActive WinWaitClose \ SetCapsLockState SetNumLockState SetScrollLockState + \ Hotstring LoadPicture MenuGetHandle MenuGetName OnError OnClipboardChange syn keyword autohotkeyFunction \ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr Func @@ -127,7 +129,7 @@ syn keyword autohotkeyFunction \ IsFunc Trim LTrim RTrim IsObject Object Array FileOpen \ ComObjActive ComObjArray ComObjConnect ComObjCreate ComObjGet \ ComObjError ComObjFlags ComObjQuery ComObjType ComObjValue ComObject - \ Format Exception + \ Format Exception Ord InputHook syn keyword autohotkeyStatement \ Break Continue Exit ExitApp Gosub Goto OnExit Pause Return @@ -140,7 +142,8 @@ syn keyword autohotkeyConditional \ IfExist IfNotExist If IfEqual IfLess IfGreater Else \ IfWinExist IfWinNotExist IfWinActive IfWinNotActive \ IfNotEqual IfLessOrEqual IfGreaterOrEqual - \ while until for in try catch finally + \ while until for in try catch finally not + \ switch case default syn match autohotkeyPreProcStart \ nextgroup= diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index 2efd919772..9bd836801e 100644 --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -3,7 +3,7 @@ " Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs " Wichert Akkerman -" Last Change: 2022 May 01 +" Last Change: 2022 Jul 25 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim " Standard syntax initialization @@ -20,22 +20,22 @@ let s:binNMU='binary-only=yes' let s:cpo = &cpo set cpo-=C let s:supported = [ - \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', - \ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', - \ 'trixie', 'sid', 'rc-buggy', + \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy', + \ 'buster', 'bullseye', 'bookworm', 'trixie', \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'impish', 'jammy', 'kinetic', + \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'kinetic', \ 'devel' \ ] let s:unsupported = [ \ 'frozen', 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze', 'wheezy', + \ 'jessie', 'stretch', \ \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic', - \ 'disco', 'eoan', 'hirsute', 'groovy' + \ 'disco', 'eoan', 'hirsute', 'impish', 'groovy' \ ] let &cpo=s:cpo diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index e3ec6e6598..ea9e59ea8e 100644 --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -2,7 +2,7 @@ " Language: Debian sources.list " Maintainer: Debian Vim Maintainers " Former Maintainer: Matthijs Mohlmann -" Last Change: 2022 May 01 +" Last Change: 2022 Jul 25 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim " Standard syntax initialization @@ -22,22 +22,22 @@ syn match debsourcesComment /#.*/ contains=@Spell let s:cpo = &cpo set cpo-=C let s:supported = [ - \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', - \ 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', - \ 'trixie', 'sid', 'rc-buggy', + \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy', + \ 'buster', 'bullseye', 'bookworm', 'trixie', \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'impish', 'jammy', 'kinetic', + \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'kinetic', \ 'devel' \ ] let s:unsupported = [ \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze', 'wheezy', + \ 'jessie', 'stretch', \ \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic', - \ 'disco', 'eoan', 'hirsute', 'groovy' + \ 'disco', 'eoan', 'hirsute', 'impish', 'groovy' \ ] let &cpo=s:cpo diff --git a/runtime/syntax/i3config.vim b/runtime/syntax/i3config.vim index 0018081da7..caef244ce5 100644 --- a/runtime/syntax/i3config.vim +++ b/runtime/syntax/i3config.vim @@ -17,6 +17,9 @@ endif scriptencoding utf-8 +" Error +syn match i3ConfigError /.*/ + " Todo syn keyword i3ConfigTodo TODO FIXME XXX contained @@ -54,8 +57,8 @@ syn match i3ConfigInclude /^\s*include\s\+.*$/ contains=i3ConfigIncludeKeyword,i " Gaps syn keyword i3ConfigGapStyleKeyword inner outer horizontal vertical top right bottom left current all set plus minus toggle up down contained syn match i3ConfigGapStyle /^\s*\(gaps\)\s\+\(inner\|outer\|horizontal\|vertical\|left\|top\|right\|bottom\)\(\s\+\(current\|all\)\)\?\(\s\+\(set\|plus\|minus\|toggle\)\)\?\(\s\+\(-\?\d\+\|\$.*\)\)$/ contains=i3ConfigGapStyleKeyword,i3ConfigNumber,i3ConfigVariable -syn keyword i3ConfigSmartGapKeyword on inverse_outer contained -syn match i3ConfigSmartGap /^\s*smart_gaps\s\+\(on\|inverse_outer\)\s\?$/ contains=i3ConfigSmartGapKeyword +syn keyword i3ConfigSmartGapKeyword on inverse_outer off contained +syn match i3ConfigSmartGap /^\s*smart_gaps\s\+\(on\|inverse_outer\|off\)\s\?$/ contains=i3ConfigSmartGapKeyword syn keyword i3ConfigSmartBorderKeyword on no_gaps contained syn match i3ConfigSmartBorder /^\s*smart_borders\s\+\(on\|no_gaps\)\s\?$/ contains=i3ConfigSmartBorderKeyword @@ -74,7 +77,7 @@ syn match i3ConfigBind /^\s*\(bindsym\|bindcode\)\s\+.*$/ contains=i3ConfigVaria syn keyword i3ConfigSizeSpecial x contained syn match i3ConfigNegativeSize /-/ contained syn match i3ConfigSize /-\?\d\+\s\?x\s\?-\?\d\+/ contained contains=i3ConfigSizeSpecial,i3ConfigNumber,i3ConfigNegativeSize -syn match i3ConfigFloating /^\s*floating_modifier\s\+\$\w\+\d\?/ contains=i3ConfigVariable +syn match i3ConfigFloatingModifier /^\s*floating_modifier\s\+\$\w\+\d\?/ contains=i3ConfigVariable syn match i3ConfigFloating /^\s*floating_\(maximum\|minimum\)_size\s\+-\?\d\+\s\?x\s\?-\?\d\+/ contains=i3ConfigSize " Orientation @@ -183,6 +186,7 @@ syn region i3ConfigBlock start=+^\s*[^#]*s\?{$+ end=+^\s*[^#]*}$+ contains=i3Con syn region i3ConfigLineCont start=/^.*\\$/ end=/^.*$/ contains=i3ConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend " Define the highlighting. +hi def link i3ConfigError Error hi def link i3ConfigTodo Todo hi def link i3ConfigComment Comment hi def link i3ConfigFontContent Type @@ -213,6 +217,7 @@ hi def link i3ConfigTimeUnit Constant hi def link i3ConfigModifier Constant hi def link i3ConfigString Constant hi def link i3ConfigNegativeSize Constant +hi def link i3ConfigInclude Constant hi def link i3ConfigFontSeparator Special hi def link i3ConfigVariableModifier Special hi def link i3ConfigSizeSpecial Special @@ -233,6 +238,7 @@ hi def link i3ConfigLayout Identifier hi def link i3ConfigBorderStyle Identifier hi def link i3ConfigEdge Identifier hi def link i3ConfigFloating Identifier +hi def link i3ConfigFloatingModifier Identifier hi def link i3ConfigCommandKeyword Identifier hi def link i3ConfigNoFocusKeyword Identifier hi def link i3ConfigInitializeKeyword Identifier diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index 2293163a5b..ef4da1b448 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic -" Last Change: 2021 Dec 10 +" Last Change: 2022 Jun 28 " Credits: Neil Schemenauer " Dmitry Vasiliev " @@ -84,13 +84,19 @@ syn keyword pythonStatement as assert break continue del global syn keyword pythonStatement lambda nonlocal pass return with yield syn keyword pythonStatement class def nextgroup=pythonFunction skipwhite syn keyword pythonConditional elif else if -syn keyword pythonConditional case match syn keyword pythonRepeat for while syn keyword pythonOperator and in is not or syn keyword pythonException except finally raise try syn keyword pythonInclude from import syn keyword pythonAsync async await +" Soft keywords +" These keywords do not mean anything unless used in the right context +" See https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords +" for more on this. +syn match pythonConditional "^\s*\zscase\%(\s\+.*:.*$\)\@=" +syn match pythonConditional "^\s*\zsmatch\%(\s\+.*:\s*\%(#.*\)\=$\)\@=" + " Decorators " A dot must be allowed because of @MyClass.myfunc decorators. syn match pythonDecorator "@" display contained diff --git a/runtime/syntax/swayconfig.vim b/runtime/syntax/swayconfig.vim new file mode 100644 index 0000000000..2abfa38bd9 --- /dev/null +++ b/runtime/syntax/swayconfig.vim @@ -0,0 +1,92 @@ +" Vim syntax file +" Language: sway window manager config +" Original Author: James Eapen +" Maintainer: James Eapen +" Version: 0.11.0 +" Last Change: 2022 Jun 07 + +" References: +" http://i3wm.org/docs/userguide.html#configuring +" https://github.com/swaywm/sway/blob/b69d637f7a34e239e48a4267ae94a5e7087b5834/sway/sway.5.scd +" http://vimdoc.sourceforge.net/htmldoc/syntax.html +" +" +" Quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +runtime! syntax/i3config.vim + +scriptencoding utf-8 + +" Error +"syn match swayConfigError /.*/ + +" Group mode/bar +syn keyword swayConfigBlockKeyword set input contained +syn region swayConfigBlock start=+.*s\?{$+ end=+^}$+ contains=i3ConfigBlockKeyword,swayConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend + +" binding +syn keyword swayConfigBindKeyword bindswitch bindgesture contained +syn match swayConfigBind /^\s*\(bindswitch\)\s\+.*$/ contains=i3ConfigVariable,i3ConfigBindKeyword,swayConfigBindKeyword,i3ConfigVariableAndModifier,i3ConfigNumber,i3ConfigUnit,i3ConfigUnitOr,i3ConfigBindArgument,i3ConfigModifier,i3ConfigAction,i3ConfigString,i3ConfigGapStyleKeyword,i3ConfigBorderStyleKeyword + +" bindgestures +syn keyword swayConfigBindGestureCommand swipe pinch hold contained +syn keyword swayConfigBindGestureDirection up down left right next prev contained +syn keyword swayConfigBindGesturePinchDirection inward outward clockwise counterclockwise contained +syn match swayConfigBindGestureHold /^\s*\(bindgesture\)\s\+hold\(:[1-5]\)\?\s\+.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,i3ConfigWorkspaceKeyword,i3ConfigAction +syn match swayConfigBindGestureSwipe /^\s*\(bindgesture\)\s\+swipe\(:[1-5]\)\?:\(up\|down\|left\|right\)\s\+.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,i3ConfigWorkspaceKeyword,i3ConfigAction +syn match swayConfigBindGesturePinch /^\s*\(bindgesture\)\s\+\(pinch\):.*$/ contains=swayConfigBindKeyword,swayConfigBindGestureCommand,swayConfigBindGestureDirection,swayConfigBindGesturePinchDirection,i3ConfigWorkspaceKeyword,i3ConfigAction + +" floating +syn keyword swayConfigFloatingKeyword floating contained +syn match swayConfigFloating /^\s*floating\s\+\(enable\|disable\|toggle\)\s*$/ contains=swayConfigFloatingKeyword + +syn clear i3ConfigFloatingModifier +syn keyword swayConfigFloatingModifier floating_modifier contained +syn match swayConfigFloatingMouseAction /^\s\?.*floating_modifier\s.*\(normal\|inverted\)$/ contains=swayConfigFloatingModifier,i3ConfigVariable + +" Gaps +syn clear i3ConfigSmartBorderKeyword +syn clear i3ConfigSmartBorder +syn keyword swayConfigSmartBorderKeyword on no_gaps off contained +syn match swayConfigSmartBorder /^\s*smart_borders\s\+\(on\|no_gaps\|off\)\s\?$/ contains=swayConfigSmartBorderKeyword + +" Changing colors +syn keyword swayConfigClientColorKeyword focused_tab_title contained +syn match swayConfigClientColor /^\s*client.\w\+\s\+.*$/ contains=i3ConfigClientColorKeyword,i3ConfigColor,i3ConfigVariable,i3ConfigClientColorKeyword,swayConfigClientColorKeyword + +" set display outputs +syn match swayConfigOutput /^\s*output\s\+.*$/ contains=i3ConfigOutput + +" set display focus +syn keyword swayConfigFocusKeyword focus contained +syn keyword swayConfigFocusType output contained +syn match swayConfigFocus /^\s*focus\soutput\s.*$/ contains=swayConfigFocusKeyword,swayConfigFocusType + +" xwayland +syn keyword swayConfigXwaylandKeyword xwayland contained +syn match swayConfigXwaylandModifier /^\s*xwayland\s\+\(enable\|disable\|force\)\s\?$/ contains=swayConfigXwaylandKeyword + +"hi def link swayConfigError Error +hi def link i3ConfigFloating Error +hi def link swayConfigFloating Type +hi def link swayConfigFloatingMouseAction Type +hi def link swayConfigFocusKeyword Type +hi def link swayConfigSmartBorderKeyword Type +hi def link swayConfigBindGestureCommand Identifier +hi def link swayConfigBindGestureDirection Constant +hi def link swayConfigBindGesturePinchDirection Constant +hi def link swayConfigBindKeyword Identifier +hi def link swayConfigBlockKeyword Identifier +hi def link swayConfigClientColorKeyword Identifier +hi def link swayConfigFloatingKeyword Identifier +hi def link swayConfigFloatingModifier Identifier +hi def link swayConfigFocusType Identifier +hi def link swayConfigSmartBorder Identifier +hi def link swayConfigXwaylandKeyword Identifier +hi def link swayConfigXwaylandModifier Type +hi def link swayConfigBindGesture PreProc + +let b:current_syntax = "swayconfig"