From f3b3748f4a92ee0f35dff8ebba1ea297e1b773a2 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Wed, 11 Nov 2020 14:10:23 -0700 Subject: [PATCH] Allow disabling of color highlighting --- README.md | 2 ++ src/header.vim | 15 +++++++++------ vim/syntax/tmux.vim | 17 ++++++++++------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e3af057..06e88ca 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/header.vim b/src/header.vim index 84dd9f1..470d24a 100644 --- a/src/header.vim +++ b/src/header.vim @@ -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 . " /\\/ 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 . " /\\/ display" +\ " | highlight tmuxColour" . s:i . " ctermfg=" . s:i . " ctermbg=" . s:bg + endfor +endif diff --git a/vim/syntax/tmux.vim b/vim/syntax/tmux.vim index 8ab0bd2..5e421c2 100644 --- a/vim/syntax/tmux.vim +++ b/vim/syntax/tmux.vim @@ -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 " License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause) @@ -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 . " /\\/ 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 . " /\\/ 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