Created
August 4, 2015 18:07
-
-
Save magnunleno/e593ea6e49e3addde28e to your computer and use it in GitHub Desktop.
VIM's Python syntax customizations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Match (only 'bar') in function calls like: 'foo.bar()' or 'bar()' | |
syn match pythonFunction /\(^\s*\(def\|class\)\s*\w*\)\@<!\w\{1,}\ze(/ | |
" Match dunder methods/attributes | |
syn match pythonBuiltin "__\w*__" | |
" Match under methods/attributes | |
syn match pythonIdentifier "_\w*_" | |
" Match self (not in function declarations) | |
syn match pythonFunction /\(^\s*def \s*\w*\s*(\)\@<!self/ | |
" Match self in function declarations | |
syn match pythonIgnore /\(^\s*def \s*\w*\s*(\)\@<=self\ze\s*[,)]/ | |
" Pseudo-consants in python (Capital letters variables) | |
syn match pythonConstant /\<[A-Z_][A-Z_0-9]*\>/ | |
hi link pythonIgnore Ignore | |
hi link pythonIdentifier Identifier | |
hi link pythonConstant Constant |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment