Skip to content

Commit

Permalink
Highlight imports on decorator lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
tweekmonster committed Oct 12, 2016
1 parent 39808d3 commit 7dda066
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions after/syntax/python.vim
@@ -1,14 +1,17 @@
" Avoid highlighting imported objects if they're preceded by a period
syntax match impsortNonImport #\.\k\+# transparent contains=TOP,pythonAttribute,pythonImportedObject,pythonImportedFuncDef,pythonImportedClassDef,pythonImportedModule
syntax cluster impsortObjects contains=pythonImportedObject,pythonImportedFuncDef,pythonImportedClassDef,pythonImportedModule
syntax match impsortNonImport #\.\k\+# transparent contains=TOP,pythonAttribute,@impsortObjects

" Prevents imports from being matched in the first part of `from ... import`
" lines. `pythonInclude` is the built-in syntax's name. `pythonImport` is
" from the `python-syntax` plugin.
silent! syntax clear pythonInclude pythonImport
silent! syntax clear pythonInclude pythonImport pythonDecorator
syntax keyword pythonImport contained from
syntax keyword pythonImport import
syntax match pythonIncludeLine #\<from\s\+\S\+\s# transparent contains=pythonImport

syntax region pythonDecorator start=#@# end=#$# oneline contains=@impsortObjects,pythonDottedName,pythonFunction

" Highlight links should cover both syntax sources without screwing up user
" defined highlights
highlight default link pythonImport pythonInclude
Expand Down

0 comments on commit 7dda066

Please sign in to comment.