Closed asok closed 11 years ago
Yeah, I guess it would be possible to rip the full list of keywords out of https://github.com/tpope/vim-rails/blob/master/autoload/rails.vim, then apply font-lock-add-keywords
to them in any rinari
ruby-mode
buffer... Rinari doesn't really have the same concept of "current buffer type", so it wouldn't be easy to use subsets of keywords specific to models, tests etc.
If you call font-lock-add-keywords
with nil major-mode it will fontify only the current buffer. We might call it from the find-file-hook
and apply just some keywords based on the current buffer's file path.
I've added second commit that should capture word boundaries in ruby correctly.
Does that work for you with the regular ruby mode? It doesn't work for me.
I've been fiddling with it to tidy things up and get things working, but I haven't managed it yet; here are my changes so far: e3415d68badf5a. Among other changes, I've borrowed the matching logic from ruby-mode
(note that regexp-opt
is a clever little function); the generated regexes work beautifully in M-x regex-builder
, but not when included in the font lock keywords...
Actually I'm using this qoobaa/ruby-mode and both mine code and yours are working with it.
Yeah, this works for me in a clean Emacs instance, so it's clashing with something else.
I've merged your changes to master now - thanks! :-)
You're welcome :)
There's only one thing missing that are views. Here https://github.com/asok/rinari/commit/85a2ea23cde03758c47e7ff9ad98696280569ed8 I've added keywords for views. I'm not using mmm-mode
but rather rhtml-mode
and haml-mode
. In the *.erb
files it looks nice. But in *.haml
it's not. = render
is not highlighted. But just render
yes.
vim-rails has got really nice syntax highlighting for words specific to rails like belongs_to, redirect_to and so on. Should rinari define additional keywords or it is more a case of individual setup?