Browse files

Add syntax highlighting to certain file types

* Syntax highlight `Appraisals` as Ruby. Used especially for our open
  source libraries.
* Syntax highlight rackup (`config.ru`) 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
View
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 config.ru set filetype=ruby
+ autocmd BufRead,BufNewFile *.json set filetype=javascript
@mike-burns
thoughtbot, inc. member

config.ru 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
@gylaz
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

@croaky
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 root@apple.com

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?

@mike-burns
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
@gylaz
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.

@croaky
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.

@croaky
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.

@croaky
thoughtbot, inc. member

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

Please sign in to comment.