将 pygments 主题转换为 gvim colorcheme
有没有任何工具可以将 pygments 样式定义转换为 gvim 颜色方案?
我找到了 vim2pygments,它将 vim colorchemes 转换为 pygments 主题,但我还没有发现任何相反的东西。具体来说,我使用的是 macvim,尽管我想象任何 gvim 衍生品的颜色方案格式都是相同的(如果我错了,请纠正我)。
Are there any tools to convert a pygments style definition into a gvim colorscheme?
I found vim2pygments, which converts vim colorschemes to pygments themes, but I haven't found anything doing the inverse. Specifically, I'm using macvim, though I imagine the colorscheme format would be the same for any gvim-derivative (please, correct me if I'm wrong).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还没有遇到任何可以自动化这个过程的东西,但是手动完成应该很容易。获取现有的配色方案,将其粘贴到
~/.vim/colors/
目录中,并将 pygments 方案中定义的颜色放入适当的位置。例如,如果您使用我的配色方案 (使用非标准格式使其更具可编辑性)并使其使用 pygments 秋季方案,您可以采用如下所示的行:
并将其更改为如下所示:(
我已经删除了颜色终端分配,正如您所说的那样,您正在使用GUI,因此很大程度上无关)。
看完整套应该不会花很长时间。我的配色方案主要是为深色背景设计的(如果切换到浅色背景,它会调整颜色),但摆脱这个方面并不难:将“正常”突出显示更改为白色上的黑色而不是白色黑底白字并删除
s:MakeDarker
函数和if &background == 'light'
块中的位。或者,您可以使用普通语法突出显示格式执行类似的操作,方法是采用(例如)darkblue.vim 并更改(例如):
并将其更改为:
I haven't come across anything that will automate this process, but it should be very easy to do by hand. Grab an existing colour scheme, stick it in your
~/.vim/colors/
directory and put the colours that are defined in the pygments scheme into the appropriate places.For example, if you use my colour scheme (which uses a non-standard format to make it more editable) and make it uses the pygments autumn scheme, you could take the line that looks like this:
and change it to look like this:
(I've removed the colour terminal assignment as you've said you're using a GUI and it is thus largely irrelevant).
It shouldn't take very long to go through the whole set. My colour scheme is designed for dark backgrounds primarily (it adjusts colours if you switch to a light background), but it wouldn't be very hard to get rid of this aspect: change the "Normal" highlighting to be black on white rather than white on black and remove the
s:MakeDarker
function and the bit in theif &background == 'light'
block.Alternatively, you could do a similar thing with the normal syntax highlighting format by taking (e.g.) darkblue.vim and changing (e.g.):
and changing it to: