annotate runtime/ftplugin/ruby.vim @ 28739:40b087823dc7 v8.2.4894

patch 8.2.4894: MS-Windows: not using italics Commit: https://github.com/vim/vim/commit/5a7b6dc23cd16450b5773849520d513de56bccbf Author: LemonBoy <thatlemon@gmail.com> Date: Fri May 6 18:38:41 2022 +0100 patch 8.2.4894: MS-Windows: not using italics Problem: MS-Windows: not using italics. Solution: Use italics. Simplify the code. (closes https://github.com/vim/vim/issues/10359)
author Bram Moolenaar <Bram@vim.org>
date Fri, 06 May 2022 19:45:02 +0200
parents e3d6184b89fa
children 828bcb1a37e7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim filetype plugin
831
f24a95dae8ee updated for version 7.0d05
vimboss
parents: 829
diff changeset
2 " Language: Ruby
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
4 " URL: https://github.com/vim-ruby/vim-ruby
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
5 " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
6 " Last Change: 2022 Mar 21
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 if (exists("b:did_ftplugin"))
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
9 finish
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
13 let s:cpo_save = &cpo
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
14 set cpo&vim
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
15
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
16 if has("gui_running") && !has("gui_win32")
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
17 setlocal keywordprg=ri\ -T\ -f\ bs
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
18 else
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
19 setlocal keywordprg=ri
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
20 endif
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
21
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
22 " Matchit support
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
23 if exists("loaded_matchit") && !exists("b:match_words")
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
24 let b:match_ignorecase = 0
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
25
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
26 let b:match_words =
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
27 \ '{\|\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|=\@<!begin\)\>=\@!' .
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
28 \ ':' .
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
29 \ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' .
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
30 \ ':' .
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
31 \ '}\|\%(^\|[^.\:@$=]\)\@<=\<end\:\@!\>' .
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
32 \ ',^=begin\>:^=end\>,' .
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
33 \ ',\[:\],(:)'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
34
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
35 let b:match_skip =
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
36 \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" .
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
37 \ "\\<ruby\\%(String\\|.\+Delimiter\\|Character\\|.\+Escape\\|" .
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
38 \ "Regexp\\|Interpolation\\|Comment\\|Documentation\\|" .
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
39 \ "ConditionalModifier\\|RepeatModifier\\|RescueModifier\\|OptionalDo\\|" .
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
40 \ "MethodName\\|BlockArgument\\|KeywordAsMethod\\|ClassVariable\\|" .
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
41 \ "InstanceVariable\\|GlobalVariable\\|Symbol\\)\\>'"
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
42 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
43
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
44 setlocal formatoptions-=t formatoptions+=croql
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
45
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
46 setlocal include=^\\s*\\<\\(load\\>\\\|require\\>\\\|autoload\\s*:\\=[\"']\\=\\h\\w*[\"']\\=,\\)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
47 setlocal suffixesadd=.rb
831
f24a95dae8ee updated for version 7.0d05
vimboss
parents: 829
diff changeset
48
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
49 if exists("&ofu") && has("ruby")
831
f24a95dae8ee updated for version 7.0d05
vimboss
parents: 829
diff changeset
50 setlocal omnifunc=rubycomplete#Complete
f24a95dae8ee updated for version 7.0d05
vimboss
parents: 829
diff changeset
51 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
52
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
53 " TODO:
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
54 "setlocal define=^\\s*def
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
55
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
56 setlocal comments=b:#
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
57 setlocal commentstring=#\ %s
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
58
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
59 if !exists('g:ruby_version_paths')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
60 let g:ruby_version_paths = {}
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
61 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
62
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
63 function! s:query_path(root) abort
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
64 let code = "print $:.join %q{,}"
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
65 if &shell =~# 'sh' && empty(&shellxquote)
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
66 let prefix = 'env PATH='.shellescape($PATH).' '
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
67 else
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
68 let prefix = ''
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
69 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
70 if &shellxquote == "'"
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
71 let path_check = prefix.'ruby --disable-gems -e "' . code . '"'
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
72 else
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
73 let path_check = prefix."ruby --disable-gems -e '" . code . "'"
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
74 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
75
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
76 let cd = haslocaldir() ? 'lcd' : 'cd'
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
77 let cwd = fnameescape(getcwd())
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
78 try
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
79 exe cd fnameescape(a:root)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
80 let path = split(system(path_check),',')
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
81 exe cd cwd
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
82 return path
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
83 finally
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
84 exe cd cwd
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
85 endtry
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
86 endfunction
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
87
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
88 function! s:build_path(path) abort
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
89 let path = join(map(copy(a:path), 'v:val ==# "." ? "" : v:val'), ',')
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
90 if &g:path =~# '\v^%(\.,)=%(/%(usr|emx)/include,)=,$'
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
91 let path = path . ',.,,'
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
92 elseif &g:path =~# ',\.,,$'
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
93 let path = &g:path[0:-4] . path . ',.,,'
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
94 elseif &g:path =~# ',,$'
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
95 let path = &g:path[0:-2] . path . ',,'
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
96 else
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
97 let path = substitute(&g:path, '[^,]\zs$', ',', '') . path
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
98 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
99 return path
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
100 endfunction
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
101
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
102 if !exists('b:ruby_version') && !exists('g:ruby_path') && isdirectory(expand('%:p:h'))
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
103 let s:version_file = findfile('.ruby-version', '.;')
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
104 if !empty(s:version_file) && filereadable(s:version_file)
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
105 let b:ruby_version = get(readfile(s:version_file, '', 1), '')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
106 if !has_key(g:ruby_version_paths, b:ruby_version)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
107 let g:ruby_version_paths[b:ruby_version] = s:query_path(fnamemodify(s:version_file, ':p:h'))
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
108 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
109 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
110 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
111
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
112 if exists("g:ruby_path")
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
113 let s:ruby_path = type(g:ruby_path) == type([]) ? join(g:ruby_path, ',') : g:ruby_path
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
114 elseif has_key(g:ruby_version_paths, get(b:, 'ruby_version', ''))
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
115 let s:ruby_paths = g:ruby_version_paths[b:ruby_version]
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
116 let s:ruby_path = s:build_path(s:ruby_paths)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
117 else
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
118 if !exists('g:ruby_default_path')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
119 if has("ruby") && has("win32")
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
120 ruby ::VIM::command( 'let g:ruby_default_path = split("%s",",")' % $:.join(%q{,}) )
25056
43593a5d873f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18857
diff changeset
121 elseif executable('ruby') && !empty($HOME)
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
122 let g:ruby_default_path = s:query_path($HOME)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
123 else
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
124 let g:ruby_default_path = map(split($RUBYLIB,':'), 'v:val ==# "." ? "" : v:val')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
125 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
126 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
127 let s:ruby_paths = g:ruby_default_path
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
128 let s:ruby_path = s:build_path(s:ruby_paths)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
129 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
130
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
131 if stridx(&l:path, s:ruby_path) == -1
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
132 let &l:path = s:ruby_path
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
133 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
134 if exists('s:ruby_paths') && stridx(&l:tags, join(map(copy(s:ruby_paths),'v:val."/tags"'),',')) == -1
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
135 let &l:tags = &tags . ',' . join(map(copy(s:ruby_paths),'v:val."/tags"'),',')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
136 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
137
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
138 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
139 let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n" .
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
140 \ "All Files (*.*)\t*.*\n"
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
141 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
142
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
143 let b:undo_ftplugin = "setl inc= sua= path= tags= fo< com< cms< kp="
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
144 \."| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip"
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
145 \."| if exists('&ofu') && has('ruby') | setl ofu< | endif"
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
146
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
147 if get(g:, 'ruby_recommended_style', 1)
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
148 setlocal shiftwidth=2 softtabstop=2 expandtab
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
149 let b:undo_ftplugin .= ' | setl sw< sts< et<'
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
150 endif
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
151
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
152 " To activate, :set ballooneval
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
153 if exists('+balloonexpr') && get(g:, 'ruby_balloonexpr')
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
154 setlocal balloonexpr=RubyBalloonexpr()
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
155 let b:undo_ftplugin .= "| setl bexpr="
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
156 endif
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
157
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
158 function! s:map(mode, flags, map) abort
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
159 let from = matchstr(a:map, '\S\+')
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
160 if empty(mapcheck(from, a:mode))
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
161 exe a:mode.'map' '<buffer>' a:flags a:map
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
162 let b:undo_ftplugin .= '|sil! '.a:mode.'unmap <buffer> '.from
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
163 endif
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
164 endfunction
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
165
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
166 cmap <buffer><script><expr> <Plug><ctag> substitute(RubyCursorTag(),'^$',"\022\027",'')
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
167 cmap <buffer><script><expr> <Plug><cfile> substitute(RubyCursorFile(),'^$',"\022\006",'')
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
168 let b:undo_ftplugin .= "| sil! cunmap <buffer> <Plug><ctag>| sil! cunmap <buffer> <Plug><cfile>"
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
169
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
170 if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
171 nmap <buffer><script> <SID>: :<C-U>
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
172 nmap <buffer><script> <SID>c: :<C-U><C-R>=v:count ? v:count : ''<CR>
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
173 cmap <buffer> <SID><cfile> <Plug><cfile>
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
174 cmap <buffer> <SID><ctag> <Plug><ctag>
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
175
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
176 nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','n')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
177 nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','n')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
178 nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','n')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
179 nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','n')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
180 xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','v')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
181 xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','v')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
182 xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','v')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
183 xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','v')<CR>
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
184
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
185 nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','n')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
186 nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','n')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
187 nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','n')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
188 nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','n')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
189 xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','v')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
190 xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','v')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
191 xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','v')<CR>
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
192 xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','v')<CR>
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
193
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
194 let b:undo_ftplugin = b:undo_ftplugin
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
195 \."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['"
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
196 \."| sil! exe 'unmap <buffer> [m' | sil! exe 'unmap <buffer> ]m' | sil! exe 'unmap <buffer> [M' | sil! exe 'unmap <buffer> ]M'"
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
197
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
198 if maparg('im','x') == '' && maparg('im','o') == '' && maparg('am','x') == '' && maparg('am','o') == ''
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
199 onoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
200 onoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR>
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
201 xnoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
202 xnoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR>
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
203 let b:undo_ftplugin = b:undo_ftplugin
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
204 \."| sil! exe 'ounmap <buffer> im' | sil! exe 'ounmap <buffer> am'"
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
205 \."| sil! exe 'xunmap <buffer> im' | sil! exe 'xunmap <buffer> am'"
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
206 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
207
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
208 if maparg('iM','x') == '' && maparg('iM','o') == '' && maparg('aM','x') == '' && maparg('aM','o') == ''
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
209 onoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
210 onoremap <silent> <buffer> aM :<C-U>call <SID>wrap_a('[[','][')<CR>
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
211 xnoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
212 xnoremap <silent> <buffer> aM :<C-U>call <SID>wrap_a('[[','][')<CR>
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
213 let b:undo_ftplugin = b:undo_ftplugin
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
214 \."| sil! exe 'ounmap <buffer> iM' | sil! exe 'ounmap <buffer> aM'"
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
215 \."| sil! exe 'xunmap <buffer> iM' | sil! exe 'xunmap <buffer> aM'"
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
216 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
217
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
218 call s:map('c', '', '<C-R><C-F> <Plug><cfile>')
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
219
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
220 cmap <buffer><script><expr> <SID>tagzv &foldopen =~# 'tag' ? '<Bar>norm! zv' : ''
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
221 call s:map('n', '<script><silent>', '<C-]> <SID>:exe v:count1."tag <SID><ctag>"<SID>tagzv<CR>')
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
222 call s:map('n', '<script><silent>', 'g<C-]> <SID>:exe "tjump <SID><ctag>"<SID>tagzv<CR>')
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
223 call s:map('n', '<script><silent>', 'g] <SID>:exe "tselect <SID><ctag>"<SID>tagzv<CR>')
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
224 call s:map('n', '<script><silent>', '<C-W>] <SID>:exe v:count1."stag <SID><ctag>"<SID>tagzv<CR>')
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
225 call s:map('n', '<script><silent>', '<C-W><C-]> <SID>:exe v:count1."stag <SID><ctag>"<SID>tagzv<CR>')
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
226 call s:map('n', '<script><silent>', '<C-W>g<C-]> <SID>:exe "stjump <SID><ctag>"<SID>tagzv<CR>')
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
227 call s:map('n', '<script><silent>', '<C-W>g] <SID>:exe "stselect <SID><ctag>"<SID>tagzv<CR>')
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
228 call s:map('n', '<script><silent>', '<C-W>} <SID>:exe v:count1."ptag <SID><ctag>"<CR>')
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
229 call s:map('n', '<script><silent>', '<C-W>g} <SID>:exe "ptjump <SID><ctag>"<CR>')
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
230
28246
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
231 call s:map('n', '<script><silent>', 'gf <SID>c:find <SID><cfile><CR>')
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
232 call s:map('n', '<script><silent>', '<C-W>f <SID>c:sfind <SID><cfile><CR>')
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
233 call s:map('n', '<script><silent>', '<C-W><C-F> <SID>c:sfind <SID><cfile><CR>')
e3d6184b89fa Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
234 call s:map('n', '<script><silent>', '<C-W>gf <SID>c:tabfind <SID><cfile><CR>')
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
235 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
236
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
237 let &cpo = s:cpo_save
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
238 unlet s:cpo_save
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
239
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
240 if exists("g:did_ruby_ftplugin_functions")
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
241 finish
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
242 endif
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
243 let g:did_ruby_ftplugin_functions = 1
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
244
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
245 function! RubyBalloonexpr() abort
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
246 if !exists('s:ri_found')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
247 let s:ri_found = executable('ri')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
248 endif
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
249 if s:ri_found
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
250 let line = getline(v:beval_lnum)
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
251 let b = matchstr(strpart(line,0,v:beval_col),'\%(\w\|[:.]\)*$')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
252 let a = substitute(matchstr(strpart(line,v:beval_col),'^\w*\%([?!]\|\s*=\)\?'),'\s\+','','g')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
253 let str = b.a
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
254 let before = strpart(line,0,v:beval_col-strlen(b))
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
255 let after = strpart(line,v:beval_col+strlen(a))
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
256 if str =~ '^\.'
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
257 let str = substitute(str,'^\.','#','g')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
258 if before =~ '\]\s*$'
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
259 let str = 'Array'.str
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
260 elseif before =~ '}\s*$'
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
261 " False positives from blocks here
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
262 let str = 'Hash'.str
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
263 elseif before =~ "[\"'`]\\s*$" || before =~ '\$\d\+\s*$'
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
264 let str = 'String'.str
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
265 elseif before =~ '\$\d\+\.\d\+\s*$'
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
266 let str = 'Float'.str
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
267 elseif before =~ '\$\d\+\s*$'
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
268 let str = 'Integer'.str
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
269 elseif before =~ '/\s*$'
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
270 let str = 'Regexp'.str
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
271 else
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
272 let str = substitute(str,'^#','.','')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
273 endif
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
274 endif
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
275 let str = substitute(str,'.*\.\s*to_f\s*\.\s*','Float#','')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
276 let str = substitute(str,'.*\.\s*to_i\%(nt\)\=\s*\.\s*','Integer#','')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
277 let str = substitute(str,'.*\.\s*to_s\%(tr\)\=\s*\.\s*','String#','')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
278 let str = substitute(str,'.*\.\s*to_sym\s*\.\s*','Symbol#','')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
279 let str = substitute(str,'.*\.\s*to_a\%(ry\)\=\s*\.\s*','Array#','')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
280 let str = substitute(str,'.*\.\s*to_proc\s*\.\s*','Proc#','')
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
281 if str !~ '^\w'
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
282 return ''
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
283 endif
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
284 silent! let res = substitute(system("ri -f rdoc -T \"".str.'"'),'\n$','','')
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
285 if res =~ '^Nothing known about' || res =~ '^Bad argument:' || res =~ '^More than one method'
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
286 return ''
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
287 endif
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
288 return res
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
289 else
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
290 return ""
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
291 endif
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
292 endfunction
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
293
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
294 function! s:searchsyn(pattern, syn, flags, mode) abort
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
295 let cnt = v:count1
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
296 norm! m'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
297 if a:mode ==# 'v'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
298 norm! gv
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
299 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
300 let i = 0
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
301 call map(a:syn, 'hlID(v:val)')
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
302 while i < cnt
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
303 let i = i + 1
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
304 let line = line('.')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
305 let col = col('.')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
306 let pos = search(a:pattern,'W'.a:flags)
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
307 while pos != 0 && index(a:syn, s:synid()) < 0
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
308 let pos = search(a:pattern,'W'.a:flags)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
309 endwhile
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
310 if pos == 0
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
311 call cursor(line,col)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
312 return
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
313 endif
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
314 endwhile
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
315 endfunction
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
316
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
317 function! s:synid() abort
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
318 return synID(line('.'),col('.'),0)
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
319 endfunction
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
320
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
321 function! s:wrap_i(back,forward) abort
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
322 execute 'norm! k'
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
323 execute 'norm '.a:forward
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
324 let line = line('.')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
325 execute 'norm '.a:back
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
326 if line('.') == line - 1
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
327 return s:wrap_a(a:back,a:forward)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
328 endif
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
329 execute 'norm! jV'
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
330 execute 'norm '.a:forward
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
331 execute 'norm! k'
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
332 endfunction
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
333
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
334 function! s:wrap_a(back,forward) abort
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
335 execute 'norm '.a:forward
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
336 if line('.') < line('$') && getline(line('.')+1) ==# ''
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
337 let after = 1
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
338 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
339 execute 'norm '.a:back
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
340 while getline(line('.')-1) =~# '^\s*#' && line('.')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
341 -
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
342 endwhile
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
343 if exists('after')
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
344 execute 'norm! V'
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
345 execute 'norm '.a:forward
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
346 execute 'norm! j'
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
347 elseif line('.') > 1 && getline(line('.')-1) =~# '^\s*$'
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
348 execute 'norm! kV'
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
349 execute 'norm '.a:forward
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
350 else
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
351 execute 'norm! V'
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
352 execute 'norm '.a:forward
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
353 endif
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
354 endfunction
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
355
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
356 function! RubyCursorIdentifier() abort
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
357 let asciicode = '\%(\w\|[]})\"'."'".']\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)'
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
358 let number = '\%(\%(\w\|[]})\"'."'".']\s*\)\@<!-\)\=\%(\<[[:digit:]_]\+\%(\.[[:digit:]_]\+\)\=\%([Ee][[:digit:]_]\+\)\=\>\|\<0[xXbBoOdD][[:xdigit:]_]\+\>\)\|'.asciicode
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
359 let operator = '\%(\[\]\|<<\|<=>\|[!<>]=\=\|===\=\|[!=]\~\|>>\|\*\*\|\.\.\.\=\|=>\|[~^&|*/%+-]\)'
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
360 let method = '\%(\.[_a-zA-Z]\w*\s*=>\@!\|\<[_a-zA-Z]\w*\>[?!]\=\)'
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
361 let global = '$\%([!$&"'."'".'*+,./:;<=>?@\`~]\|-\=\w\+\>\)'
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
362 let symbolizable = '\%(\%(@@\=\)\w\+\>\|'.global.'\|'.method.'\|'.operator.'\)'
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
363 let pattern = '\C\s*\%('.number.'\|\%(:\@<!:\)\='.symbolizable.'\)'
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
364 let [lnum, col] = searchpos(pattern,'bcn',line('.'))
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
365 let raw = matchstr(getline('.')[col-1 : ],pattern)
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
366 let stripped = substitute(substitute(raw,'\s\+=$','=',''),'^\s*[:.]\=','','')
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
367 return stripped == '' ? expand("<cword>") : stripped
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
368 endfunction
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
369
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
370 function! RubyCursorTag() abort
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
371 return substitute(RubyCursorIdentifier(), '^[$@]*', '', '')
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
372 endfunction
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
373
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
374 function! RubyCursorFile() abort
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
375 let isfname = &isfname
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
376 try
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
377 set isfname+=:
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
378 let cfile = expand('<cfile>')
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
379 finally
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
380 let isfname = &isfname
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
381 endtry
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
382 let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!')
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
383 let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*')
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
384 if s:synid() ==# hlID('rubyConstant')
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
385 let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','')
15512
f0f06837a699 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
386 let cfile = substitute(cfile,'^::','','')
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
387 let cfile = substitute(cfile,'::','/','g')
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
388 let cfile = substitute(cfile,'\(\u\+\)\(\u\l\)','\1_\2', 'g')
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
389 let cfile = substitute(cfile,'\(\l\|\d\)\(\u\)','\1_\2', 'g')
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
390 return tolower(cfile) . '.rb'
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
391 elseif getline('.') =~# '^\s*require_relative\s*\(["'']\).*\1\s*$'
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
392 let cfile = expand('%:p:h') . '/' . matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1')
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
393 let cfile .= cfile !~# '\.rb$' ? '.rb' : ''
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
394 elseif getline('.') =~# '^\s*\%(require[( ]\|load[( ]\|autoload[( ]:\w\+,\)\s*\%(::\)\=File\.expand_path(\(["'']\)\.\./.*\1,\s*__FILE__)\s*$'
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
395 let target = matchstr(getline('.'),'\(["'']\)\.\.\zs/.\{-\}\ze\1')
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
396 let cfile = expand('%:p:h') . target
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
397 let cfile .= cfile !~# '\.rb$' ? '.rb' : ''
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
398 elseif getline('.') =~# '^\s*\%(require \|load \|autoload :\w\+,\)\s*\(["'']\).*\1\s*$'
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
399 let cfile = matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1')
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15512
diff changeset
400 let cfile .= cfile !~# '\.rb$' ? '.rb' : ''
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
401 elseif pre.post =~# '\<File.expand_path[( ].*[''"]\{2\}, *__FILE__\>' && cfile =~# '^\.\.'
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
402 let cfile = expand('%:p:h') . strpart(cfile, 2)
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
403 else
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
404 return substitute(cfile, '\C\v^(.*):(\d+)%(:in)=$', '+\2 \1', '')
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
405 endif
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
406 let cwdpat = '^\M' . substitute(getcwd(), '[\/]', '\\[\\/]', 'g').'\ze\[\/]'
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
407 let cfile = substitute(cfile, cwdpat, '.', '')
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
408 if fnameescape(cfile) !=# cfile
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
409 return '+ '.fnameescape(cfile)
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
410 else
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4869
diff changeset
411 return cfile
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
412 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
413 endfunction
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
414
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
415 "
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
416 " Instructions for enabling "matchit" support:
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
417 "
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
418 " 1. Look for the latest "matchit" plugin at
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
419 "
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
420 " http://www.vim.org/scripts/script.php?script_id=39
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
421 "
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
422 " It is also packaged with Vim, in the $VIMRUNTIME/macros directory.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
423 "
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
424 " 2. Copy "matchit.txt" into a "doc" directory (e.g. $HOME/.vim/doc).
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
425 "
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
426 " 3. Copy "matchit.vim" into a "plugin" directory (e.g. $HOME/.vim/plugin).
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
427 "
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
428 " 4. Ensure this file (ftplugin/ruby.vim) is installed.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
429 "
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
430 " 5. Ensure you have this line in your $HOME/.vimrc:
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
431 " filetype plugin on
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
432 "
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
433 " 6. Restart Vim and create the matchit documentation:
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
434 "
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
435 " :helptags ~/.vim/doc
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
436 "
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
437 " Now you can do ":help matchit", and you should be able to use "%" on Ruby
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
438 " keywords. Try ":echo b:match_words" to be sure.
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
439 "
1123
c4cd8ad60bee updated for version 7.1a
vimboss
parents: 867
diff changeset
440 " Thanks to Mark J. Reed for the instructions. See ":help vimrc" for the
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
441 " locations of plugin directories, etc., as there are several options, and it
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
442 " differs on Windows. Email gsinclair@soyabean.com.au if you need help.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
443 "
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
444
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1215
diff changeset
445 " vim: nowrap sw=2 sts=2 ts=8: