Commit: runtime(screen): Bring the syntax up to version 5

0 views
Skip to first unread message

Christian Brabandt

unread,
4:45 PM (5 hours ago) 4:45 PM
to vim...@googlegroups.com
runtime(screen): Bring the syntax up to version 5

Commit: https://github.com/vim/vim/commit/a65741c8b38aa5d57f9e5e7f1a960a63a466efb5
Author: Aliaksei Budavei <0x00...@gmail.com>
Date: Wed Jul 1 20:38:10 2026 +0000

runtime(screen): Bring the syntax up to version 5

* Match command names introduced in v.5.0.0 (August 2024):
"auth", "multiinput", "status", "truecolor".
* Match command names introduced in v.4.5.0 (January 2017):
"defdynamictitle" and "dynamictitle".
* Deprecate command names that have been retired thus far:
"debug", "maxwin", "nethack", "password", "time".
* Remove a spurious "defzombie" command name (this name is
just lamented over in the documentation entry for the
"zombie" command as being more fitting than "zombie"
because its effects are not local to a window; no such
name is entered in "comm.c").
* Separately group the Braille navigation commands, "bd_*",
that may belong to another, superset program Dotscreen:
(see doc/README.DOTSCREEN and commit 848af83f5 elsewhere).
* Revise string escape characters:
- Recognise more characters, "%[`<>=eEfFHOPSxX]".
- Recognise undocumented characters, "%[gNpT]", and list
relevant Screen commits in the comments.
- Match optional qualifiers, "%\%([-+L]\|\d\+\).".
* Match more items in double-quoted command arguments.
* Match unquoted environment variable references.
* Match octal numbers, e.g. "defmode 0622".
* Match escaped octal numbers, e.g. "bind ? help".

Unless a Dotscreen program (c. 1995) or an older than
v.4.3.1 (c. 2015) Screen program, that was compiled with
"HAVE_BRAILLE" defined, is installed and needs configuring,
add to ".vim/after/syntax/screen.vim":
-----------------------------------------------------------
if hlexists('dotscreenCommands')
syn clear dotscreenCommands
endif
-----------------------------------------------------------

To BACKPORT the updated syntax file to version 4 of Screen,
add to ".vim/after/syntax/screen.vim":
-----------------------------------------------------------
if hlexists('screenDeprecatedCommands')
syn clear screenDeprecatedCommands
endif

if hlexists('screenVersion5Commands')
syn clear screenVersion5Commands
endif
-----------------------------------------------------------

References:
https://lists.gnu.org/archive/html/info-gnu/2024-08/msg00004.html
https://lists.gnu.org/archive/html/info-gnu/2017-01/msg00007.html
https://git.savannah.gnu.org/git/screen.git

closes: #20550

Co-authored-by: Dmitri Vereshchagin <dmitri.ve...@gmail.com>
Signed-off-by: Aliaksei Budavei <0x00...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS
index 86de71b23..072f69aeb 100644
--- a/.github/MAINTAINERS
+++ b/.github/MAINTAINERS
@@ -686,6 +686,7 @@ runtime/syntax/salt.vim @gpanders
runtime/syntax/sass.vim @tpope
runtime/syntax/scala.vim @derekwyatt
runtime/syntax/scheme.vim @evhan
+runtime/syntax/screen.vim @zzzyxwvut
runtime/syntax/scss.vim @tpope
runtime/syntax/sed.vim @dkearns
runtime/syntax/sgf.vim @lykahb
diff --git a/runtime/syntax/screen.vim b/runtime/syntax/screen.vim
index d576d29b7..11ebc981d 100644
--- a/runtime/syntax/screen.vim
+++ b/runtime/syntax/screen.vim
@@ -1,8 +1,9 @@
" Vim syntax file
" Language: screen(1) configuration file
-" Maintainer: Dmitri Vereshchagin <dmitri.ve...@gmail.com>
-" Previous Maintainer: Nikolai Weibull <n...@bitwi.se>
-" Latest Revision: 2015-09-24
+" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
+" Previous Maintainers: Dmitri Vereshchagin <dmitri.ve...@gmail.com>
+" Nikolai Weibull <n...@bitwi.se>
+" Latest Revision: 2026 Jun 29

if exists("b:current_syntax")
finish
@@ -11,7 +12,7 @@ endif
let s:cpo_save = &cpo
set cpo&vim

-syn match screenEscape '\.'
+syn match screenEscape '\.' contains=screenOctalNumber

syn keyword screenTodo contained TODO FIXME XXX NOTE

@@ -19,18 +20,29 @@ syn region screenComment display oneline start='#' end='$'
\ contains=screenTodo,@Spell

syn region screenString display oneline start=+"+ skip=+\"+ end=+"+
- \ contains=screenVariable,screenSpecial
+ \ contains=screenVariable,screenSpecials,screenEscape

syn region screenLiteral display oneline start=+'+ skip=+\'+ end=+'+

-syn match screenVariable contained display '$\%(\h\w*\|{\h\w*}\)'
+syn match screenVariable display '$\%(\h\w*\|{\h\w*}\)'

syn keyword screenBoolean on off

-syn match screenNumbers display '\<\d\+\>'
+syn match screenDecimalNumber display '\<\d\+\>'
+syn match screenOctalNumber display '\<0\o\+\>'

-syn match screenSpecials contained
- \ '%\%([%aAdDhlmMstuwWyY?:{]\|[0-9]*n\|0?cC\)'
+" FIXME: Undocumented escape characters (winmsg.h): "g" (see commit
+" 945ad5414), "N" (49f592e21), "p" (6ead6f557), "T" (60893c465).
+syn region screenSpecials contained start=+%{+ end=+}+
+syn match screenSpecials contained '%[%aAdeEfFghHlmNPsStTuxXyY?:]'
+syn match screenSpecials contained '%\d*[n`=<>]' contains=screenSpecialsQualifier
+syn match screenSpecials contained '%0\?[cC]' contains=screenSpecialsQualifier
+syn match screenSpecials contained '%L\?[DMW]' contains=screenSpecialsQualifier
+syn match screenSpecials contained '%-\?O' contains=screenSpecialsQualifier
+syn match screenSpecials contained '%+\?p' contains=screenSpecialsQualifier
+syn match screenSpecials contained '%[-+]\?L\?[w=<>]' contains=screenSpecialsQualifier
+syn match screenSpecialsQualifier contained '\d\+'
+syn match screenSpecialsQualifier contained '[-+L]'

syn keyword screenCommands
\ acladd
@@ -48,26 +60,6 @@ syn keyword screenCommands
\ autonuke
\ backtick
\ bce
- \ bd_bc_down
- \ bd_bc_left
- \ bd_bc_right
- \ bd_bc_up
- \ bd_bell
- \ bd_braille_table
- \ bd_eightdot
- \ bd_info
- \ bd_link
- \ bd_lower_left
- \ bd_lower_right
- \ bd_ncrc
- \ bd_port
- \ bd_scroll
- \ bd_skip
- \ bd_start_braille
- \ bd_type
- \ bd_upper_left
- \ bd_upper_right
- \ bd_width
\ bell
\ bell_msg
\ bind
@@ -99,6 +91,7 @@ syn keyword screenCommands
\ defbreaktype
\ defc1
\ defcharset
+ \ defdynamictitle
\ defencoding
\ defescape
\ defflow
@@ -119,12 +112,12 @@ syn keyword screenCommands
\ defutf8
\ defwrap
\ defwritelock
- \ defzombie
\ detach
\ digraph
\ dinfo
\ displays
\ dumptermcap
+ \ dynamictitle
\ echo
\ encoding
\ escape
@@ -243,6 +236,43 @@ syn keyword screenCommands
\ zombie
\ zombie_timeout

+syn keyword screenVersion5Commands
+ \ auth
+ \ multiinput
+ \ status
+ \ truecolor
+
+" Braille navigation commands from a superset program Dotscreen (see some
+" descriptions in doc/README.DOTSCREEN).
+syn keyword dotscreenCommands
+ \ bd_bc_down
+ \ bd_bc_left
+ \ bd_bc_right
+ \ bd_bc_up
+ \ bd_bell
+ \ bd_braille_table
+ \ bd_eightdot
+ \ bd_info
+ \ bd_link
+ \ bd_lower_left
+ \ bd_lower_right
+ \ bd_ncrc
+ \ bd_port
+ \ bd_scroll
+ \ bd_skip
+ \ bd_start_braille
+ \ bd_type
+ \ bd_upper_left
+ \ bd_upper_right
+ \ bd_width
+
+syn keyword screenDeprecatedCommands
+ \ debug
+ \ maxwin
+ \ nethack
+ \ password
+ \ time
+
hi def link screenEscape Special
hi def link screenComment Comment
hi def link screenTodo Todo
@@ -251,10 +281,17 @@ hi def link screenLiteral String
hi def link screenVariable Identifier
hi def link screenBoolean Boolean
hi def link screenNumbers Number
+hi def link screenDecimalNumber screenNumbers
+hi def link screenOctalNumber screenNumbers
hi def link screenSpecials Special
hi def link screenCommands Keyword
+hi def link screenSpecialsQualifier Underlined
+hi def link screenVersion5Commands screenCommands
+hi def link dotscreenCommands screenCommands

let b:current_syntax = "screen"

let &cpo = s:cpo_save
unlet s:cpo_save
+
+" vim: sw=2 et
diff --git a/runtime/syntax/testdir/dumps/screen_00.dump b/runtime/syntax/testdir/dumps/screen_00.dump
new file mode 100644
index 000000000..d26efc547
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/screen_00.dump
@@ -0,0 +1,20 @@
+>#+0#0000e05#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |c|a|l@1| |D|e|f|e|r|R|e|n|a|m|i|n|g|T|e|s|t|F|i|l|e|T|o|(|'|s|c|r|e@1|n|r|c|'|)| +0#0000000&@17
+|#+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i| |l|i|n|k| |s|c|r|e@1|n|L|i|t|e|r|a|l| |V|i|s|u|a|l| +0#0000000&@29
+@75
+@75
+@75
+@75
+@75
+@75
+|a+0#af5f00255&|l|t|s|c|r|e@1|n| +0#0000000&@6|o+0#e000002&|n| +0#0000000&@56
+|b+0#af5f00255&|a|c|k|t|i|c|k| +0#0000000&|0+0#e000002&| +0#0000000&@1|5+0#e000002&| +0#0000000&@1|5+0#e000002&| +0#0000000&|/|u|s|r|/|b|i|n|/|t|r|u|e| |f|o@1| |b|a|r| |b|a|z| @32
+|b+0#af5f00255&|a|c|k|t|i|c|k| +0#0000000&|1+0#e000002&| +0#0000000&|6+0#e000002&|0| +0#0000000&|6+0#e000002&|0| +0#0000000&|/|u|s|r|/|b|i|n|/|m|a|w|k| |'+0#0000001#a8a8a8255|{|p|r|i|n|t| |$|1|,| |$|2|,| |$|3|,| |$|4|}|'| +0#0000000#ffffff0|/|d|e|v|/|n|u|l@1| @9
+|b+0#af5f00255&|a|c|k|t|i|c|k| +0#0000000&|2+0#e000002&| +0#0000000&|6+0#e000002&|0| +0#0000000&|6+0#e000002&|0| +0#0000000&|/|u|s|r|/|b|i|n|/|m|a|w|k| |'+0#0000001#a8a8a8255|{|p|r|i|n|t| |$|1|,| |$|2|,| |$|3|,| |$|4|}|'| +0#0000000#ffffff0|/|d|e|v|/|n|u|l@1| @9
+|#+0#0000e05&| |N+0#0000001#ffff4012|O|T|E|:+0#0000e05#ffffff0| |s|e@1| |`|l|i|n|u|x|-|s|o|u|r|c|e|/|f|s|/|p|r|o|c|/|p|r|o|c|_|m|i|s|c|.|c|'| |f|o|r| |d|e|t|a|i|l|s|.| +0#0000000&@15
+|b+0#af5f00255&|a|c|k|t|i|c|k| +0#0000000&|3+0#e000002&| +0#0000000&|6+0#e000002&|0| +0#0000000&|6+0#e000002&|0| +0#0000000&|/|u|s|r|/|b|i|n|/|m|a|w|k| |'+0#0000001#a8a8a8255|{|i|f|(|$|1|=@1|"|M|e|m|T|o|t|a|l|:|"|)| |m|t|=|$|2|;| |e|l|s|e| |i|f|(|$|1|=@1|"|M|e
+|m|F|r|e@1|:|"|)| |m|f|=|$|2|;| |e|l|s|e| |i|f|(|$|1|=@1|"|B|u|f@1|e|r|s|:|"|)| |m|b|=|$|2|;| |e|l|s|e| |i|f|(|$|1|=@1|"|C|a|c|h|e|d|:|"|)| |m|c|=|$|2
+|;| |e|l|s|e| |i|f|(|$|1|=@1|"|S|w|a|p|T|o|t|a|l|:|"|)| |s|t|=|$|2|;| |e|l|s|e| |i|f|(|$|1|=@1|"|S|w|a|p|F|r|e@1|:|"|)| |{|s|f|=|$|2|;| |e|x|i|t| |0|}
+@1|E|N|D|{|p|=|1|0@1|/|m|t|;| |p|r|i|n|t|f|(|"|%|.|1|f|%@1|U| |%|.|1|f|%@1|F| |%|.|1|f|%@1|B| |%|.|1|f|%@1|C| |%|.|1|f|%@1|S|"|,| |(|m|t|-|(|m|f|+|m|b
+|+|m|c|)@1|*|p|,| |m|f|*|p|,| |m|b|*|p|,| |m|c|*|p|,| |(|s|t|-|s|f|)|*|1|0@1|/|s|t|)|}|'| +0#0000000#ffffff0|/|p|r|o|c|/|m|e|m|i|n|f|o| @16
+|b+0#af5f00255&|i|n|d| +0#0000000&@11|\+0#e000e06&|0+0#e000002&|4|1| +0#0000000&@3|h+0#af5f00255&|e|l|p| +0#0000000&@46
+@57|1|,|1| @10|T|o|p|
diff --git a/runtime/syntax/testdir/dumps/screen_01.dump b/runtime/syntax/testdir/dumps/screen_01.dump
new file mode 100644
index 000000000..4d2c0886f
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/screen_01.dump
@@ -0,0 +1,20 @@
+|b+0#af5f00255#ffffff0|a|c|k|t|i|c|k| +0#0000000&|3+0#e000002&| +0#0000000&|6+0#e000002&|0| +0#0000000&|6+0#e000002&|0| +0#0000000&|/|u|s|r|/|b|i|n|/|m|a|w|k| |'+0#0000001#a8a8a8255|{|i|f|(|$|1|=@1|"|M|e|m|T|o|t|a|l|:|"|)| |m|t|=|$|2|;| |e|l|s|e| |i|f|(|$|1|=@1|"|M|e
+|m|F|r|e@1|:|"|)| |m|f|=|$|2|;| |e|l|s|e| |i|f|(|$|1|=@1|"|B|u|f@1|e|r|s|:|"|)| |m|b|=|$|2|;| |e|l|s|e| |i|f|(|$|1|=@1|"|C|a|c|h|e|d|:|"|)| |m|c|=|$|2
+|;| |e|l|s|e| |i|f|(|$|1|=@1|"|S|w|a|p|T|o|t|a|l|:|"|)| |s|t|=|$|2|;| |e|l|s|e| |i|f|(|$|1|=@1|"|S|w|a|p|F|r|e@1|:|"|)| |{|s|f|=|$|2|;| |e|x|i|t| |0|}
+@1|E|N|D|{|p|=|1|0@1|/|m|t|;| |p|r|i|n|t|f|(|"|%|.|1|f|%@1|U| |%|.|1|f|%@1|F| |%|.|1|f|%@1|B| |%|.|1|f|%@1|C| |%|.|1|f|%@1|S|"|,| |(|m|t|-|(|m|f|+|m|b
+|+|m|c|)@1|*|p|,| |m|f|*|p|,| |m|b|*|p|,| |m|c|*|p|,| |(|s|t|-|s|f|)|*|1|0@1|/|s|t|)|}|'| +0#0000000#ffffff0|/|p|r|o|c|/|m|e|m|i|n|f|o| @16
+>b+0#af5f00255&|i|n|d| +0#0000000&@11|\+0#e000e06&|0+0#e000002&|4|1| +0#0000000&@3|h+0#af5f00255&|e|l|p| +0#0000000&@46
+|c+0#af5f00255&|a|p|t|i|o|n| +0#0000000&|a|l|w|a|y|s| @1|"+0#e000002&|%+0#e000e06&|{|=| |3|}|%|?|%|0+8&&|`+0&&|%|L+8&&|>+0&&|%|1+8&&|0@1|=+0&&|%|?| +0#e000002&|%+0#e000e06&|-+8&&|w+0&&|%|{|i|2|}|%|n| +0#e000002&|%+0#e000e06&|t|%|{|-|}|%|++8&&|w+0&&|%|{|0|}|"+0#e000002&| +0#0000000&@10
+|d+0#af5f00255&|e|f|u|t|f|8| +0#0000000&@8|o+0#e000002&|n| +0#0000000&@56
+|e+0#af5f00255&|s|c|a|p|e| +0#0000000&@9|`@1| @56
+|h+0#af5f00255&|a|r|d|s|t|a|t|u|s| +0#0000000&@5|o+0#e000002&|n| +0#0000000&@56
+|h+0#af5f00255&|a|r|d|s|t|a|t|u|s| +0#0000000&@5|a|l|w|a|y|s|l|a|s|t|l|i|n|e| |"+0#e000002&|%+0#e000e06&|=|%|{|x|F@5|}|%|{|#|f@1|0@3|}||+0#e000002&|%+0#e000e06&|{|#|0@1|f@3|}|%|5+8&&|`+0&&|%|{|-|}||+0#e000002&|%+0#e000e06&|{
+|x|F@5|}|%|4+8&&|`+0&&|%|{|-|}||+0#e000002&|%+0#e000e06&|{|#|0@1|f@3|}|%|l|%|{|-|}||+0#e000002&|%+0#e000e06&|{|x|8@5|;|#|0@5|}|%|3+8&&|`+0&&|%|{|-|}||+0#e000002&|%+0#e000e06&|{|#|0@1|f@3|}|%|1+8&&|`+0&&||+0#e000002&|%+0#e000e06&|2+8&&
+|`+0&&|%|{|-|}||+0#e000002&|%+0#e000e06&|{|#|0@1|8|0@2|}|%|0+8&&|c+0&&|"+0#e000002&| +0#0000000&@54
+|s+0#af5f00255&|e|t|e|n|v| +0#0000000&@9|C|O|L|U|M|N|S| |$+0#00e0e07&|{|C|O|L|U|M|N|S|}| +0#0000000&@40
+|s+0#af5f00255&|h|e|l@1|t|i|t|l|e| +0#0000000&@5|"+0#e000002&|$| |||b|a|s|h|:|"| +0#0000000&@48
+|s+0#af5f00255&|i|l|e|n|c|e|w|a|i|t| +0#0000000&@4|3+0#e000002&|0@1| +0#0000000&@55
+|s+0#af5f00255&|t|a|r|t|u|p|_|m|e|s@1|a|g|e| +0#0000000&|o+0#e000002&|f@1| +0#0000000&@55
+|v+0#af5f00255&|b|e|l@1| +0#0000000&@10|o+0#e000002&|f@1| +0#0000000&@55
+|s+0#af5f00255&|c|r|e@1|n| +0#0000000&|-|h| |0+0#e000002&| +0#0000000&|-|t| @1|v|i|m| @4|0+0#e000002&| +0#0000000&|/|u|s|r|/|b|i|n|/|v|i|m| @36
+@57|1|5|,|1| @9|6|8|%|
diff --git a/runtime/syntax/testdir/dumps/screen_02.dump b/runtime/syntax/testdir/dumps/screen_02.dump
new file mode 100644
index 000000000..0925ab227
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/screen_02.dump
@@ -0,0 +1,20 @@
+|s+0#af5f00255#ffffff0|c|r|e@1|n| +0#0000000&|-|h| |0+0#e000002&| +0#0000000&|-|t| @1|v|i|m| @4|0+0#e000002&| +0#0000000&|/|u|s|r|/|b|i|n|/|v|i|m| @36
+|s+0#af5f00255&|c|r|e@1|n| +0#0000000&@9|1+0#e000002&| +0#0000000&@57
+|s+0#af5f00255&|c|r|e@1|n| +0#0000000&@9|2+0#e000002&| +0#0000000&@57
+|s+0#af5f00255&|c|r|e@1|n| +0#0000000&@9|3+0#e000002&| +0#0000000&@57
+|s+0#af5f00255&|c|r|o|l@1|b|a|c|k| +0#0000000&@5|2+0#e000002&|0|4|8| +0#0000000&@54
+>s+0#af5f00255&|e|l|e|c|t| +0#0000000&@9|4+0#e000002&| +0#0000000&@57
+|t+0#af5f00255&|r|u|e|c|o|l|o|r| +0#0000000&@6|o+0#e000002&|n| +0#0000000&@56
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|3|1|,|1| @9|B|o|t|
diff --git a/runtime/syntax/testdir/input/screen.screenrc b/runtime/syntax/testdir/input/screen.screenrc
new file mode 100644
index 000000000..0025d4c42
--- /dev/null
+++ b/runtime/syntax/testdir/input/screen.screenrc
@@ -0,0 +1,32 @@
+# VIM_TEST_SETUP call DeferRenamingTestFileTo('screenrc')
+# VIM_TEST_SETUP hi link screenLiteral Visual
+
+
+
+
+
+
+altscreen on
+backtick 0 5 5 /usr/bin/true foo bar baz
+backtick 1 60 60 /usr/bin/mawk '{print $1, $2, $3, $4}' /dev/null
+backtick 2 60 60 /usr/bin/mawk '{print $1, $2, $3, $4}' /dev/null
+# NOTE: see `linux-source/fs/proc/proc_misc.c' for details.
+backtick 3 60 60 /usr/bin/mawk '{if($1=="MemTotal:") mt=$2; else if($1=="MemFree:") mf=$2; else if($1=="Buffers:") mb=$2; else if($1=="Cached:") mc=$2; else if($1=="SwapTotal:") st=$2; else if($1=="SwapFree:") {sf=$2; exit 0}}END{p=100/mt; printf("%.1f%%U %.1f%%F %.1f%%B %.1f%%C %.1f%%S", (mt-(mf+mb+mc))*p, mf*p, mb*p, mc*p, (st-sf)*100/st)}' /proc/meminfo
+bind ! help
+caption always "%{= 3}%?%0`%L>%100=%? %-w%{i2}%n %t%{-}%+w%{0}"
+defutf8 on
+escape ``
+hardstatus on
+hardstatus alwayslastline "%=%{xFFFFFF}%{#ff0000}|%{#00ffff}%5`%{-}|%{xFFFFFF}%4`%{-}|%{#00ffff}%l%{-}|%{x888888;#000000}%3`%{-}|%{#00ffff}%1`|%2`%{-}|%{#008000}%0c"
+setenv COLUMNS ${COLUMNS}
+shelltitle "$ |bash:"
+silencewait 300
+startup_message off
+vbell off
+screen -h 0 -t vim 0 /usr/bin/vim
+screen 1
+screen 2
+screen 3
+scrollback 2048
+select 4
+truecolor on
Reply all
Reply to author
Forward
0 new messages