summaryrefslogtreecommitdiffstats
path: root/ftplugin/ruby.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2015-12-06 11:31:38 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2015-12-06 11:31:38 +0100
commit303b3f1b434f26f936c241789c84dca6e2f50df2 (patch)
tree1507706b422e3ec29c0e5f30bcf14681e04ab374 /ftplugin/ruby.vim
parentbf849731731a7da008c891476b878735e8280bdc (diff)
downloadvim-polyglot-303b3f1b434f26f936c241789c84dca6e2f50df2.tar.gz
vim-polyglot-303b3f1b434f26f936c241789c84dca6e2f50df2.zip
Update all bundles
Diffstat (limited to 'ftplugin/ruby.vim')
-rw-r--r--ftplugin/ruby.vim6
1 files changed, 3 insertions, 3 deletions
diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim
index 0eb32b66..9a2283ef 100644
--- a/ftplugin/ruby.vim
+++ b/ftplugin/ruby.vim
@@ -46,7 +46,7 @@ endif
setlocal formatoptions-=t formatoptions+=croql
setlocal include=^\\s*\\<\\(load\\>\\\|require\\>\\\|autoload\\s*:\\=[\"']\\=\\h\\w*[\"']\\=,\\)
-setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','')
+setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'\%(\.rb\)\=$','.rb','')
setlocal suffixesadd=.rb
if exists("&ofu") && has("ruby")
@@ -361,7 +361,7 @@ function! RubyCursorFile() abort
endtry
let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!')
let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*')
- let ext = getline('.') =~# '^\s*\%(require\|autoload\)\>' ? '.rb' : ''
+ let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : ''
if s:synname() ==# 'rubyConstant'
let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','')
let cfile = substitute(cfile,'::','/','g')
@@ -369,7 +369,7 @@ function! RubyCursorFile() abort
let cfile = substitute(cfile,'\(\l\|\d\)\(\u\)','\1_\2', 'g')
return tolower(cfile) . '.rb'
elseif getline('.') =~# '^\s*require_relative\s*\(["'']\).*\1\s*$'
- let cfile = expand('%:p:h') . '/' . matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1') . '.rb'
+ let cfile = expand('%:p:h') . '/' . matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1') . ext
elseif getline('.') =~# '^\s*\%(require[( ]\|load[( ]\|autoload[( ]:\w\+,\)\s*\%(::\)\=File\.expand_path(\(["'']\)\.\./.*\1,\s*__FILE__)\s*$'
let target = matchstr(getline('.'),'\(["'']\)\.\.\zs/.\{-\}\ze\1')
let cfile = expand('%:p:h') . target . ext