How to set manualy color of params[] and redirect_

2019-06-08 19:56发布

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

This is my vim window

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

sexy-railscasts

params[] and redirect_to are colored.

How to achieve this?

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

2条回答
做个烂人
2楼-- · 2019-06-08 20:05

I believe that is from the rails.vim plugin.

查看更多
做个烂人
3楼-- · 2019-06-08 20:27

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.

查看更多
登录 后发表回答