Skip to content

Commit cf3512d

Browse files
committed
Remove filename/type autocommands
1 parent d871c1d commit cf3512d

2 files changed

Lines changed: 6 additions & 25 deletions

File tree

autoload/rails.vim

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4451,20 +4451,8 @@ function! RailsBufInit(path)
44514451
call s:BufSettings()
44524452
call s:BufMappings()
44534453
call s:BufCommands()
4454-
let t = rails#buffer().type_name()
4455-
let t = "-".t
4456-
let f = '/'.RailsFilePath()
4457-
if f =~ '[ !#$%\,]'
4458-
let f = ''
4459-
endif
44604454
runtime! macros/rails.vim
44614455
silent doautocmd User Rails
4462-
if t != '-'
4463-
exe "silent doautocmd User Rails".s:gsub(t,'-','.')
4464-
endif
4465-
if f != ''
4466-
exe "silent doautocmd User Rails".f
4467-
endif
44684456
call s:BufProjectionCommands()
44694457
call s:BufAbbreviations()
44704458
return b:rails_root

doc/rails.txt

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -878,21 +878,14 @@ respective sections. You can also put projections in
878878
*rails-:autocmd* *rails-autocommands*
879879
If you would like to set your own custom Vim settings whenever a Rails file is
880880
loaded, you can use an autocommand like the following in your vimrc: >
881+
881882
autocmd User Rails silent! Rlcd
882883
autocmd User Rails map <buffer> <F9> :Rake<CR>
883-
You can also have autocommands that only apply to certain types of files.
884-
These are based off the information shown when running the |:Rails!|
885-
command, with hyphens changed to periods. A few examples: >
886-
autocmd User Rails.controller* iabbr <buffer> wsn wsdl_service_name
887-
autocmd User Rails.model.arb* iabbr <buffer> vfo validates_format_of
888-
autocmd User Rails.view.erb* imap <buffer> <C-Z> <%= %><C-O>3h
889-
End all such Rails autocommands with asterisks, even if you have an exact
890-
specification, to allow for more specific subtypes to be added in the future.
891-
There is also a filename matching syntax: >
892-
autocmd User Rails/config/environment.rb Rabbrev c config
893-
autocmd User Rails/**/foo_bar.rb Rabbrev FB:: FooBar
894-
Use the filetype based syntax whenever possible, reserving the filename based
895-
syntax for more advanced cases.
884+
885+
There used to be autocommands that fire based on the "type" or file name of
886+
the buffer, but they have been removed. If you still need to execute code for
887+
certain file types only, use the bare User Rails event above and check
888+
rails#buffer().relative() for the path relative to the Rails root.
896889

897890
*macros/rails.vim*
898891
If you have several commands to run on initialization for all file types, they

0 commit comments

Comments
 (0)