tmux-plugins/vim-tmux

Set @Spell on correct regions

nogweii opened this issue · 3 comments

I have spellcheck enabled by default and looks like this (with my colorscheme):

spell_errors_in_tmux_conf

While the spelling "errors" in the plugin list, format strings, and other strings are to be expected, the set & setw keywords should not be marked as either grammatically or spelled incorrect.

Thanks for bringing this up, we should definitely make this work better.

I'm not sure when I can look into this as I'm currently swamped and this is not a deal-breaking bug. Would you consider implementing this and opening a PR?

y commented

Most languages only enable spelling for the comments and sometimes strings:

diff --git a/syntax/tmux.vim b/syntax/tmux.vim
index 8d8b428..8f4acf2 100644
--- a/syntax/tmux.vim
+++ b/syntax/tmux.vim
@@ -155,7 +155,7 @@ syn match tmuxSpecialCmds /^\s*set\(-option\)\?/ display
syn match tmuxOptsSetw        /\(setw\|set-window-option\)/ display
syn match tmuxSpecialCmds /^\s*\(setw\|set-window-option\)/ display

-syn region tmuxComment start=/#/ end=/$/ contains=tmuxTodo,tmuxURL display oneline
+syn region tmuxComment start=/#/ end=/$/ contains=tmuxTodo,tmuxURL,@Spell display oneline

syn keyword tmuxTodo FIXME NOTE TODO XXX todo contained
syn match tmuxURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^'  <>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^'  <>"]+)[a-zA-Z0-9/]` contained
@@ -205,8 +205,8 @@ syn match  tmuxAttrSeparator /,/     contained display
" Shell command interpolation
syn region tmuxShellInpol matchgroup=tmuxShellInpolDelimiter start=/#(/ skip=/#(.\{-})/ end=/)/ contained keepend

-syn region tmuxString matchgroup=tmuxStringDelimiter start=/"/ skip=/\\./ end=/"/ contains=tmuxFmtInpol,tmuxFmtAlias,tmuxAttrInpol,tmuxShellInpol,tmuxPromptInpol,tmuxDateInpol display keepend
-syn region tmuxString matchgroup=tmuxStringDelimiter start=/'/ end=/'/            contains=tmuxFmtInpol,tmuxFmtAlias,tmuxAttrInpol,tmuxShellInpol,tmuxPromptInpol,tmuxDateInpol display keepend
+syn region tmuxString matchgroup=tmuxStringDelimiter start=/"/ skip=/\\./ end=/"/ contains=tmuxFmtInpol,tmuxFmtAlias,tmuxAttrInpol,tmuxShellInpol,tmuxPromptInpol,tmuxDateInpol,@Spell display keepend
+syn region tmuxString matchgroup=tmuxStringDelimiter start=/'/ end=/'/            contains=tmuxFmtInpol,tmuxFmtAlias,tmuxAttrInpol,tmuxShellInpol,tmuxPromptInpol,tmuxDateInpol,@Spell display keepend

hi def link tmuxAction              Boolean
hi def link tmuxBoolean             Boolean

Thanks @y your change has been added via this commit 5c0274e