Skip to content

Commit

Permalink
Highlight self and cls attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
kynikos committed Jan 1, 2016
1 parent 49fd76c commit aa7aba6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ Options used by the script
Highlight builtin objects only
``python_highlight_builtin_funcs``
Highlight builtin functions only
``python_highlight_self``
Highlight self and cls attributes
``python_highlight_exceptions``
Highlight standard exceptions
``python_highlight_string_formatting``
Expand Down
2 changes: 2 additions & 0 deletions syntax.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Options used by the script
:let python_highlight_builtin_objs = 1
< Highlight builtin functions only >
:let python_highlight_builtin_funcs = 1
< Highlight self and cls attributes >
:let python_highlight_self = 1
< Highlight standard exceptions >
:let python_highlight_exceptions = 1
< Highlight `%` string formatting >
Expand Down
12 changes: 12 additions & 0 deletions syntax/python.vim
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
" objects
" python_highlight_builtin_objs Highlight builtin objects only
" python_highlight_builtin_funcs Highlight builtin functions only
" python_highlight_self Highlight self and cls attributes
" python_highlight_exceptions Highlight standard exceptions
" python_highlight_string_formatting Highlight % string formatting
" python_highlight_string_format Highlight str.format syntax
Expand Down Expand Up @@ -139,6 +140,7 @@ if s:Enabled("g:python_highlight_all")
call s:EnableByDefault("g:python_highlight_builtin_objs")
call s:EnableByDefault("g:python_highlight_builtin_funcs")
endif
call s:EnableByDefault("g:python_highlight_self")
call s:EnableByDefault("g:python_highlight_exceptions")
call s:EnableByDefault("g:python_highlight_string_formatting")
call s:EnableByDefault("g:python_highlight_string_format")
Expand Down Expand Up @@ -417,6 +419,14 @@ if s:Enabled("g:python_highlight_builtin_objs")
syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__
endif

"
" Self and cls
"

if s:Enabled("g:python_highlight_self")
syn keyword pythonSelf self cls
endif

"
" Builtin functions
"
Expand Down Expand Up @@ -573,6 +583,8 @@ if version >= 508 || !exists("did_python_syn_inits")
HiLink pythonBuiltinObj Structure
HiLink pythonBuiltinFunc Function

HiLink pythonSelf Identifier

HiLink pythonExClass Structure

delcommand HiLink
Expand Down

0 comments on commit aa7aba6

Please sign in to comment.