Closed mudrd8mz closed 4 years ago
For the record, this is what seems to work for me. Is there a way to have this behaviour configurable?
diff --git a/syntax/php.vim b/syntax/php.vim
index f5d6826272..3823f3004e 100644
--- a/syntax/php.vim
+++ b/syntax/php.vim
@@ -658,13 +658,13 @@ endif
" String
if (exists("php_parent_error_open") && php_parent_error_open)
- syn region phpStringDouble matchgroup=phpStringDelimiter start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell,@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained keepend
- syn region phpBacktick matchgroup=phpStringDelimiter start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@Spell,@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained keepend
- syn region phpStringSingle matchgroup=phpStringDelimiter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@Spell,@phpAddStrings,phpStrEsc contained keepend
+ syn region phpStringDouble matchgroup=phpStringDelimiter start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@NoSpell,@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained keepend
+ syn region phpBacktick matchgroup=phpStringDelimiter start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@NoSpell,@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained keepend
+ syn region phpStringSingle matchgroup=phpStringDelimiter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@NoSpell,@phpAddStrings,phpStrEsc contained keepend
else
- syn region phpStringDouble matchgroup=phpStringDelimiter start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell,@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained extend keepend
- syn region phpBacktick matchgroup=phpStringDelimiter start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@Spell,@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained extend keepend
- syn region phpStringSingle matchgroup=phpStringDelimiter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@Spell,@phpAddStrings,phpStrEsc contained keepend extend
+ syn region phpStringDouble matchgroup=phpStringDelimiter start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@NoSpell,@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained extend keepend
+ syn region phpBacktick matchgroup=phpStringDelimiter start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@NoSpell,@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained extend keepend
+ syn region phpStringSingle matchgroup=phpStringDelimiter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@NoSpell,@phpAddStrings,phpStrEsc contained keepend extend
endif
syn case match
Is there a way to have this behaviour configurable?
Right, so finally this is probably what I was looking for:
autocmd BufEnter *.php syntax cluster phpAddStrings add=@NoSpell
but there might be a cleaner way to achieve it.
This is actually a pretty good way to deal with it. The commit which introduced spelling in strings can be found here.
Great, many thanks for the reply and for the useful plugin.
I'd like to have spell check enabled when editing the PHP files, but I would like to have it enabled for PHP comments only. I can see that the syntax/php.vim adds
@Spell
cluster to allphpStringDouble
,phpBacktick
,phpStringSingle
,phpHereDoc
etc regions. I would need to selectively enable it forphpComment
andphpCommentTitle
only.I was trying to find a way to somehow override it with
@NoSpell
in my .vimrc but I failed.Can you suggest a good way to have the spell check enabled for comments only and not all strings? The only way that works for me now is modifying the upstream and removing the
@Spell
from the upstream php.vim file (which I'd prefer to avoid).Thank you in advance for suggestions.