Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Split builtin objects / types
  • Loading branch information
cdonovick committed Dec 18, 2018
commit 67a2eda12c3e5af212e895a20eb8bd584403a981
18 changes: 14 additions & 4 deletions syntax/python.vim
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ if s:Enabled('g:python_highlight_all')
if s:Enabled('g:python_highlight_builtins')
call s:EnableByDefault('g:python_highlight_builtin_objs')
call s:EnableByDefault('g:python_highlight_builtin_funcs')
call s:EnableByDefault('g:python_highlight_builtin_types')
endif
call s:EnableByDefault('g:python_highlight_exceptions')
call s:EnableByDefault('g:python_highlight_string_formatting')
Expand Down Expand Up @@ -92,7 +93,7 @@ else
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
syn match pythonStatement '\<async\s\+with\>'
syn match pythonStatement '\<async\s\+for\>'
syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonBytes,pythonBoolean,pythonNone,pythonBuiltinObj,pythonBuiltinFunc
syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonBytes,pythonBoolean,pythonNone,pythonBuiltinObj,pythonBuiltinFunc,pythonBuiltinType
endif


Expand Down Expand Up @@ -330,14 +331,13 @@ else
endif

"
" Builtin objects and types
" Builtin objects
"

if s:Enabled('g:python_highlight_builtin_objs')
syn keyword pythonNone None
syn keyword pythonBoolean True False
syn keyword pythonBuiltinObj Ellipsis NotImplemented
syn match pythonBuiltinObj '\v\.@<!<%(object|bool|int|float|tuple|str|list|dict|set|frozenset|bytearray|bytes)>'
syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__
syn keyword pythonBuiltinObj __loader__ __spec__ __path__ __cached__
endif
Expand Down Expand Up @@ -368,6 +368,15 @@ if s:Enabled('g:python_highlight_builtin_funcs')
unlet s:funcs_re
endif

"
" Builtin types
"

if s:Enabled('g:python_highlight_builtin_types')
syn match pythonBuiltinType '\v\.@<!<%(object|bool|int|float|tuple|str|list|dict|set|frozenset|bytearray|bytes)>'
endif


"
" Builtin exceptions and warnings
"
Expand Down Expand Up @@ -471,8 +480,9 @@ if v:version >= 508 || !exists('did_python_syn_inits')
HiLink pythonBoolean Boolean
HiLink pythonNone Constant

HiLink pythonBuiltinObj Structure
HiLink pythonBuiltinObj Identifier
HiLink pythonBuiltinFunc Function
HiLink pythonBuiltinType Structure

HiLink pythonExClass Structure
HiLink pythonClassVar Identifier
Expand Down