Skip to content

Commit 49fd76c

Browse files
committed
Highlight punctuation that does not fall into any syntax group
1 parent 69760cb commit 49fd76c

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ highlighting modes:
9595
Options used by the script
9696
~~~~~~~~~~~~~~~~~~~~~~~~~~
9797

98+
``python_highlight_default_punctuation``
99+
Highlight punctuation that does not fall into any syntax group
98100
``python_highlight_builtins``
99101
Highlight builtin functions and objects
100102
``python_highlight_builtin_objs``

syntax.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ highlighting modes:
3232
<
3333
Options used by the script
3434

35-
Highlight builtin functions and objects >
35+
Highlight punctuation that does not fall into any syntax group >
36+
:let python_highlight_default_punctuation
37+
< Highlight builtin functions and objects >
3638
:let python_highlight_builtins = 1
3739
< Highlight builtin objects only >
3840
:let python_highlight_builtin_objs = 1

syntax/python.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
" Option names used by the script
6767
" -------------------------------
6868
"
69+
" python_highlight_default_punctuation Highlight punctuation that does not
70+
" fall into any syntax group
6971
" python_highlight_builtins Highlight builtin functions and
7072
" objects
7173
" python_highlight_builtin_objs Highlight builtin objects only
@@ -131,6 +133,7 @@ endfunction
131133
call s:EnableByDefault("g:python_slow_sync")
132134

133135
if s:Enabled("g:python_highlight_all")
136+
call s:EnableByDefault("g:python_highlight_default_punctuation")
134137
call s:EnableByDefault("g:python_highlight_builtins")
135138
if s:Enabled("g:python_highlight_builtins")
136139
call s:EnableByDefault("g:python_highlight_builtin_objs")
@@ -146,6 +149,14 @@ if s:Enabled("g:python_highlight_all")
146149
call s:EnableByDefault("g:python_print_as_function")
147150
endif
148151

152+
"
153+
" Default punctuation
154+
"
155+
156+
if s:Enabled("g:python_highlight_default_punctuation")
157+
syn match pythonPunctuation "[^A-Za-z0-9_]"
158+
endif
159+
149160
"
150161
" Keywords
151162
"
@@ -495,6 +506,8 @@ if version >= 508 || !exists("did_python_syn_inits")
495506
command -nargs=+ HiLink hi def link <args>
496507
endif
497508

509+
HiLink pythonPunctuation Special
510+
498511
HiLink pythonStatement Statement
499512
HiLink pythonImport Include
500513
HiLink pythonFunction Function

0 commit comments

Comments
 (0)