开发者

Ruby-like Syntax Highlighting in VIM for Thor

开发者 https://www.devze.com 2023-02-07 07:44 出处:网络
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

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 conditional开发者_如何学Pythonly set the syntax to ruby if it's *.thor? Maybe create a thor syntax file and inherit from ruby?


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


autocmd BufNewFile,BufRead *.thor set syntax=ruby

should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号