Skip to content

Commit

Permalink
Allow disabling of color highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
gpanders authored Nov 11, 2020
1 parent b370481 commit f3b3748
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ some changes:
- When a color is used (e.g. "colour7"), the text's foreground is changed to
reflect the color that the number represents. For darker colors, the
background is changed to white since the text might otherwise be invisible.
This can be disabled by setting `g:tmux_syntax_colors = 0` in your vimrc
file.
- Distinct highlighting has been added for interpolated blocks (`#[...]`,
`#(...)` and `#{...}`).
- Multi-line strings are supported and correctly highlighted.
Expand Down
15 changes: 9 additions & 6 deletions src/header.vim
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ hi def link tmuxTodo Todo
hi def link tmuxVariable Identifier
hi def link tmuxVariableExpansion Identifier

" Make the foreground of colourXXX keywords match the color they represent.
" Make the foreground of colourXXX keywords match the color they represent
" when g:tmux_syntax_colors is unset or set to a non-zero value.
" Darker colors have their background set to white.
for s:i in range(0, 255)
let s:bg = (!s:i || s:i == 16 || (s:i > 231 && s:i < 235)) ? 15 : "none"
exec "syn match tmuxColour" . s:i . " /\\<colour" . s:i . "\\>/ display"
\ " | highlight tmuxColour" . s:i . " ctermfg=" . s:i . " ctermbg=" . s:bg
endfor
if get(g:, "tmux_syntax_colors", 1)
for s:i in range(0, 255)
let s:bg = (!s:i || s:i == 16 || (s:i > 231 && s:i < 235)) ? 15 : "none"
exec "syn match tmuxColour" . s:i . " /\\<colour" . s:i . "\\>/ display"
\ " | highlight tmuxColour" . s:i . " ctermfg=" . s:i . " ctermbg=" . s:bg
endfor
endif
17 changes: 10 additions & 7 deletions vim/syntax/tmux.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
" Language: tmux(1) configuration file
" Version: 3.1b (git-769ae106)
" Version: 3.2-rc (git-e94bd5cc)
" URL: https://github.com/ericpruitt/tmux.vim/
" Maintainer: Eric Pruitt <[email protected]>
" License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause)
Expand Down Expand Up @@ -55,13 +55,16 @@ hi def link tmuxTodo Todo
hi def link tmuxVariable Identifier
hi def link tmuxVariableExpansion Identifier

" Make the foreground of colourXXX keywords match the color they represent.
" Make the foreground of colourXXX keywords match the color they represent
" when g:tmux_syntax_colors is unset or set to a non-zero value.
" Darker colors have their background set to white.
for s:i in range(0, 255)
let s:bg = (!s:i || s:i == 16 || (s:i > 231 && s:i < 235)) ? 15 : "none"
exec "syn match tmuxColour" . s:i . " /\\<colour" . s:i . "\\>/ display"
\ " | highlight tmuxColour" . s:i . " ctermfg=" . s:i . " ctermbg=" . s:bg
endfor
if get(g:, "tmux_syntax_colors", 1)
for s:i in range(0, 255)
let s:bg = (!s:i || s:i == 16 || (s:i > 231 && s:i < 235)) ? 15 : "none"
exec "syn match tmuxColour" . s:i . " /\\<colour" . s:i . "\\>/ display"
\ " | highlight tmuxColour" . s:i . " ctermfg=" . s:i . " ctermbg=" . s:bg
endfor
endif

syn keyword tmuxOptions
\ backspace buffer-limit command-alias copy-command default-terminal editor
Expand Down

0 comments on commit f3b3748

Please sign in to comment.