blob: 4b8454dd51107e79128157416d83ba0e0f103e25 [file] [log] [blame]
Bram Moolenaar214641f2017-03-05 17:04:09 +01001" Language: tmux(1) configuration file
Eric Pruitt315b6f72024-09-04 22:15:40 +02002" Version: 3.4 (git-3d8ead8a)
Bram Moolenaar214641f2017-03-05 17:04:09 +01003" 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
Bram Moolenaar036986f2017-03-16 17:41:02 +01007if exists("b:current_syntax")
Bram Moolenaar214641f2017-03-05 17:04:09 +01008 finish
Bram Moolenaar214641f2017-03-05 17:04:09 +01009endif
10
Bram Moolenaar6c391a72021-09-09 21:55:11 +020011" Explicitly change compatibility options to Vim's defaults because this file
Bram Moolenaar036986f2017-03-16 17:41:02 +010012" uses line continuations.
13let s:original_cpo = &cpo
Bram Moolenaar214641f2017-03-05 17:04:09 +010014set cpo&vim
15
Bram Moolenaar036986f2017-03-16 17:41:02 +010016let b:current_syntax = "tmux"
Bram Moolenaar0b0f0992018-05-22 21:41:30 +020017syntax iskeyword @,48-57,_,192-255,-
Bram Moolenaar214641f2017-03-05 17:04:09 +010018syntax case match
19
Eric Pruittb42703a2023-12-18 00:03:40 -080020" 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
Bram Moolenaar214641f2017-03-05 17:04:09 +010023
24syn keyword tmuxTodo FIXME NOTE TODO XXX contained
25
Bram Moolenaar46eea442022-03-30 10:51:39 +010026syn match tmuxColour /\<colou\?r[0-9]\+\>/ display
Bram Moolenaar214641f2017-03-05 17:04:09 +010027syn match tmuxKey /\(C-\|M-\|\^\)\+\S\+/ display
Bram Moolenaar0b0f0992018-05-22 21:41:30 +020028syn match tmuxNumber /\<\d\+\>/ display
Bram Moolenaar214641f2017-03-05 17:04:09 +010029syn match tmuxFlags /\s-\a\+/ display
Bram Moolenaar46eea442022-03-30 10:51:39 +010030syn match tmuxVariableExpansion /\$\({[A-Za-z_]\w*}\|[A-Za-z_]\w*\)/ display
Eric Pruitt73a81082024-07-09 18:32:55 +020031syn match tmuxControl /\(^\|\s\)%\(if\|elif\|else\|endif\|hidden\)\($\|\s\)/ display
Bram Moolenaar46eea442022-03-30 10:51:39 +010032syn match tmuxEscape /\\\(u\x\{4\}\|U\x\{8\}\|\o\{3\}\|[\\ernt$]\)/ display
Bram Moolenaar214641f2017-03-05 17:04:09 +010033
Eric Pruittb42703a2023-12-18 00:03:40 -080034" 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.
Eric Pruitt315b6f72024-09-04 22:15:40 +020040syn match tmuxInvalidVariableExpansion /\${[^}]*[^A-Za-z0-9_}][^}]*}/ display
Eric Pruittb42703a2023-12-18 00:03:40 -080041
Bram Moolenaar22863042021-10-16 15:23:36 +010042syn region tmuxComment start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo,@Spell
Bram Moolenaar214641f2017-03-05 17:04:09 +010043
Eric Pruittb42703a2023-12-18 00:03:40 -080044syn region tmuxString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=tmuxFormatString,tmuxEscape,tmuxVariableExpansion,tmuxInvalidVariableExpansion,@Spell
Bram Moolenaar46eea442022-03-30 10:51:39 +010045syn region tmuxUninterpolatedString start=+'+ skip=+\\$+ excludenl end=+'+ end='$' contains=tmuxFormatString,@Spell
Bram Moolenaar214641f2017-03-05 17:04:09 +010046
47" TODO: Figure out how escaping works inside of #(...) and #{...} blocks.
48syn region tmuxFormatString start=/#[#DFhHIPSTW]/ end=// contained keepend
Bram Moolenaar22863042021-10-16 15:23:36 +010049syn region tmuxFormatString start=/#{/ skip=/#{.\{-}}/ end=/}/ keepend
Bram Moolenaar214641f2017-03-05 17:04:09 +010050syn region tmuxFormatString start=/#(/ skip=/#(.\{-})/ end=/)/ contained keepend
51
Bram Moolenaar46eea442022-03-30 10:51:39 +010052" 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.
Eric Pruittb42703a2023-12-18 00:03:40 -080055syn region tmuxAssignment matchgroup=tmuxVariable start=/^\s*[A-Za-z_]\w*=\@=/ skip=/\\$\|\\\s/ end=/\s\|$/ contains=tmuxString,tmuxUninterpolatedString,tmuxVariableExpansion,tmuxControl,tmuxEscape,tmuxInvalidVariableExpansion
Bram Moolenaar46eea442022-03-30 10:51:39 +010056
Bram Moolenaar214641f2017-03-05 17:04:09 +010057hi def link tmuxFormatString Identifier
58hi def link tmuxAction Boolean
59hi def link tmuxBoolean Boolean
60hi def link tmuxCommands Keyword
Bram Moolenaar46eea442022-03-30 10:51:39 +010061hi def link tmuxControl PreCondit
Bram Moolenaar214641f2017-03-05 17:04:09 +010062hi def link tmuxComment Comment
Eric Pruittb42703a2023-12-18 00:03:40 -080063hi def link tmuxEnums Boolean
Bram Moolenaar46eea442022-03-30 10:51:39 +010064hi def link tmuxEscape Special
65hi def link tmuxEscapeUnquoted Special
Eric Pruittb42703a2023-12-18 00:03:40 -080066hi def link tmuxInvalidVariableExpansion
67\ Error
Bram Moolenaar214641f2017-03-05 17:04:09 +010068hi 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
Bram Moolenaar46eea442022-03-30 10:51:39 +010074hi def link tmuxUninterpolatedString
75\ String
Bram Moolenaar214641f2017-03-05 17:04:09 +010076hi def link tmuxVariable Identifier
77hi def link tmuxVariableExpansion Identifier
78
Bram Moolenaar22863042021-10-16 15:23:36 +010079" 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.
Bram Moolenaar214641f2017-03-05 17:04:09 +010081" Darker colors have their background set to white.
Bram Moolenaar22863042021-10-16 15:23:36 +010082if 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"
Bram Moolenaar46eea442022-03-30 10:51:39 +010085 exec "syn match tmuxColour" . s:i . " /\\<colou\\?r" . s:i . "\\>/ display"
Bram Moolenaar22863042021-10-16 15:23:36 +010086\ " | highlight tmuxColour" . s:i . " ctermfg=" . s:i . " ctermbg=" . s:bg
87 endfor
88endif
Bram Moolenaar214641f2017-03-05 17:04:09 +010089
90syn keyword tmuxOptions
Bram Moolenaar46eea442022-03-30 10:51:39 +010091\ activity-action after-bind-key after-capture-pane after-copy-mode
Eric Pruittb42703a2023-12-18 00:03:40 -080092\ 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
Eric Pruitt73a81082024-07-09 18:32:55 +0200102\ 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
Eric Pruittb42703a2023-12-18 00:03:40 -0800105\ client-focus-out client-resized client-session-changed clock-mode-color
Eric Pruitt73a81082024-07-09 18:32:55 +0200106\ clock-mode-colour clock-mode-style command-alias command-error copy-command
Eric Pruittb42703a2023-12-18 00:03:40 -0800107\ 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
Bram Moolenaar46eea442022-03-30 10:51:39 +0100122\ 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
Eric Pruittb42703a2023-12-18 00:03:40 -0800127\ 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
Bram Moolenaar214641f2017-03-05 17:04:09 +0100137
138syn keyword tmuxCommands
Eric Pruittb42703a2023-12-18 00:03:40 -0800139\ 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
Eric Pruitte8f6af62024-02-21 10:46:47 -0800167\ 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
Bram Moolenaar214641f2017-03-05 17:04:09 +0100170
Bram Moolenaar036986f2017-03-16 17:41:02 +0100171let &cpo = s:original_cpo
172unlet! s:original_cpo s:bg s:i