@@ -154,11 +154,14 @@ function! s:map(mode, flags, map) abort
154154 endif
155155endfunction
156156
157- function ! s: silmap ( mode , map ) abort
158- call s: map ( a: mode , ' <silent ><script>' , a: map )
159- endfunction
157+ cmap <buffer> <script><expr> <Plug><cword> substitute(RubyCursorIdentifier(),'^$',"\022\027",'')
158+ cmap <buffer ><script><expr> <Plug><cfile> substitute(RubyCursorFile(),'^$',"\022\006",'' )
159+ let b: undo_ftplugin .= " | sil! cunmap <buffer> <Plug><cword>| sil! cunmap <buffer> <Plug><cfile> "
160160
161161if ! exists (" g:no_plugin_maps" ) && ! exists (" g:no_ruby_maps" )
162+ nmap <buffer> <script> <SID> : :<C-U>
163+ nmap <buffer> <script> <SID> c: :<C-U><C-R> =v:count ? v:count : ''<CR>
164+
162165 nnoremap <silent> <buffer> [m :<C-U> call <SID> searchsyn('\<def\> ','rubyDefine','b','n')<CR>
163166 nnoremap <silent> <buffer> ]m :<C-U> call <SID> searchsyn('\<def\> ','rubyDefine','','n')<CR>
164167 nnoremap <silent> <buffer> [M :<C-U> call <SID> searchsyn('\<end\> ','rubyDefine','b','n')<CR>
@@ -201,28 +204,24 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
201204 \. " | sil! exe 'xunmap <buffer> iM' | sil! exe 'xunmap <buffer> aM'"
202205 endif
203206
204- cnoremap <buffer> <SID> foldopen <Bar> if &foldopen =~# 'tag'<Bar> exe 'norm! zv'<Bar> endif
205- call s: silmap (' n' , ' <C-]> :<C-U>exe v:count1."tag <C-R>=RubyCursorIdentifier()<CR>"<SID>foldopen<CR>' )
206- call s: silmap (' n' , ' g<C-]> :<C-U>exe "tjump <C-R>=RubyCursorIdentifier()<CR>"<SID>foldopen<CR>' )
207- call s: silmap (' n' , ' g] :<C-U>exe "tselect <C-R>=RubyCursorIdentifier()<CR>"<SID>foldopen<CR>' )
208- call s: silmap (' n' , ' <C-W>] :<C-U>exe v:count1."stag <C-R>=RubyCursorIdentifier()<CR>"<SID>foldopen<CR>' )
209- call s: silmap (' n' , ' <C-W><C-]> :<C-U>exe v:count1."stag <C-R>=RubyCursorIdentifier()<CR>"<SID>foldopen<CR>' )
210- call s: silmap (' n' , ' <C-W>g<C-]> :<C-U>exe "stjump <C-R>=RubyCursorIdentifier()<CR>"<SID>foldopen<CR>' )
211- call s: silmap (' n' , ' <C-W>g] :<C-U>exe "stselect <C-R>=RubyCursorIdentifier()<CR>"<SID>foldopen<CR>' )
212- call s: silmap (' n' , ' <C-W>} :<C-U>exe "ptag <C-R>=RubyCursorIdentifier()<CR>"<CR>' )
213- call s: silmap (' n' , ' <C-W>g} :<C-U>exe "ptjump <C-R>=RubyCursorIdentifier()<CR>"<CR>' )
214-
215- cmap <buffer> <script><expr> <Plug><cword> substitute(RubyCursorIdentifier(),'^$',"\022\027",'')
216- cmap <buffer> <script><expr> <Plug><cfile> substitute(RubyCursorFile(),'^$',"\022\006",'')
217- let b: undo_ftplugin .= " | sil! cunmap <buffer> <Plug><cword>| sil! cunmap <buffer> <Plug><cfile>"
218207 call s: map (' c' , ' ' , ' <C-R><C-W> <Plug><cword>' )
219208 call s: map (' c' , ' ' , ' <C-R><C-F> <Plug><cfile>' )
220209
221- nmap <buffer> <script> <SID> : :<C-U><C-R> =v:count ? v:count : ''<CR>
222- call s: map (' n' , ' <silent>' , ' gf <SID>:find <Plug><cfile><CR>' )
223- call s: map (' n' , ' <silent>' , ' <C-W>f <SID>:sfind <Plug><cfile><CR>' )
224- call s: map (' n' , ' <silent>' , ' <C-W><C-F> <SID>:sfind <Plug><cfile><CR>' )
225- call s: map (' n' , ' <silent>' , ' <C-W>gf <SID>:tabfind <Plug><cfile><CR>' )
210+ nmap <buffer> <script><expr> <SID> tagzv &foldopen =~# 'tag' ? 'zv' : ''
211+ call s: map (' n' , ' <silent>' , ' <C-]> <SID>c:tag <Plug><cword><CR><SID>tagzv' )
212+ call s: map (' n' , ' <silent>' , ' g<C-]> <SID>:tjump <Plug><cword><CR><SID>tagzv' )
213+ call s: map (' n' , ' <silent>' , ' g] <SID>:tselect <Plug><cword><CR><SID>tagzv' )
214+ call s: map (' n' , ' <silent>' , ' <C-W>] <SID>c:stag <Plug><cword><CR><SID>tagzv' )
215+ call s: map (' n' , ' <silent>' , ' <C-W><C-]> <SID>c:stag <Plug><cword><CR><SID>tagzv' )
216+ call s: map (' n' , ' <silent>' , ' <C-W>g<C-]> <SID>:stjump <Plug><cword><CR><SID>tagzv' )
217+ call s: map (' n' , ' <silent>' , ' <C-W>g] <SID>:stselect <Plug><cword><CR><SID>tagzv' )
218+ call s: map (' n' , ' <silent>' , ' <C-W>} <SID>c:ptag <Plug><cword><CR>' )
219+ call s: map (' n' , ' <silent>' , ' <C-W>g} <SID>:ptjump <Plug><cword><CR>' )
220+
221+ call s: map (' n' , ' <silent>' , ' gf <SID>c:find <Plug><cfile><CR>' )
222+ call s: map (' n' , ' <silent>' , ' <C-W>f <SID>c:sfind <Plug><cfile><CR>' )
223+ call s: map (' n' , ' <silent>' , ' <C-W><C-F> <SID>c:sfind <Plug><cfile><CR>' )
224+ call s: map (' n' , ' <silent>' , ' <C-W>gf <SID>c:tabfind <Plug><cfile><CR>' )
226225endif
227226
228227let &cpo = s: cpo_save
0 commit comments