@@ -1076,7 +1076,7 @@ call s:add_methods('app', ['has_zeus', 'ruby_script_command','static_rails_comma
10761076function ! s: BufCommands ()
10771077 call s: BufNavCommands ()
10781078 call s: BufScriptWrappers ()
1079- command ! - buffer - bar -nargs =* - bang Rabbrev :call s: Abbrev ( <bang> 0 , <f-args> )
1079+ command ! - buffer - bar -nargs =* - bang Rabbrev :echoerr " Rabbrev has been removed. "
10801080 command ! - buffer - bar -nargs =? - bang - count -complete =customlist ,rails#complete_rake Rake :call s: Rake (<bang> 0 ,! <count> && <line1> ? -1 : <count> ,<q-args> )
10811081 command ! - buffer - bar -nargs =? - bang - range -complete =customlist ,s: Complete_preview Rbrowse :call s: Preview (<bang> 0 ,<line1> ,<q-args> )
10821082 command ! - buffer - bar -nargs =? - bang - range -complete =customlist ,s: Complete_preview Preview :call s: Preview (<bang> 0 ,<line1> ,<q-args> )
@@ -4263,186 +4263,6 @@ function! rails#db_complete_fragment(url, ...) abort
42634263 return len (app) ? app.environments () : []
42644264endfunction
42654265
4266- " }}}1
4267- " Abbreviations {{{1
4268-
4269- function ! s: selectiveexpand (pat,good,default,... )
4270- if a: 0 > 0
4271- let nd = a: 1
4272- else
4273- let nd = " "
4274- endif
4275- let c = nr2char (getchar (0 ))
4276- let good = a: good
4277- if c == " " " ^]
4278- return s: sub (good.(a: 0 ? " " .a: 1 : ' ' ),' \s+$' ,' ' )
4279- elseif c == " \t "
4280- return good.(a: 0 ? " " .a: 1 : ' ' )
4281- elseif c = ~ a: pat
4282- return good.c .(a: 0 ? a: 1 : ' ' )
4283- else
4284- return a: default .c
4285- endif
4286- endfunction
4287-
4288- function ! s: AddSelectiveExpand (abbr,pat,expn,... )
4289- let expn = s: gsub (s: gsub (a: expn ,' [\"|]' ,' \\&' ),' \<' ,' \\<Lt>' )
4290- let expn2 = s: gsub (s: gsub (a: 0 ? a: 1 : ' ' ,' [\"|]' ,' \\&' ),' \<' ,' \\<Lt>' )
4291- if a: 0
4292- exe " inoreabbrev <buffer> <silent> " .a: abbr ." <C-R>=<SID>selectiveexpand(" .string (a: pat )." ,\" " .expn." \" ," .string (a: abbr )." ,\" " .expn2." \" )<CR>"
4293- else
4294- exe " inoreabbrev <buffer> <silent> " .a: abbr ." <C-R>=<SID>selectiveexpand(" .string (a: pat )." ,\" " .expn." \" ," .string (a: abbr )." )<CR>"
4295- endif
4296- endfunction
4297-
4298- function ! s: AddTabExpand (abbr,expn)
4299- call s: AddSelectiveExpand (a: abbr ,' ..' ,a: expn )
4300- endfunction
4301-
4302- function ! s: AddBracketExpand (abbr,expn)
4303- call s: AddSelectiveExpand (a: abbr ,' [[.]' ,a: expn )
4304- endfunction
4305-
4306- function ! s: AddColonExpand (abbr,expn)
4307- call s: AddSelectiveExpand (a: abbr ,' [:.]' ,a: expn )
4308- endfunction
4309-
4310- function ! s: AddParenExpand (abbr,expn,... )
4311- if a: 0
4312- call s: AddSelectiveExpand (a: abbr ,' (' ,a: expn ,a: 1 )
4313- else
4314- call s: AddSelectiveExpand (a: abbr ,' (' ,a: expn ,' ' )
4315- endif
4316- endfunction
4317-
4318- function ! s: BufAbbreviations ()
4319- " Some of these were cherry picked from the TextMate snippets
4320- if ! exists (' g:rails_no_abbreviations' )
4321- let buffer = rails#buffer ()
4322- " Limit to the right filetypes. But error on the liberal side
4323- if buffer .type_name (' controller' ,' view' ,' helper' ,' test-controller' ,' test-helper' ,' test-integration' )
4324- Rabbrev pa [ params
4325- Rabbrev rq[ request
4326- Rabbrev rs [ response
4327- Rabbrev se [ session
4328- Rabbrev hd[ headers
4329- Rabbrev coo[ cookies
4330- Rabbrev fl[ flash
4331- Rabbrev rr ( render
4332- " ))))))
4333- endif
4334- if buffer .type_name (' controller' )
4335- Rabbrev re ( redirect_to
4336- Rabbrev rst ( respond_to
4337- " ))
4338- endif
4339- if buffer .type_name () == # ' model' || buffer .type_name (' model-record' )
4340- Rabbrev bt ( belongs_to
4341- Rabbrev ho ( has_one
4342- Rabbrev hm ( has_many
4343- Rabbrev habtm ( has_and_belongs_to_many
4344- Rabbrev co ( composed_of
4345- Rabbrev va ( validates_associated
4346- Rabbrev vb ( validates_acceptance_of
4347- Rabbrev vc ( validates_confirmation_of
4348- Rabbrev ve ( validates_exclusion_of
4349- Rabbrev vf ( validates_format_of
4350- Rabbrev vi ( validates_inclusion_of
4351- Rabbrev vl ( validates_length_of
4352- Rabbrev vn ( validates_numericality_of
4353- Rabbrev vp ( validates_presence_of
4354- Rabbrev vu ( validates_uniqueness_of
4355- " )))))))))))))))
4356- endif
4357- if buffer .type_name (' db-migration' ,' db-schema' )
4358- Rabbrev mac ( add_column
4359- Rabbrev mrnc ( rename_column
4360- Rabbrev mrc ( remove_column
4361- Rabbrev mct ( create_table
4362- Rabbrev mcht ( change_table
4363- Rabbrev mrnt ( rename_table
4364- Rabbrev mdt ( drop_table
4365- " )))))))
4366- endif
4367- Rabbrev logd ( logger.debug
4368- Rabbrev logi ( logger.info
4369- Rabbrev logw ( logger.warn
4370- Rabbrev loge ( logger.error
4371- Rabbrev logf ( logger.fatal
4372- Rabbrev AR:: ActiveRecord
4373- Rabbrev AV: : ActionView
4374- Rabbrev AC:: ActionController
4375- Rabbrev AD:: ActionDispatch
4376- Rabbrev AS: : ActiveSupport
4377- Rabbrev AM:: ActionMailer
4378- Rabbrev AO:: ActiveModel
4379- Rabbrev AJ:: ActiveJob
4380- " )))))
4381- for pairs in
4382- \ items (get (g: , ' rails_abbreviations' , {}))
4383- call call (function (s: sid .' Abbrev' ), [0 , pairs[0 ]] + s: split (pairs[1 ]))
4384- endfor
4385- for hash in reverse (rails#buffer ().projected (' abbreviations' ))
4386- for pairs in items (hash)
4387- call call (function (s: sid .' Abbrev' ), [0 , pairs[0 ]] + s: split (pairs[1 ]))
4388- endfor
4389- endfor
4390- endif
4391- endfunction
4392-
4393- function ! s: Abbrev (bang ,... ) abort
4394- if ! exists (" b:rails_abbreviations" )
4395- let b: rails_abbreviations = {}
4396- endif
4397- if a: 0 > 3 || (a: bang && (a: 0 != 1 ))
4398- return s: error (" Rabbrev: invalid arguments" )
4399- endif
4400- if a: 0 == 0
4401- for key in sort (keys (b: rails_abbreviations ))
4402- echo key . join (b: rails_abbreviations [key ]," \t " )
4403- endfor
4404- return
4405- endif
4406- let lhs = a: 1
4407- let root = s: sub (lhs,' %(::|\(|\[)$' ,' ' )
4408- if a: bang
4409- if has_key (b: rails_abbreviations ,root)
4410- call remove (b: rails_abbreviations ,root)
4411- endif
4412- exe " iunabbrev <buffer> " .root
4413- return
4414- endif
4415- if a: 0 > 3 || a: 0 < 2
4416- return s: error (" Rabbrev: invalid arguments" )
4417- endif
4418- let rhs = a: 2
4419- if has_key (b: rails_abbreviations ,root)
4420- call remove (b: rails_abbreviations ,root)
4421- endif
4422- if lhs = ~ ' ($'
4423- let b: rails_abbreviations [root] = [" (" , rhs . (a: 0 > 2 ? " \t " .a: 3 : " " )]
4424- if a: 0 > 2
4425- call s: AddParenExpand (root,rhs,a: 3 )
4426- else
4427- call s: AddParenExpand (root,rhs)
4428- endif
4429- return
4430- endif
4431- if a: 0 > 2
4432- return s: error (" Rabbrev: invalid arguments" )
4433- endif
4434- if lhs = ~ ' :$'
4435- call s: AddColonExpand (root,rhs)
4436- elseif lhs = ~ ' \[$'
4437- call s: AddBracketExpand (root,rhs)
4438- elseif lhs = ~ ' \w$'
4439- call s: AddTabExpand (lhs,rhs)
4440- else
4441- return s: error (" Rabbrev: unimplemented" )
4442- endif
4443- let b: rails_abbreviations [root] = [matchstr (lhs,' \W*$' ),rhs]
4444- endfunction
4445-
44464266" }}}1
44474267" Projections {{{1
44484268
@@ -5147,7 +4967,6 @@ function! rails#buffer_setup() abort
51474967 call s: BufMappings ()
51484968 call s: BufCommands ()
51494969 call s: BufProjectionCommands ()
5150- call s: BufAbbreviations ()
51514970
51524971 if ft = ~# ' ^ruby\>'
51534972 call self .setvar (' &define' ,self .define_pattern ())
0 commit comments