Browse files

Add syntax highlighting to certain file types

* Syntax highlight `Appraisals` as Ruby. Used especially for our open
  source libraries.
* Syntax highlight rackup (``) files as Ruby. Used in all our
  Ruby web apps. Rails apps are rarely touched but some of the Sinatra
  and Middleman apps are occasionally edited.
* Syntax highlight JSON files as JavaScript. Used in our Trail Map.
  • Loading branch information...
1 parent ce425d6 commit 989a49d2f033077a82de43d47894cff20fcf2068 @croaky croaky committed Jul 27, 2013
Showing with 3 additions and 0 deletions.
  1. +3 −0 vimrc
3 vimrc
@@ -42,6 +42,9 @@ augroup vimrcEx
autocmd User Rails Rnavcommand config config -glob=**/* -suffix=.rb -default=routes
" Set syntax highlighting for specific file types
+ autocmd BufRead,BufNewFile Appraisals set filetype=ruby
+ autocmd BufRead,BufNewFile set filetype=ruby
+ autocmd BufRead,BufNewFile *.json set filetype=javascript
thoughtbot, inc. member and *json are already handled for me.

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Nov 22 2012 14:53:26)
Included patches: 1-547
thoughtbot, inc. member
gylaz added a note Jul 29, 2013

Just noticed that these are handled for me already, as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
autocmd BufRead,BufNewFile *.md set filetype=markdown
" Enable spellchecking for Markdown

6 comments on commit 989a49d

thoughtbot, inc. member

Mike, I think I'm on the same version of vim as you:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 22 2012 15:36:46)
Compiled by

I'm not doing anything to my vim settings that aren't in thoughtbot/dotfiles. Mike and Greg, any other ideas where your syntax highlighting might be coming from?

thoughtbot, inc. member

I have this in /usr/share/vim/vim73/filetype.vim:

au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx,*.json   setf javascript
" ...
au BufNewFile,BufRead *.ru          setf ruby
thoughtbot, inc. member

I don't see the same setting that @mike-burns is seeing in that same file. I'm running terminal version of MacVim, which might do things differently.

thoughtbot, inc. member

Okay, cool. It seems like we need some kind of setting for it then in thoughtbot/dotfiles for plain-vim-in-the-shell users like myself so I won't revert this.

thoughtbot, inc. member

Sorry, I thought that filetype.vim was a custom Mike setting but I see it's from his Vim 7.3. Mine:

" HTML with Ruby - eRuby
au BufNewFile,BufRead *.erb,*.rhtml setf eruby

" Interactive Ruby shell
au BufNewFile,BufRead .irbrc,irbrc setf ruby

" Ruby
au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec setf ruby

" JavaScript, ECMAScript
au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx setf javascript

I'll try upgrading vim.

thoughtbot, inc. member

@mike-burns @gylaz Thanks for this catch. I just followed up with #180

Please sign in to comment.