@@ -4521,38 +4521,39 @@ function! s:BufSettings()
45214521 \. " Static Files (*.html, *.css, *.js)\t " .statics." \n "
45224522 \. " All Files (*.*)\t *.*\n "
45234523 endif
4524- setlocal includeexpr = RailsIncludeexpr ()
4525- let &l: suffixesadd= " .rb,." .s: gsub (s: view_types ,' ,' ,' ,.' )." ,.css,.js,.yml,.csv,.rake,.sql,.html,.xml"
4526- if &ft = ~ ' ^\%(e\=ruby\|[yh]aml\|javascript\|css\|sass\)$'
4527- setlocal sw = 2 sts = 2 et
4528- if exists (' +completefunc' )
4529- if &completefunc == ' '
4530- set completefunc = syntaxcomplete#Complete
4531- endif
4524+ call self .setvar (' &includeexpr' ,' RailsIncludeexpr()' )
4525+ call self .setvar (' &suffixesadd' , " .rb,." .s: gsub (s: view_types ,' ,' ,' ,.' )." ,.css,.js,.yml,.csv,.rake,.sql,.html,.xml" )
4526+ let ft = self .getvar (' &filetype' )
4527+ if ft = ~ ' ^\%(e\=ruby\|[yh]aml\|javascript\|css\|sass\)$'
4528+ call self .setvar (' &shiftwidth' ,2 )
4529+ call self .setvar (' &softtabstop' ,2 )
4530+ call self .setvar (' &expandtab' ,1 )
4531+ if exists (' +completefunc' ) && self .getvar (' &completefunc' ) == ' '
4532+ call self .setvar (' &completefunc' ,' syntaxcomplete#Complete' )
45324533 endif
45334534 endif
4534- if & filetype == " ruby"
4535- let & l: suffixesadd= " .rb,." .s: gsub (s: view_types ,' ,' ,' ,.' )." ,.yml,.csv,.rake,s.rb"
4535+ if ft == ' ruby'
4536+ call self . setvar ( ' & suffixesadd' , " .rb,." .s: gsub (s: view_types ,' ,' ,' ,.' )." ,.yml,.csv,.rake,s.rb" )
45364537 call self .setvar (' &define' ,self .define_pattern ())
45374538 " This really belongs in after/ftplugin/ruby.vim but we'll be nice
4538- if exists (" g:loaded_surround" ) && ! exists ( " b: surround_101" )
4539- let b: surround_5 = " \r \n end"
4540- let b: surround_69 = " \1 expr: \1 \r end"
4541- let b: surround_101 = " \r \n end"
4539+ if exists (' g:loaded_surround' ) && self . getvar ( ' surround_101' ) == ' '
4540+ call self . setvar ( ' surround_5' , " \r \n end" )
4541+ call self . setvar ( ' surround_69' , " \1 expr: \1 \r end" )
4542+ call self . setvar ( ' surround_101' , " \r \n end" )
45424543 endif
4543- elseif & filetype == ' yaml' || expand ( ' % :e' ) == ' yml'
4544+ elseif ft == ' yaml' || fnamemodify ( self . name (), ' :e' ) == ' yml'
45444545 call self .setvar (' &define' ,self .define_pattern ())
4545- let & l: suffixesadd= " .yml,.csv,.rb,." .s: gsub (s: view_types ,' ,' ,' ,.' )." ,.rake,s.rb"
4546- elseif & filetype == " eruby"
4547- let & l: suffixesadd= " ." .s: gsub (s: view_types ,' ,' ,' ,.' )." ,.rb,.css,.js,.html,.yml,.csv"
4546+ call self . setvar ( ' & suffixesadd' , " .yml,.csv,.rb,." .s: gsub (s: view_types ,' ,' ,' ,.' )." ,.rake,s.rb" )
4547+ elseif ft == ' eruby'
4548+ call self . setvar ( ' & suffixesadd' , " ." .s: gsub (s: view_types ,' ,' ,' ,.' )." ,.rb,.css,.js,.html,.yml,.csv" )
45484549 if exists (" g:loaded_allml" )
45494550 " allml is available on vim.org.
4550- let b: allml_stylesheet_link_tag = " <%= stylesheet_link_tag '\r ' %>"
4551- let b: allml_javascript_include_tag = " <%= javascript_include_tag '\r ' %>"
4552- let b: allml_doctype_index = 10
4551+ call self . setvar ( ' allml_stylesheet_link_tag' , " <%= stylesheet_link_tag '\r ' %>" )
4552+ call self . setvar ( ' allml_javascript_include_tag' , " <%= javascript_include_tag '\r ' %>" )
4553+ call self . setvar ( ' allml_doctype_index' , 10 )
45534554 endif
45544555 endif
4555- if & filetype == " eruby" || & filetype == " yaml"
4556+ if ft == ' eruby' || ft == ' yaml'
45564557 " surround.vim
45574558 if exists (" g:loaded_surround" )
45584559 " The idea behind the || part here is that one can normally define the
@@ -4561,19 +4562,19 @@ function! s:BufSettings()
45614562 " difficult if you really don't want a hyphen in Rails ERuby files. If
45624563 " this is your desire, you will need to accomplish it via a rails.vim
45634564 " autocommand.
4564- if ! exists ( " b: surround_45" ) || b: surround_45 == " <% \r %>" " -
4565- let b: surround_45 = " <% \r -%>"
4565+ if self . getvar ( ' surround_45' ) == ' ' || self . getvar ( ' surround_45' ) == " <% \r %>" " -
4566+ call self . setvar ( ' surround_45' , " <% \r -%>" )
45664567 endif
4567- if ! exists ( " b: surround_61" ) " =
4568- let b: surround_61 = " <%= \r %>"
4568+ if self . getvar ( ' surround_61' ) == ' ' " =
4569+ call self . setvar ( ' surround_61' , " <%= \r %>" )
45694570 endif
4570- if ! exists ( " b: surround_35" ) " #
4571- let b: surround_35 = " <%# \r %>"
4571+ if self . getvar ( " surround_35" ) == ' ' " #
4572+ call self . setvar ( ' surround_35' , " <%# \r %>" )
45724573 endif
4573- if ! exists ( " b: surround_101" ) || b: surround_101 == " <% \r %>\n <% end %>" " e
4574- let b: surround_5 = " <% \r -%>\n <% end -%>"
4575- let b: surround_69 = " <% \1 expr: \1 -%>\r <% end -%>"
4576- let b: surround_101 = " <% \r -%>\n <% end -%>"
4574+ if self . getvar ( ' surround_101' ) == ' ' || self . getvar ( ' surround_101' ) == " <% \r %>\n <% end %>" " e
4575+ call self . setvar ( ' surround_5' , " <% \r -%>\n <% end -%>" )
4576+ call self . setvar ( ' surround_69' , " <% \1 expr: \1 -%>\r <% end -%>" )
4577+ call self . setvar ( ' surround_101' , " <% \r -%>\n <% end -%>" )
45774578 endif
45784579 endif
45794580 endif
0 commit comments