vim - how to treat three quotations in a row as a comment rather than a string

user216485

I use python and in python, three quotation marks in a row

"""

or

'''

signify a block-comment, and a normal comment is just a hashtag. (#) I want comments to be colored grey and strings to be colored orange. I am using the colorscheme murphy. I made a murphy-mine.vim file and I added this to it

hi Comment term=bold     ctermfg=Grey     guifg=Grey
hi String  term=bold     ctermfg=LightRed guifg=Orange

But gvim sees """ and ''' as a string in python syntax rather than treating it as a comment (block comment). Is there a way for me to tell gvim to see """ and ''' as a comment / block comment rather than a string?

Ingo Karkat

You can put the following into ~/.vim/after/syntax/python.vim (taken from here:

" Highlight docstrings as comments, not string.
syn region pythonDocstring  start=+^\s*[uU]\?[rR]\?"""+ end=+"""+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError
syn region pythonDocstring  start=+^\s*[uU]\?[rR]\?'''+ end=+'''+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError

hi def link pythonDocstring pythonComment

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Evaluate value of observable as a variable rather than a string

분류에서Dev

Express 4: How to upload file to memory (e.g. as a UTF-8 string) rather than disk?

분류에서Dev

Is it possible to show data by row rather than per column?

분류에서Dev

Is there a memory penalty to use a string rather than a StringBuilder inside a loop?

분류에서Dev

How to use host names rather than ip addresses on home network?

분류에서Dev

how to use Django Hitcount in a function based view rather than a class?

분류에서Dev

How to pass an array to a function as an actual parameter rather than a global variable

분류에서Dev

How to build openssl with clang(rather than gcc) on a FreeBSD machine?

분류에서Dev

How to save multiple files to database rather than disk

분류에서Dev

Sending a string that contains quotations to a file with VBA

분류에서Dev

Why Java's String has the method length() rather than property length (like an array?)

분류에서Dev

How to get an alert when there are three images in a row

분류에서Dev

How to show full results, rather than matched text from regex searches in python

분류에서Dev

How can I implement Deleting files to the Recycle bin rather than Permanently deleting?

분류에서Dev

How can I make Xamarin show the hamburger icon rather than the back button?

분류에서Dev

How can I get PyCharm to use the Vagrant Directories rather than my development machines?

분류에서Dev

How to make image upload directly while choosing image rather than pressing upload button in JQuery

분류에서Dev

How to force call superclass implementation Object.toString() rather than subclass overriding implementation on an object in Java

분류에서Dev

How do I achive this exact behavior using divs, rather than using table, tr, and td?

분류에서Dev

How to force call superclass implementation Object.toString() rather than subclass overriding implementation on an object in Java

분류에서Dev

How to tail/grep/awk the last N bytes of a file, rather than lines

분류에서Dev

How to get Word to do line break on Enter rather than paragraph break?

분류에서Dev

How to have AngularJS router update a controller value upon navigation, rather than reloading the entire controller?

분류에서Dev

How would I open my Chrome app in split screen rather than a new window?

분류에서Dev

How do I get this CSS/jQuery menu to open only on click, rather than hover?

분류에서Dev

How do I display calculated values in plain numbers rather than powers in Android.?

분류에서Dev

How to link python to the manually compiled OpenSSL rather than the system's one

분류에서Dev

How can I change the sound volume pressing rather than clicking on keyboard?

분류에서Dev

How to increase speed of code using data structures rather than for-next loops?

Related 관련 기사

  1. 1

    Evaluate value of observable as a variable rather than a string

  2. 2

    Express 4: How to upload file to memory (e.g. as a UTF-8 string) rather than disk?

  3. 3

    Is it possible to show data by row rather than per column?

  4. 4

    Is there a memory penalty to use a string rather than a StringBuilder inside a loop?

  5. 5

    How to use host names rather than ip addresses on home network?

  6. 6

    how to use Django Hitcount in a function based view rather than a class?

  7. 7

    How to pass an array to a function as an actual parameter rather than a global variable

  8. 8

    How to build openssl with clang(rather than gcc) on a FreeBSD machine?

  9. 9

    How to save multiple files to database rather than disk

  10. 10

    Sending a string that contains quotations to a file with VBA

  11. 11

    Why Java's String has the method length() rather than property length (like an array?)

  12. 12

    How to get an alert when there are three images in a row

  13. 13

    How to show full results, rather than matched text from regex searches in python

  14. 14

    How can I implement Deleting files to the Recycle bin rather than Permanently deleting?

  15. 15

    How can I make Xamarin show the hamburger icon rather than the back button?

  16. 16

    How can I get PyCharm to use the Vagrant Directories rather than my development machines?

  17. 17

    How to make image upload directly while choosing image rather than pressing upload button in JQuery

  18. 18

    How to force call superclass implementation Object.toString() rather than subclass overriding implementation on an object in Java

  19. 19

    How do I achive this exact behavior using divs, rather than using table, tr, and td?

  20. 20

    How to force call superclass implementation Object.toString() rather than subclass overriding implementation on an object in Java

  21. 21

    How to tail/grep/awk the last N bytes of a file, rather than lines

  22. 22

    How to get Word to do line break on Enter rather than paragraph break?

  23. 23

    How to have AngularJS router update a controller value upon navigation, rather than reloading the entire controller?

  24. 24

    How would I open my Chrome app in split screen rather than a new window?

  25. 25

    How do I get this CSS/jQuery menu to open only on click, rather than hover?

  26. 26

    How do I display calculated values in plain numbers rather than powers in Android.?

  27. 27

    How to link python to the manually compiled OpenSSL rather than the system's one

  28. 28

    How can I change the sound volume pressing rather than clicking on keyboard?

  29. 29

    How to increase speed of code using data structures rather than for-next loops?

뜨겁다태그

보관