From a242c3e905da986aaebf05d4f1c136fdc5b14184 Mon Sep 17 00:00:00 2001 From: Ludovic Koenig Date: Wed, 11 Sep 2019 22:05:46 +0200 Subject: [PATCH 1/4] Add some supports for Python It relinks some default syntax groups and defines some new ones. It especially deals with functions, classes and decorators. --- after/syntax/python.vim | 16 ++++++++++++++++ colors/odyssey.vim | 13 ++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 after/syntax/python.vim diff --git a/after/syntax/python.vim b/after/syntax/python.vim new file mode 100644 index 0000000..25ddf24 --- /dev/null +++ b/after/syntax/python.vim @@ -0,0 +1,16 @@ +" +" Maintainer: Ludovic Koenig +" Version: 0.5.0 +" Since: 0.5.0 +" License: MIT +" +" Python Syntax {{{ + +syntax keyword pythonOdysseySelf self +syntax match pythonOdysseyFunction '\<\l\w*\>('me=e-1 +syntax match pythonOdysseyType '\<\u\w*\>' +syntax keyword pythonStatement class nextgroup=pythonOdysseyClass skipwhite +syntax match pythonOdysseyClass "\<\u\w*\>" + +" }}} +" vim: foldmethod=marker diff --git a/colors/odyssey.vim b/colors/odyssey.vim index a0b0c91..8ae9244 100644 --- a/colors/odyssey.vim +++ b/colors/odyssey.vim @@ -293,6 +293,17 @@ else let g:java_ignore_javadoc = 1 endif +" }}} +" Python Highlights {{{ + +call s:h( 'pythonDecorator', 'background', 'warning', 'italic') +call s:h( 'pythonDecoratorName', 'background', 'warning', 'italic') +call s:l( 'pythonInclude', 'Statement') +call s:l('pythonOdysseyFunction', 'Function') +call s:l( 'pythonOdysseySelf', 'Special') +call s:l( 'pythonOdysseyType', 'Type') +call s:l( 'pythonOdysseyClass', 'Type') + " }}} " Ruby Highlights {{{ @@ -309,6 +320,6 @@ call s:l( 'rubyStringDelimiter', 'Constant') call s:l( 'rustLifetime', 'Constant') call s:l( 'rustQuestionMark', 'Operator') call s:l('rustOdysseyFunction', 'Function') -call s:l( 'rustOdysseyType', 'Type') +call s:l( 'rustOdysseyType', 'Type') " }}} " vim: foldmethod=marker From f3f7995cf627d7aada9ab3f94ece027f34a50f16 Mon Sep 17 00:00:00 2001 From: Ludovic Koenig Date: Fri, 13 Sep 2019 19:53:13 +0200 Subject: [PATCH 2/4] Add supports for Python builtin types --- after/syntax/python.vim | 4 ++++ colors/odyssey.vim | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/after/syntax/python.vim b/after/syntax/python.vim index 25ddf24..d238452 100644 --- a/after/syntax/python.vim +++ b/after/syntax/python.vim @@ -6,7 +6,11 @@ " " Python Syntax {{{ +syntax keyword pythonOdysseyNone None +syntax keyword pythonOdysseyBoolean True False +syntax keyword pythonOdysseyBuiltin int float bool str bytes syntax keyword pythonOdysseySelf self +syntax keyword pythonOdysseyPrint print syntax match pythonOdysseyFunction '\<\l\w*\>('me=e-1 syntax match pythonOdysseyType '\<\u\w*\>' syntax keyword pythonStatement class nextgroup=pythonOdysseyClass skipwhite diff --git a/colors/odyssey.vim b/colors/odyssey.vim index 8ae9244..06d5ca4 100644 --- a/colors/odyssey.vim +++ b/colors/odyssey.vim @@ -298,12 +298,18 @@ endif call s:h( 'pythonDecorator', 'background', 'warning', 'italic') call s:h( 'pythonDecoratorName', 'background', 'warning', 'italic') +call s:l( 'pythonOdysseyNone', 'Constant') +call s:l( 'pythonOdysseyBoolean', 'Constant') +call s:l( 'pythonOdysseyBuiltin', 'Type') +call s:l( 'pythonOdysseyPrint', 'Function') call s:l( 'pythonInclude', 'Statement') call s:l('pythonOdysseyFunction', 'Function') call s:l( 'pythonOdysseySelf', 'Special') call s:l( 'pythonOdysseyType', 'Type') call s:l( 'pythonOdysseyClass', 'Type') +let g:python_no_builtin_highlight = 1 + " }}} " Ruby Highlights {{{ From 404dcbb17275947d26579707876c8d0e351ff864 Mon Sep 17 00:00:00 2001 From: Ludovic Koenig Date: Fri, 13 Sep 2019 20:03:21 +0200 Subject: [PATCH 3/4] Add the highlight of Python arrow '->' It adds the highlight of the arrow from the type hint system. --- after/syntax/python.vim | 1 + colors/odyssey.vim | 1 + 2 files changed, 2 insertions(+) diff --git a/after/syntax/python.vim b/after/syntax/python.vim index d238452..3b08bf0 100644 --- a/after/syntax/python.vim +++ b/after/syntax/python.vim @@ -11,6 +11,7 @@ syntax keyword pythonOdysseyBoolean True False syntax keyword pythonOdysseyBuiltin int float bool str bytes syntax keyword pythonOdysseySelf self syntax keyword pythonOdysseyPrint print +syntax match pythonOdysseyArrow '->' syntax match pythonOdysseyFunction '\<\l\w*\>('me=e-1 syntax match pythonOdysseyType '\<\u\w*\>' syntax keyword pythonStatement class nextgroup=pythonOdysseyClass skipwhite diff --git a/colors/odyssey.vim b/colors/odyssey.vim index 06d5ca4..99971c1 100644 --- a/colors/odyssey.vim +++ b/colors/odyssey.vim @@ -302,6 +302,7 @@ call s:l( 'pythonOdysseyNone', 'Constant') call s:l( 'pythonOdysseyBoolean', 'Constant') call s:l( 'pythonOdysseyBuiltin', 'Type') call s:l( 'pythonOdysseyPrint', 'Function') +call s:l( 'pythonOdysseyArrow', 'Keyword') call s:l( 'pythonInclude', 'Statement') call s:l('pythonOdysseyFunction', 'Function') call s:l( 'pythonOdysseySelf', 'Special') From 586cf2d69c4f0f649e15333fc3b925acc1732ec5 Mon Sep 17 00:00:00 2001 From: Ludovic Koenig Date: Fri, 13 Sep 2019 20:15:03 +0200 Subject: [PATCH 4/4] Update the CHANGELOG with the last changes --- CHANGELOG.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dacd71..e393aee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,17 @@ project adheres to [Semantic Versioning]. ### Added -- Adds some supports for the Rust programming language: +- Add some supports for the Python programming language. The use of highlights + for builtin elements have been disabled by the instruction: + + ``` + let g:python_no_builtin_highlight = 1 + ``` + + Plus, The `print` function is considered to be a function and not a + statement. It means that there is no support for Python 2 `print` statement. + +- Add some supports for the Rust programming language: + Some already existing syntax groups have been cleared to provide highlighting only for important items. @@ -20,7 +30,7 @@ project adheres to [Semantic Versioning]. - Add the support for the Java method references by using the `Type` and `Function` highlight groups. -- Adds three Java syntax groups in order to be able to fold multiline +- Add three Java syntax groups in order to be able to fold multiline comments, `import` statement blocks and `import static` statement blocks. ### Changed @@ -34,7 +44,7 @@ project adheres to [Semantic Versioning]. ``` *Note*: `g:odyssey_java_javadoc` must be different from `0` to enable the - highlighting of the Javadoc. + highlighting of the Javadoc. - Change the name of some of the Java syntax group added by the plugin.