语法 - 在vim折叠行中突出显示Python [英] Syntax-highlight Python in a vim fold line

查看:230
本文介绍了语法 - 在vim折叠行中突出显示Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现和答案因为折叠标题实际上不是文件的一部分所以不可能,因此荧光笔永远不会扫描。 :(


I have found that code-folding helps me organize my files better. Thus, at the bottom of my ~/.vimrc, I enable vim code folding by default:

""Folding
set foldmethod=indent
set foldnestmax=2
nnoremap <space> za
vnoremap <space> zf
"set nofoldenable       "set this to disable folding on file open

This has the advantages of using SPACE to toggle folds at the cursor, or if they start to annoy me I can use zR to unfold everything.

However, I'm also addicted to syntax highlighting. I use Dmitry Vasiliev's python.vim, but it doesn't highlight syntax in a fold line:

The lack of syntax highlighting for Field('id', type='integer', unique=True, notnull=True), makes it hard on my eyes when I'm used to seeing the highlight colors

What I'm looking for is a python.vim that supports syntax highlighting on a fold summary... if it Dmitry's did, it would highlight the strings in green something like this:

I want to continue using foldmethod=indent, if possible. Is there a way to get syntax highlights on fold summaries? Perhaps another python.vim?

解决方案

This question was asked previously and the answer was that it's not possible since the fold headline is not actually part of the file, thus never gets scanned by the highlighter. :(

这篇关于语法 - 在vim折叠行中突出显示Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆