Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

only load rails snippets if vim starts in a rails env

  • Loading branch information...
commit 9f7314c5624a079ad779468eee2f05424e515323 1 parent 56c3bbc
@scrooloose authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 vimrc
View
17 vimrc
@@ -200,10 +200,19 @@ nnoremap Y y$
"snipmate setup
source ~/.vim/snippets/support_functions.vim
-autocmd vimenter * call ExtractSnips("~/.vim/snippets/ruby-rails", "ruby")
-autocmd vimenter * call ExtractSnips("~/.vim/snippets/html", "eruby")
-autocmd vimenter * call ExtractSnips("~/.vim/snippets/html", "xhtml")
-autocmd vimenter * call ExtractSnips("~/.vim/snippets/html", "php")
+autocmd vimenter * call s:SetupSnippets()
+function! s:SetupSnippets()
+
+ "if we're in a rails env then read in the rails snippets
+ if filereadable("./config/environment.rb")
+ call ExtractSnips("~/.vim/snippets/ruby-rails", "ruby")
+ call ExtractSnips("~/.vim/snippets/eruby-rails", "eruby")
+ endif
+
+ call ExtractSnips("~/.vim/snippets/html", "eruby")
+ call ExtractSnips("~/.vim/snippets/html", "xhtml")
+ call ExtractSnips("~/.vim/snippets/html", "php")
+endfunction
"visual search mappings
function! s:VSetSearch()
Please sign in to comment.
Something went wrong with that request. Please try again.