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?
VimScript provides the ruby command that can be used to execute some Ruby code. Instead of using another VimScript function we can instead refer to it as a Ruby function or executed Ruby code. For a single line of Ruby code we can use the ruby command followed by your Ruby code.
After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.
The facts: Vim is the number one code editing tool for Ruby developers. Ruby has its own tool. If you're wondering what text editor or IDE rubyists are using, you might think that they are using their own dedicated editor. JetBrains, the company behind IntelliJ, is offering in this matter RubyMine.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With