Вопрос

I'm trying to modify the python.vim syntax file so that "is not" is highlighted as single pythonOperator.

For example, this is what happen now:

this is what happen now

I've tried changing python.vim in several ways. For example:

--- python.vim.orig 2013-08-19 10:21:54.379892386 -0700                                                                                                   
+++ python.vim  2013-08-19 10:21:58.979892308 -0700
@@ -152,6 +152,7 @@ 
 syn keyword pythonPreCondit     import from
 syn keyword pythonException     try except finally
 syn keyword pythonOperator      and in is not or 
+syn match   pythonOperator      "is not"

 if s:Python2Syntax()
 if !s:Enabled("g:python_print_as_function")

But nothing seems to work.

What's interesting is that if I remove "is" and "not" and all the other python.vim syntax files, as in:

--- python.vim.orig 2013-08-19 10:21:54.379892386 -0700                                                                                                   
+++ python.vim  2013-08-19 10:41:37.067873208 -0700
@@ -151,7 +151,7 @@ 
 syn keyword pythonConditional   if elif else
 syn keyword pythonPreCondit     import from
 syn keyword pythonException     try except finally
-syn keyword pythonOperator      and in is not or 
+syn keyword pythonOperator      and in or 

 if s:Python2Syntax()
   if !s:Enabled("g:python_print_as_function")

The "is" is still highlighted. Weird.

Это было полезно?

Решение

nevermind, turns out vim-cute-python has the line:

syntax clear pythonOperator

That was discarding all my changes to pythonOperator.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top