Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 989a49d2f033077a82de43d47894cff20fcf2068 1 parent ce425d6
Dan Croak croaky authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  vimrc
3  vimrc
View
@@ -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 Admin

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
Greg Lazarev Admin
gylaz added a note

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

Mike Burns
Admin

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
Greg Lazarev
Admin

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

Dan Croak
Admin

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
Admin

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
Greg Lazarev
Admin

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.

Dan Croak
Admin

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.

Dan Croak
Admin

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.

Dan Croak
Admin

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

Please sign in to comment.
Something went wrong with that request. Please try again.