Skip to content

Commit d46ddd8

Browse files
committed
Tolerate filetypes with dots
1 parent ac9e00e commit d46ddd8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

autoload/rails.vim

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ function! s:Rake(bang,lnum,arg)
11361136
endif
11371137
let &l:errorformat = s:efm_backtrace
11381138
let arg = a:arg
1139-
if &filetype == "ruby" && arg == '' && g:rails_modelines
1139+
if &filetype =~# '^ruby\>' && arg == '' && g:rails_modelines
11401140
let mnum = s:lastmethodline(lnum)
11411141
let str = getline(mnum)."\n".getline(mnum+1)."\n".getline(mnum+2)."\n"
11421142
let pat = '\s\+\zs.\{-\}\ze\%(\n\|\s\s\|#{\@!\|$\)'
@@ -1417,7 +1417,7 @@ function! s:Preview(bang,lnum,arg)
14171417
let url = uri.(uri =~ '/$' ? '?' : '')
14181418
silent exe 'pedit '.url
14191419
wincmd w
1420-
if &filetype == ''
1420+
if &filetype ==# ''
14211421
if uri =~ '\.css$'
14221422
setlocal filetype=css
14231423
elseif uri =~ '\.js$'
@@ -4192,7 +4192,7 @@ function! s:getopt(opt,...)
41924192
let scope = 'abgl'
41934193
endif
41944194
let lnum = a:0 > 1 ? a:2 : line('.')
4195-
if scope =~ 'l' && &filetype != 'ruby'
4195+
if scope =~ 'l' && &filetype !~# '^ruby\>'
41964196
let scope = s:sub(scope,'l','b')
41974197
endif
41984198
if scope =~ 'l'
@@ -4228,7 +4228,7 @@ function! s:setopt(opt,val)
42284228
if scope == ''
42294229
let scope = defscope
42304230
endif
4231-
if &filetype != 'ruby' && (scope ==# 'B' || scope ==# 'l')
4231+
if &filetype !~# '^ruby\>' && (scope ==# 'B' || scope ==# 'l')
42324232
let scope = 'b'
42334233
endif
42344234
let var = s:sname().'_'.opt
@@ -4465,15 +4465,15 @@ function! s:BufSettings()
44654465
call self.setvar('&includeexpr','RailsIncludeexpr()')
44664466
call self.setvar('&suffixesadd', ".rb,.".join(s:view_types,',.'))
44674467
let ft = self.getvar('&filetype')
4468-
if ft =~ '^\%(e\=ruby\|[yh]aml\|coffee\|css\|s[ac]ss\|lesscss\)$'
4468+
if ft =~# '^\%(e\=ruby\|[yh]aml\|coffee\|css\|s[ac]ss\|lesscss\)\>'
44694469
call self.setvar('&shiftwidth',2)
44704470
call self.setvar('&softtabstop',2)
44714471
call self.setvar('&expandtab',1)
44724472
if exists('+completefunc') && self.getvar('&completefunc') == ''
44734473
call self.setvar('&completefunc','syntaxcomplete#Complete')
44744474
endif
44754475
endif
4476-
if ft == 'ruby'
4476+
if ft =~# '^ruby\>'
44774477
call self.setvar('&define',self.define_pattern())
44784478
" This really belongs in after/ftplugin/ruby.vim but we'll be nice
44794479
if exists('g:loaded_surround') && self.getvar('surround_101') == ''
@@ -4484,7 +4484,7 @@ function! s:BufSettings()
44844484
if exists(':UltiSnipsAddFiletypes')
44854485
UltiSnipsAddFiletypes rails
44864486
endif
4487-
elseif ft == 'yaml' || fnamemodify(self.name(),':e') == 'yml'
4487+
elseif ft =~# 'yaml\>' || fnamemodify(self.name(),':e') ==# 'yml'
44884488
call self.setvar('&define',self.define_pattern())
44894489
elseif ft =~# '^eruby\>'
44904490
if exists("g:loaded_allml")
@@ -4497,7 +4497,7 @@ function! s:BufSettings()
44974497
call self.setvar('ragtag_javascript_include_tag', "<%= javascript_include_tag '\r' %>")
44984498
call self.setvar('ragtag_doctype_index', 10)
44994499
endif
4500-
elseif ft == 'haml'
4500+
elseif ft =~# '^haml\>'
45014501
if exists("g:loaded_allml")
45024502
call self.setvar('allml_stylesheet_link_tag', "= stylesheet_link_tag '\r'")
45034503
call self.setvar('allml_javascript_include_tag', "= javascript_include_tag '\r'")
@@ -4509,7 +4509,7 @@ function! s:BufSettings()
45094509
call self.setvar('ragtag_doctype_index', 10)
45104510
endif
45114511
endif
4512-
if ft =~# '^eruby\>' || ft ==# 'yaml'
4512+
if ft =~# '^eruby\>' || ft =~# '^yaml\>'
45134513
" surround.vim
45144514
if exists("g:loaded_surround")
45154515
" The idea behind the || part here is that one can normally define the

0 commit comments

Comments
 (0)