robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Gregory Andersvim-patch:315b6f7: runtime(tmux): Update syntax script (#30265)220b8aa6fe

master
9.4 KiB172 linesraw
1" Language: tmux(1) configuration file
2" Version: 3.4 (git-3d8ead8a)
3" URL: https://github.com/ericpruitt/tmux.vim/
4" Maintainer: Eric Pruitt <eric.pruitt@gmail.com>
5" License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause)
6
7if exists("b:current_syntax")
8    finish
9endif
10
11" Explicitly change compatibility options to Vim's defaults because this file
12" uses line continuations.
13let s:original_cpo = &cpo
14set cpo&vim
15
16let b:current_syntax = "tmux"
17syntax iskeyword @,48-57,_,192-255,-
18syntax case match
19
20" The values "yes" and "no" are synonyms for "on" and "off", so they do not
21" appear in the option table file.
22syn keyword tmuxEnums yes no
23
24syn keyword tmuxTodo FIXME NOTE TODO XXX contained
25
26syn match tmuxColour            /\<colou\?r[0-9]\+\>/  display
27syn match tmuxKey               /\(C-\|M-\|\^\)\+\S\+/ display
28syn match tmuxNumber            /\<\d\+\>/             display
29syn match tmuxFlags             /\s-\a\+/              display
30syn match tmuxVariableExpansion /\$\({[A-Za-z_]\w*}\|[A-Za-z_]\w*\)/ display
31syn match tmuxControl           /\(^\|\s\)%\(if\|elif\|else\|endif\|hidden\)\($\|\s\)/ display
32syn match tmuxEscape            /\\\(u\x\{4\}\|U\x\{8\}\|\o\{3\}\|[\\ernt$]\)/ display
33
34" Missing closing bracket.
35syn match tmuxInvalidVariableExpansion /\${[^}]*$/ display
36" Starts with invalid character.
37syn match tmuxInvalidVariableExpansion /\${[^A-Za-z_][^}]*}/ display
38syn match tmuxInvalidVariableExpansion /\$[^A-Za-z_{ \t]/ display
39" Contains invalid character.
40syn match tmuxInvalidVariableExpansion /\${[^}]*[^A-Za-z0-9_}][^}]*}/ display
41
42syn region tmuxComment start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo,@Spell
43
44syn region tmuxString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=tmuxFormatString,tmuxEscape,tmuxVariableExpansion,tmuxInvalidVariableExpansion,@Spell
45syn region tmuxUninterpolatedString start=+'+ skip=+\\$+ excludenl end=+'+ end='$' contains=tmuxFormatString,@Spell
46
47" TODO: Figure out how escaping works inside of #(...) and #{...} blocks.
48syn region tmuxFormatString start=/#[#DFhHIPSTW]/ end=// contained keepend
49syn region tmuxFormatString start=/#{/ skip=/#{.\{-}}/ end=/}/ keepend
50syn region tmuxFormatString start=/#(/ skip=/#(.\{-})/ end=/)/ contained keepend
51
52" At the time of this writing, the latest tmux release will parse a line
53" reading "abc=xyz set-option ..." as an assignment followed by a command
54" hence the presence of "\s" in the "end" argument.
55syn region tmuxAssignment matchgroup=tmuxVariable start=/^\s*[A-Za-z_]\w*=\@=/ skip=/\\$\|\\\s/ end=/\s\|$/ contains=tmuxString,tmuxUninterpolatedString,tmuxVariableExpansion,tmuxControl,tmuxEscape,tmuxInvalidVariableExpansion
56
57hi def link tmuxFormatString      Identifier
58hi def link tmuxAction            Boolean
59hi def link tmuxBoolean           Boolean
60hi def link tmuxCommands          Keyword
61hi def link tmuxControl           PreCondit
62hi def link tmuxComment           Comment
63hi def link tmuxEnums             Boolean
64hi def link tmuxEscape            Special
65hi def link tmuxEscapeUnquoted    Special
66hi def link tmuxInvalidVariableExpansion
67\                                 Error
68hi def link tmuxKey               Special
69hi def link tmuxNumber            Number
70hi def link tmuxFlags             Identifier
71hi def link tmuxOptions           Function
72hi def link tmuxString            String
73hi def link tmuxTodo              Todo
74hi def link tmuxUninterpolatedString
75\                                 String
76hi def link tmuxVariable          Identifier
77hi def link tmuxVariableExpansion Identifier
78
79" Make the foreground of colourXXX keywords match the color they represent
80" when g:tmux_syntax_colors is unset or set to a non-zero value.
81" Darker colors have their background set to white.
82if get(g:, "tmux_syntax_colors", 1)
83    for s:i in range(0, 255)
84        let s:bg = (!s:i || s:i == 16 || (s:i > 231 && s:i < 235)) ? 15 : "none"
85        exec "syn match tmuxColour" . s:i . " /\\<colou\\?r" . s:i . "\\>/ display"
86\         " | highlight tmuxColour" . s:i . " ctermfg=" . s:i . " ctermbg=" . s:bg
87    endfor
88endif
89
90syn keyword tmuxOptions
91\ activity-action after-bind-key after-capture-pane after-copy-mode
92\ after-display-message after-display-panes after-kill-pane after-list-buffers
93\ after-list-clients after-list-keys after-list-panes after-list-sessions
94\ after-list-windows after-load-buffer after-lock-server after-new-session
95\ after-new-window after-paste-buffer after-pipe-pane after-queue
96\ after-refresh-client after-rename-session after-rename-window
97\ after-resize-pane after-resize-window after-save-buffer after-select-layout
98\ after-select-pane after-select-window after-send-keys after-set-buffer
99\ after-set-environment after-set-hook after-set-option after-show-environment
100\ after-show-messages after-show-options after-split-window after-unbind-key
101\ aggressive-resize alert-activity alert-bell alert-silence allow-passthrough
102\ allow-rename allow-set-title alternate-screen assume-paste-time
103\ automatic-rename automatic-rename-format backspace base-index bell-action
104\ buffer-limit client-active client-attached client-detached client-focus-in
105\ client-focus-out client-resized client-session-changed clock-mode-color
106\ clock-mode-colour clock-mode-style command-alias command-error copy-command
107\ copy-mode-current-match-style copy-mode-mark-style copy-mode-match-style
108\ cursor-color cursor-colour cursor-style default-command default-shell
109\ default-size default-terminal destroy-unattached detach-on-destroy
110\ display-panes-active-color display-panes-active-colour display-panes-color
111\ display-panes-colour display-panes-time display-time editor escape-time
112\ exit-empty exit-unattached extended-keys fill-character focus-events
113\ history-file history-limit key-table lock-after-time lock-command
114\ main-pane-height main-pane-width menu-border-lines menu-border-style
115\ menu-selected-style menu-style message-command-style message-limit
116\ message-line message-style mode-keys mode-style monitor-activity monitor-bell
117\ monitor-silence mouse other-pane-height other-pane-width
118\ pane-active-border-style pane-base-index pane-border-format
119\ pane-border-indicators pane-border-lines pane-border-status pane-border-style
120\ pane-colors pane-colours pane-died pane-exited pane-focus-in pane-focus-out
121\ pane-mode-changed pane-set-clipboard pane-title-changed popup-border-lines
122\ popup-border-style popup-style prefix prefix2 prompt-history-limit
123\ remain-on-exit remain-on-exit-format renumber-windows repeat-time
124\ scroll-on-clear session-closed session-created session-renamed
125\ session-window-changed set-clipboard set-titles set-titles-string
126\ silence-action status status-bg status-fg status-format status-interval
127\ status-justify status-keys status-left status-left-length status-left-style
128\ status-position status-right status-right-length status-right-style
129\ status-style synchronize-panes terminal-features terminal-overrides
130\ update-environment user-keys visual-activity visual-bell visual-silence
131\ window-active-style window-layout-changed window-linked window-pane-changed
132\ window-renamed window-resized window-size window-status-activity-style
133\ window-status-bell-style window-status-current-format
134\ window-status-current-style window-status-format window-status-last-style
135\ window-status-separator window-status-style window-style window-unlinked
136\ word-separators wrap-search xterm-keys
137
138syn keyword tmuxCommands
139\ attach attach-session bind bind-key break-pane breakp capture-pane capturep
140\ choose-buffer choose-client choose-session choose-tree choose-window
141\ clear-history clear-prompt-history clearhist clearphist clock-mode
142\ command-prompt confirm confirm-before copy-mode customize-mode delete-buffer
143\ deleteb detach detach-client display display-menu display-message
144\ display-panes display-popup displayp find-window findw has has-session if
145\ if-shell info join-pane joinp kill-pane kill-server kill-session kill-window
146\ killp killw last last-pane last-window lastp link-window linkw list-buffers
147\ list-clients list-commands list-keys list-panes list-sessions list-windows
148\ load-buffer loadb lock lock-client lock-server lock-session lockc locks ls
149\ lsb lsc lscm lsk lsp lsw menu move-pane move-window movep movew new
150\ new-session new-window neww next next-layout next-window nextl paste-buffer
151\ pasteb pipe-pane pipep popup prev previous-layout previous-window prevl
152\ refresh refresh-client rename rename-session rename-window renamew
153\ resize-pane resize-window resizep resizew respawn-pane respawn-window
154\ respawnp respawnw rotate-window rotatew run run-shell save-buffer saveb
155\ select-layout select-pane select-window selectl selectp selectw send
156\ send-keys send-prefix server-access server-info set set-buffer
157\ set-environment set-hook set-option set-window-option setb setenv setw show
158\ show-buffer show-environment show-hooks show-messages show-options
159\ show-prompt-history show-window-options showb showenv showmsgs showphist
160\ showw source source-file split-pane split-window splitp splitw start
161\ start-server suspend-client suspendc swap-pane swap-window swapp swapw
162\ switch-client switchc unbind unbind-key unlink-window unlinkw wait wait-for
163
164syn keyword tmuxEnums
165\ absolute-centre all always any arrows bar blinking-bar blinking-block
166\ blinking-underline block both bottom centre color colour current default
167\ double emacs external failed heavy keep-group keep-last largest latest left
168\ manual next no-detached none number off on other padded previous right
169\ rounded simple single smallest top underline vi
170
171let &cpo = s:original_cpo
172unlet! s:original_cpo s:bg s:i