Skip to content

Highlight punctuation that does not fall into any syntax group #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ highlighting modes:
Options used by the script
~~~~~~~~~~~~~~~~~~~~~~~~~~

``python_highlight_default_punctuation``
Highlight punctuation that does not fall into any syntax group
``python_highlight_builtins``
Highlight builtin functions and objects
``python_highlight_builtin_objs``
Expand Down
4 changes: 3 additions & 1 deletion syntax.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ highlighting modes:
<
Options used by the script

Highlight builtin functions and objects >
Highlight punctuation that does not fall into any syntax group >
:let python_highlight_default_punctuation
< Highlight builtin functions and objects >
:let python_highlight_builtins = 1
< Highlight builtin objects only >
:let python_highlight_builtin_objs = 1
Expand Down
13 changes: 13 additions & 0 deletions syntax/python.vim
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
" Option names used by the script
" -------------------------------
"
" python_highlight_default_punctuation Highlight punctuation that does not
" fall into any syntax group
" python_highlight_builtins Highlight builtin functions and
" objects
" python_highlight_builtin_objs Highlight builtin objects only
Expand Down Expand Up @@ -131,6 +133,7 @@ endfunction
call s:EnableByDefault("g:python_slow_sync")

if s:Enabled("g:python_highlight_all")
call s:EnableByDefault("g:python_highlight_default_punctuation")
call s:EnableByDefault("g:python_highlight_builtins")
if s:Enabled("g:python_highlight_builtins")
call s:EnableByDefault("g:python_highlight_builtin_objs")
Expand All @@ -146,6 +149,14 @@ if s:Enabled("g:python_highlight_all")
call s:EnableByDefault("g:python_print_as_function")
endif

"
" Default punctuation
"

if s:Enabled("g:python_highlight_default_punctuation")
syn match pythonPunctuation "[^A-Za-z0-9_]"
endif

"
" Keywords
"
Expand Down Expand Up @@ -495,6 +506,8 @@ if version >= 508 || !exists("did_python_syn_inits")
command -nargs=+ HiLink hi def link <args>
endif

HiLink pythonPunctuation Special

HiLink pythonStatement Statement
HiLink pythonImport Include
HiLink pythonFunction Function
Expand Down