neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

tmux.vim (9642B)


      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 
      7 if exists("b:current_syntax")
      8    finish
      9 endif
     10 
     11 " Explicitly change compatibility options to Vim's defaults because this file
     12 " uses line continuations.
     13 let s:original_cpo = &cpo
     14 set cpo&vim
     15 
     16 let b:current_syntax = "tmux"
     17 syntax iskeyword @,48-57,_,192-255,-
     18 syntax 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.
     22 syn keyword tmuxEnums yes no
     23 
     24 syn keyword tmuxTodo FIXME NOTE TODO XXX contained
     25 
     26 syn match tmuxColour            /\<colou\?r[0-9]\+\>/  display
     27 syn match tmuxKey               /\(C-\|M-\|\^\)\+\S\+/ display
     28 syn match tmuxNumber            /\<\d\+\>/             display
     29 syn match tmuxFlags             /\s-\a\+/              display
     30 syn match tmuxVariableExpansion /\$\({[A-Za-z_]\w*}\|[A-Za-z_]\w*\)/ display
     31 syn match tmuxControl           /\(^\|\s\)%\(if\|elif\|else\|endif\|hidden\)\($\|\s\)/ display
     32 syn match tmuxEscape            /\\\(u\x\{4\}\|U\x\{8\}\|\o\{3\}\|[\\ernt$]\)/ display
     33 
     34 " Missing closing bracket.
     35 syn match tmuxInvalidVariableExpansion /\${[^}]*$/ display
     36 " Starts with invalid character.
     37 syn match tmuxInvalidVariableExpansion /\${[^A-Za-z_][^}]*}/ display
     38 syn match tmuxInvalidVariableExpansion /\$[^A-Za-z_{ \t]/ display
     39 " Contains invalid character.
     40 syn match tmuxInvalidVariableExpansion /\${[^}]*[^A-Za-z0-9_}][^}]*}/ display
     41 
     42 syn region tmuxComment start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo,@Spell
     43 
     44 syn region tmuxString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=tmuxFormatString,tmuxEscape,tmuxVariableExpansion,tmuxInvalidVariableExpansion,@Spell
     45 syn region tmuxUninterpolatedString start=+'+ skip=+\\$+ excludenl end=+'+ end='$' contains=tmuxFormatString,@Spell
     46 
     47 " TODO: Figure out how escaping works inside of #(...) and #{...} blocks.
     48 syn region tmuxFormatString start=/#[#DFhHIPSTW]/ end=// contained keepend
     49 syn region tmuxFormatString start=/#{/ skip=/#{.\{-}}/ end=/}/ keepend
     50 syn 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.
     55 syn region tmuxAssignment matchgroup=tmuxVariable start=/^\s*[A-Za-z_]\w*=\@=/ skip=/\\$\|\\\s/ end=/\s\|$/ contains=tmuxString,tmuxUninterpolatedString,tmuxVariableExpansion,tmuxControl,tmuxEscape,tmuxInvalidVariableExpansion
     56 
     57 hi def link tmuxFormatString      Identifier
     58 hi def link tmuxAction            Boolean
     59 hi def link tmuxBoolean           Boolean
     60 hi def link tmuxCommands          Keyword
     61 hi def link tmuxControl           PreCondit
     62 hi def link tmuxComment           Comment
     63 hi def link tmuxEnums             Boolean
     64 hi def link tmuxEscape            Special
     65 hi def link tmuxEscapeUnquoted    Special
     66 hi def link tmuxInvalidVariableExpansion
     67 \                                 Error
     68 hi def link tmuxKey               Special
     69 hi def link tmuxNumber            Number
     70 hi def link tmuxFlags             Identifier
     71 hi def link tmuxOptions           Function
     72 hi def link tmuxString            String
     73 hi def link tmuxTodo              Todo
     74 hi def link tmuxUninterpolatedString
     75 \                                 String
     76 hi def link tmuxVariable          Identifier
     77 hi 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.
     82 if 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
     88 endif
     89 
     90 syn 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 
    138 syn 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 
    164 syn 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 
    171 let &cpo = s:original_cpo
    172 unlet! s:original_cpo s:bg s:i