Skip to content

Commit 46be7ae

Browse files
committed
Set 'tags' to mirror 'path'
1 parent 8bee58b commit 46be7ae

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ftplugin/ruby.vim

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,36 +65,38 @@ setlocal commentstring=#\ %s
6565

6666
if !exists("s:ruby_path")
6767
if exists("g:ruby_path")
68-
let s:ruby_path = g:ruby_path
68+
let s:ruby_path = type(g:ruby_path) == type([]) ? join(g:ruby_path,',') : g:ruby_path
6969
else
7070
if has("ruby") && has("win32")
71-
ruby VIM::command( 'let s:ruby_path = "%s"' % $:.join(%q{,}) )
72-
let s:ruby_path = substitute(s:ruby_path, '\%(^\|,\)\.\%(,\|$\)', ',,', '')
71+
ruby VIM::command( 'let s:ruby_paths = split("%s",",")' % $:.join(%q{,}) )
7372
elseif executable("ruby")
7473
let s:code = "print $:.join(%q{,})"
7574
if &shellxquote == "'"
76-
let s:ruby_path = system('ruby -e "' . s:code . '"')
75+
let s:ruby_paths = split(system('ruby -e "' . s:code . '"'),",")
7776
else
78-
let s:ruby_path = system("ruby -e '" . s:code . "'")
77+
let s:ruby_paths = split(system("ruby -e '" . s:code . "'"),",")
7978
endif
80-
let s:ruby_path = substitute(s:ruby_path, '\%(^\|,\)\.\%(,\|$\)', ',,', '')
8179
else
82-
let s:ruby_path = substitute($RUBYLIB,':',',','g')
80+
let s:ruby_paths = split($RUBYLIB,':')
8381
endif
82+
let s:ruby_path = substitute(join(s:ruby_paths,","), '\%(^\|,\)\.\%(,\|$\)', ',,', '')
8483
if &g:path !~# '\v^\.%(,/%(usr|emx)/include)=,,$'
8584
let s:ruby_path = substitute(&g:path,',,$',',','') . ',' . s:ruby_path
8685
endif
8786
endif
8887
endif
8988

9089
let &l:path = s:ruby_path
90+
if exists('s:ruby_paths')
91+
let &l:tags = &g:tags . ',' . join(map(copy(s:ruby_paths),'v:val."/tags"'),',')
92+
endif
9193

9294
if has("gui_win32") && !exists("b:browsefilter")
9395
let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n" .
9496
\ "All Files (*.*)\t*.*\n"
9597
endif
9698

97-
let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< kp<"
99+
let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< tags< kp<"
98100
\."| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip"
99101
\."| if exists('&ofu') && has('ruby') | setl ofu< | endif"
100102
\."| if has('balloon_eval') && exists('+bexpr') | setl bexpr< | endif"

0 commit comments

Comments
 (0)