如何在 Vim 中设置 params[] 和 redirect_to 的手动颜色? [英] How to set manualy color of params[] and redirect_to in Vim?

查看:26
本文介绍了如何在 Vim 中设置 params[] 和 redirect_to 的手动颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的配色方案 ->

params[]redirect_to 是彩色的.

如何实现这一目标?

问题在于文件类型.相关 -> Ultisnips break rails 语法.如何正确设置?

解决方案

正如其标题中所指定的,这个颜色方案是RailsCasts TextMate 主题到 Vim 的仅 GUI 端口.".

GUI 颜色方案(用于 GVim 或 MacVim)可以使用数千种颜色.如果你想让 Vim 看起来像官方截图,你需要使用 GVim.

但您似乎在终端模拟器中使用它,该模拟器最多只能显示 256 种颜色.为了让这个仅限 GUI"的颜色方案在你的终端中工作,你可能有一个像 CSApprox 这样的颜色转换插件,对吗?此类插件将尽最大努力将您的 GUI 颜色与 X11 集 中最接近的等价物匹配,但这任务显然不是万无一失.坦率地说,有些颜色可能会偏离,我几乎可以肯定这就是这里发生的情况.

编辑

首先,我不使用 Ruby,即使在 Rails 上也是如此.

其次,params[:comment]params的语法组取决于文件类型:

  • 如果我有 :set ft=ruby.rails:

    rubyBlock、rubyMethodBlock、rubyLocalVariableOrMethod

  • 如果我有 :set ft=ruby:

    rubyBlock、rubyMethodBlock、rubyRailsMethod

问题在于,与 rubyRailsMethod 不同,默认 ruby​​ 语法文件中定义的 rubyLocalVariableOrMethod 似乎没有链接到 Function,从导轨插件.

所以我认为是 rubyLocalVariableOrMethod 导致了问题.我一直在我的机器上环顾四周,似乎无法找到在 ft=ruby.rails 时如何、为什么和由谁设置它而不是 rubyRailsMethod.

在等待真正的解决方案时,有一个全局设置用于在 :set ft=ruby 时使用 rails 补全,我认为它应该有帮助:let g:rubycomplete_rails = 1.

This is my colorscheme -> https://gist.github.com/1973544

But in example screenshot of sexy-railscasts: https://github.com/oguzbilgic/sexy-railscasts-theme

params[] and redirect_to are colored.

How to achieve this?

EDIT: Problem is with filetypes. Releated -> Ultisnips break rails syntax. How to setup correctly?

解决方案

This colorscheme is, as specified in its header, "A GUI Only port of the RailsCasts TextMate theme to Vim.".

GUI colorschemes (for GVim or MacVim) can make use of thousands of colors. If you want to make Vim look like in the official screenshot you'll need to use GVim.

But you appear to be using it in a terminal emulator which can only display a maximum of 256 colors. For this "GUI Only" colorscheme to even work in your terminal, you probably have a color conversion plugin like CSApprox, do you? Such plugins will do their best to match your GUI colors to their closest equivalent in the X11 set but this task is obviously not foolproof. Some colors may be frankly off and I'm almost certain that's what's happening here.

EDIT

First, I don't do Ruby, even on Rails.

Second, the syntax group of params in params[:comment] depends on the filetype:

  • if I have :set ft=ruby.rails:

    rubyBlock, rubyMethodBlock, rubyLocalVariableOrMethod
    

  • if I have :set ft=ruby:

    rubyBlock, rubyMethodBlock, rubyRailsMethod
    

The problem is that rubyLocalVariableOrMethod, as defined in the default ruby syntax file appears to not being linked to Function unlike rubyRailsMethod, from the rails plugin.

So I think that it's the rubyLocalVariableOrMethod that is causing problems. I've been looking around on my machine and can't seem to find how, why and by whom it is set instead of rubyRailsMethod when ft=ruby.rails.

While waiting for a real solution, there is a global setting for using rails completion when :set ft=ruby, I think it should help: let g:rubycomplete_rails = 1.

这篇关于如何在 Vim 中设置 params[] 和 redirect_to 的手动颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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