Ruby-like Syntax Highlighting in VIM for Thor
Asked Answered
A

2

6

How can I configure vim to use the same syntax highlighting for Thor as it does for ruby? When I'm editing a *.thor file, I can use :set syntax=ruby, which works, but is not permanent. Is there a way to do something in my .vimrc file to conditionally set the syntax to ruby if it's *.thor? Maybe create a thor syntax file and inherit from ruby?

Ancillary answered 27/1, 2011 at 22:18 Comment(0)
E
12
au BufRead,BufNewFile *.thor set filetype=ruby

I think should suffice... maybe this if you want to customize it later:

au BufRead,BufNewFile *.thor set filetype=thor
au! Syntax thor source $HOME/.vim/syntax/thor.vim

and copy ruby .vim syntax highlight file to $HOME/.vim/syntax/thor.vim

Ese answered 27/1, 2011 at 22:21 Comment(1)
Thanks, the first part was all I needed. This way is actually better than just setting the syntax because it takes care of indenting too.Ancillary
M
4
autocmd BufNewFile,BufRead *.thor set syntax=ruby

should work.

Mudlark answered 27/1, 2011 at 22:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.