@@ -1254,14 +1254,6 @@ function! s:Refresh(bang)
12541254 endif
12551255endfunction
12561256
1257- function ! s: RefreshBuffer ()
1258- if exists (" b:rails_refresh" ) && b: rails_refresh
1259- let b: rails_refresh = 0
1260- let &filetype = &filetype
1261- unlet ! b: rails_refresh
1262- endif
1263- endfunction
1264-
12651257" }}}1
12661258" Rake {{{1
12671259
@@ -4013,16 +4005,6 @@ let s:app_prototype.cache = s:cache_prototype
40134005" }}}1
40144006" Syntax {{{1
40154007
4016- function ! s: resetomnicomplete ()
4017- if exists (" +completefunc" ) && &completefunc == ' syntaxcomplete#Complete'
4018- if exists (" g:loaded_syntax_completion" )
4019- " Ugly but necessary, until we have our own completion
4020- unlet g: loaded_syntax_completion
4021- silent ! delfunction syntaxcomplete#Complete
4022- endif
4023- endif
4024- endfunction
4025-
40264008function ! s: app_user_classes () dict
40274009 if self .cache.needs (" user_classes" )
40284010 let controllers = self .relglob (" app/controllers/" ," **/*" ," .rb" )
@@ -5069,8 +5051,20 @@ endfunction
50695051
50705052augroup railsPluginAuto
50715053 autocmd !
5072- autocmd User BufEnterRails call s: RefreshBuffer ()
5073- autocmd User BufEnterRails call s: resetomnicomplete ()
5054+ autocmd BufEnter *
5055+ \ if s: active () |
5056+ \ if get (b: , ' rails_refresh' ) |
5057+ \ let b: rails_refresh = 0 |
5058+ \ let &filetype = &filetype |
5059+ \ unlet ! b: rails_refresh |
5060+ \ endif |
5061+ \ if exists (" +completefunc" ) && &completefunc == # ' syntaxcomplete#Complete' |
5062+ \ if exists (" g:loaded_syntax_completion" ) |
5063+ \ unlet g: loaded_syntax_completion |
5064+ \ silent ! delfunction syntaxcomplete#Complete |
5065+ \ endif |
5066+ \ endif |
5067+ \ endif
50745068 autocmd BufWritePost */config/database.yml call rails#cache_clear (" db_config" )
50755069 autocmd BufWritePost */config/projections.json call rails#cache_clear (" projections" )
50765070 autocmd BufWritePost */.projections.json call rails#cache_clear (" projections" )
0 commit comments