(Change to TipImported template + severe manual clean) |
(Adjust previous/next navigation) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
|id=1120 |
|id=1120 |
||
|previous=1119 |
|previous=1119 |
||
− | |next= |
+ | |next=1126 |
|created=February 4, 2006 |
|created=February 4, 2006 |
||
|complexity=intermediate |
|complexity=intermediate |
||
Line 9: | Line 9: | ||
|version=5.7 |
|version=5.7 |
||
|rating=1/10 |
|rating=1/10 |
||
+ | |category1=Python |
||
+ | |category2= |
||
}} |
}} |
||
Did you ever notice how syntax highlight of the whole screen below current line changes when you start a string line (at least, in .py Python files)? Vim thinks the rest of the screen is inside a string and highlights it as such. I find this extremely annoying and I found a very neat fix: you have to edit the syntax file for Python (or some other language), and add 'oneline' to the relevant line: |
Did you ever notice how syntax highlight of the whole screen below current line changes when you start a string line (at least, in .py Python files)? Vim thinks the rest of the screen is inside a string and highlights it as such. I find this extremely annoying and I found a very neat fix: you have to edit the syntax file for Python (or some other language), and add 'oneline' to the relevant line: |
||
Line 25: | Line 27: | ||
Just map the sting delimiter key to produce a pair of them and position you between them. |
Just map the sting delimiter key to produce a pair of them and position you between them. |
||
<pre> |
<pre> |
||
− | inoremap " "" |
+ | inoremap " ""<Esc>i |
</pre> |
</pre> |
||
Line 31: | Line 33: | ||
---- |
---- |
||
− | [[Category:Python]] |
Latest revision as of 02:51, 20 July 2009
created February 4, 2006 · complexity intermediate · author AK · version 5.7
Did you ever notice how syntax highlight of the whole screen below current line changes when you start a string line (at least, in .py Python files)? Vim thinks the rest of the screen is inside a string and highlights it as such. I find this extremely annoying and I found a very neat fix: you have to edit the syntax file for Python (or some other language), and add 'oneline' to the relevant line:
syn region pythonString matchgroup=Normal start=+[uU]\='+ end=+'+ skip=+\\\\\|\'+ contains=pythonEscape oneline syn region pythonString matchgroup=Normal start=+[uU]\="+ end=+"+ skip=+\\\\\|\\"+ contains=pythonEscape oneline
This way, only the current line will change, from cursor to the end of line. Usually you're entering the string at the end of line, so you'll have no changes in syntax at all.
Comments[]
But then you lose the ability to see when you've forgotten to close a quote, etc.
Just map the sting delimiter key to produce a pair of them and position you between them.
inoremap " ""<Esc>i
That way you do not forget to close the string and you do not have the syntax coloring problem.