Title: Add pythonStringModifier group · Issue #95 · vim-python/python-syntax · GitHub
Open Graph Title: Add pythonStringModifier group · Issue #95 · vim-python/python-syntax
X Title: Add pythonStringModifier group · Issue #95 · vim-python/python-syntax
Description: The single-letter prefixes in Python3 are a bit nuts, and get lost in the code. I played aroung a bit and found that I can add a pythonStringModifier group to catch these (and highlight them in a strong color, like Operator). The solutio...
Open Graph Description: The single-letter prefixes in Python3 are a bit nuts, and get lost in the code. I played aroung a bit and found that I can add a pythonStringModifier group to catch these (and highlight them in a s...
X Description: The single-letter prefixes in Python3 are a bit nuts, and get lost in the code. I played aroung a bit and found that I can add a pythonStringModifier group to catch these (and highlight them in a s...
Opengraph URL: https://github.com/vim-python/python-syntax/issues/95
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add pythonStringModifier group","articleBody":"The single-letter prefixes in Python3 are a bit nuts, and get lost in the code.\r\nI played aroung a bit and found that I can add a `pythonStringModifier` group to catch these (and highlight them in a strong color, like `Operator`).\r\n\r\nThe solution requires defining said group as `contained` and adding that group to the `contains` list for all of the various string groups defined in the syntax file. Here's a snippet for `after/syntax/python.vim` that doesn't cover python 2 or multi-letter cases like `fr\"`. Maybe such an approach could be added in a more complete way to support this, if there is interest.\r\n\r\n```vim\r\nsyn match pythonStringModifier '\\\u003c[brf]\"'me=e-1 contained\r\nsyn region pythonFString start=+[fF]'+ skip=+\\\\\\\\\\|\\\\'\\|\\\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell,pythonStringModifier\r\nsyn region pythonFString start=+[fF]\"+ skip=+\\\\\\\\\\|\\\\\"\\|\\\\$+ excludenl end=+\"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell,pythonStringModifier\r\nsyn region pythonFString start=+[fF]'''+ skip=+\\\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell,pythonStringModifier\r\nsyn region pythonFString start=+[fF]\"\"\"+ skip=+\\\\\"+ end=+\"\"\"+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell,pythonStringModifier\r\nsyn region pythonBytes start=+[bB]'+ skip=+\\\\\\\\\\|\\\\'\\|\\\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell,pythonStringModifier\r\nsyn region pythonBytes start=+[bB]\"+ skip=+\\\\\\\\\\|\\\\\"\\|\\\\$+ excludenl end=+\"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell,pythonStringModifier\r\nsyn region pythonBytes start=+[bB]'''+ skip=+\\\\'+ end=+'''+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell,pythonStringModifier\r\nsyn region pythonBytes start=+[bB]\"\"\"+ skip=+\\\\\"+ end=+\"\"\"+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell,pythonStringModifier\r\nsyn region pythonRawString start=+[rR]'+ skip=+\\\\\\\\\\|\\\\'\\|\\\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell,pythonStringModifier\r\nsyn region pythonRawString start=+[rR]\"+ skip=+\\\\\\\\\\|\\\\\"\\|\\\\$+ excludenl end=+\"+ end=+$+ keepend contains=pythonRawEscape,@Spell,pythonStringModifier\r\nsyn region pythonRawString start=+[rR]'''+ skip=+\\\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell,pythonStringModifier\r\nsyn region pythonRawString start=+[rR]\"\"\"+ skip=+\\\\\"+ end=+\"\"\"+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell,pythonStringModifier\r\n\r\nhi link pythonStringModifier Operator\r\n```\r\n","author":{"url":"https://github.com/adigitoleo","@type":"Person","name":"adigitoleo"},"datePublished":"2023-08-07T15:43:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/95/python-syntax/issues/95"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0580801d-033a-e0a8-fce6-5a24cff2cc88 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C048:15B1C2:342395F:438216E:696CCFD6 |
| html-safe-nonce | 85c17317fd7a4af073ee880910225a7323369bd990983976b5ac08632f34a37a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDQ4OjE1QjFDMjozNDIzOTVGOjQzODIxNkU6Njk2Q0NGRDYiLCJ2aXNpdG9yX2lkIjoiMTc4MTY2ODUwMjA4NDUyNTY2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5af7b60571241601fa431c0fa896b1515855f21b5a7fbd52a74646fdea67f88d |
| hovercard-subject-tag | issue:1839751117 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/vim-python/python-syntax/95/issue_layout |
| twitter:image | https://opengraph.githubassets.com/20cef227fc33ea418f9953ce5024a20992c38edd983d70b486477ab0e7261f40/vim-python/python-syntax/issues/95 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/20cef227fc33ea418f9953ce5024a20992c38edd983d70b486477ab0e7261f40/vim-python/python-syntax/issues/95 |
| og:image:alt | The single-letter prefixes in Python3 are a bit nuts, and get lost in the code. I played aroung a bit and found that I can add a pythonStringModifier group to catch these (and highlight them in a s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | adigitoleo |
| hostname | github.com |
| expected-hostname | github.com |
| None | 31994babd8463b50f2371f63aab0826561f4efe3981ac0ebc4c33e6c41032dbd |
| turbo-cache-control | no-preview |
| go-import | github.com/vim-python/python-syntax git https://github.com/vim-python/python-syntax.git |
| octolytics-dimension-user_id | 25825542 |
| octolytics-dimension-user_login | vim-python |
| octolytics-dimension-repository_id | 82203847 |
| octolytics-dimension-repository_nwo | vim-python/python-syntax |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 82203847 |
| octolytics-dimension-repository_network_root_nwo | vim-python/python-syntax |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f5a202c3c4aefc9cf00c8c78951a1e72eaebebeb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width