Search code examples
vimsyntaxsyntax-highlightingcolor-scheme

How to set manualy color of params[] and redirect_to in Vim?


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?


Solution

  • 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.