@@ -4039,32 +4039,6 @@ function! rails#sprockets_syntax() abort
40394039 hi def link sprocketsIncluded String
40404040endfunction
40414041
4042- " }}}1
4043- " Mappings {{{1
4044-
4045- nnoremap <SID> : :<C-U><C-R> =v:count ? v:count : ''<CR>
4046- function ! s: BufMappings () abort
4047- if empty (maparg (' <Plug><cfile>' , ' c' ))
4048- return
4049- endif
4050- let pattern = ' ^$\|_gf(v:count\|[Rr]uby\|[Rr]ails'
4051- if mapcheck (' gf' , ' n' ) = ~# pattern
4052- nmap <buffer> <silent> gf <SID> :find <Plug><cfile><CR>
4053- endif
4054- if mapcheck (' <C-W>f' , ' n' ) = ~# pattern
4055- nmap <buffer> <silent> <C-W> f <SID> :sfind <Plug><cfile><CR>
4056- endif
4057- if mapcheck (' <C-W><C-F>' , ' n' ) = ~# pattern
4058- nmap <buffer> <silent> <C-W><C-F> <SID> :sfind <Plug><cfile><CR>
4059- endif
4060- if mapcheck (' <C-W>gf' , ' n' ) = ~# pattern
4061- nmap <buffer> <silent> <C-W> gf <SID> :tabfind <Plug><cfile><CR>
4062- endif
4063- if mapcheck (' <C-R><C-F>' , ' c' ) = ~# pattern
4064- cmap <buffer> <C-R><C-F> <Plug><cfile>
4065- endif
4066- endfunction
4067-
40684042" }}}1
40694043" Database {{{1
40704044
@@ -4806,6 +4780,31 @@ endfunction
48064780
48074781call s: add_methods (' app' , [' internal_load_path' ])
48084782
4783+ nnoremap <SID> : :<C-U><C-R> =v:count ? v:count : ''<CR>
4784+ function ! s: map_gf () abort
4785+ let pattern = ' ^$\|_gf(v:count\|[Rr]uby\|[Rr]ails'
4786+ if mapcheck (' gf' , ' n' ) = ~# pattern
4787+ nmap <buffer> <silent> gf <SID> :find <Plug><cfile><CR>
4788+ let b: undo_ftplugin .= " |sil! exe 'nunmap <buffer> gf'"
4789+ endif
4790+ if mapcheck (' <C-W>f' , ' n' ) = ~# pattern
4791+ nmap <buffer> <silent> <C-W> f <SID> :sfind <Plug><cfile><CR>
4792+ let b: undo_ftplugin .= " |sil! exe 'nunmap <buffer> <C-W>f'"
4793+ endif
4794+ if mapcheck (' <C-W><C-F>' , ' n' ) = ~# pattern
4795+ nmap <buffer> <silent> <C-W><C-F> <SID> :sfind <Plug><cfile><CR>
4796+ let b: undo_ftplugin .= " |sil! exe 'nunmap <buffer> <C-W><C-F>'"
4797+ endif
4798+ if mapcheck (' <C-W>gf' , ' n' ) = ~# pattern
4799+ nmap <buffer> <silent> <C-W> gf <SID> :tabfind <Plug><cfile><CR>
4800+ let b: undo_ftplugin .= " |sil! exe 'nunmap <buffer> <C-W>gf'"
4801+ endif
4802+ if mapcheck (' <C-R><C-F>' , ' c' ) = ~# pattern
4803+ cmap <buffer> <C-R><C-F> <Plug><cfile>
4804+ let b: undo_ftplugin .= " |sil! exe 'cunmap <buffer> <C-R><C-F>'"
4805+ endif
4806+ endfunction
4807+
48094808function ! rails#update_path (before, after) abort
48104809 if &l: path = ~# ' \v^\.%(,/%(usr|emx)/include)=,,$'
48114810 let before = []
@@ -4845,6 +4844,7 @@ function! rails#sprockets_setup(type) abort
48454844 let map = 'rails#sprockets_cfile(' . map . ')'
48464845 exe ' cmap <buffer><script><expr> <Plug><cfile>' map
48474846 let b: undo_ftplugin .= " |exe 'sil! cunmap <buffer> <Plug><cfile>'"
4847+ call s: map_gf ()
48484848endfunction
48494849
48504850function ! rails#webpacker_setup (type ) abort
@@ -4885,6 +4885,7 @@ function! rails#ruby_setup() abort
48854885 let engine_paths = s: gem_subdirs (' app' )
48864886 call rails#update_path (path , engine_paths)
48874887 cmap <buffer> <script><expr> <Plug><cfile> rails#ruby_cfile()
4888+ call s: map_gf ()
48884889endfunction
48894890
48904891function ! rails#buffer_setup () abort
@@ -4900,7 +4901,6 @@ function! rails#buffer_setup() abort
49004901 let &l: tags = rp . ' /tags,' . rp . ' /tmp/tags,' . &tags
49014902 endif
49024903
4903- call s: BufMappings ()
49044904 call s: BufCommands ()
49054905 call s: BufProjectionCommands ()
49064906
0 commit comments