tmux.vim 8.2 KB

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