Skip to content

Instantly share code, notes, and snippets.

@alpaca-tc
Created July 11, 2013 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alpaca-tc/5975234 to your computer and use it in GitHub Desktop.
Save alpaca-tc/5975234 to your computer and use it in GitHub Desktop.
function! s:do_rails_autocmd()
if !exists("b:rails_root")
return
endif
let buf = rails#buffer()
let type = "-" . buf.type_name()
let path = '/' . buf.name()
if path =~ '[ !#$%\,]'
let path = ''
endif
if type != '-'
execute "silent doautocmd User Rails" . s:gsub(type, '-', '.')
endif
if path != ''
execute "silent doautocmd User Rails" . path
endif
endfunction
autocmd User Rails call s:do_rails_autocmd()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment