Skip to content

Commit 70df845

Browse files
committed
Deprecate :Redit and :Rfind
1 parent 2b07476 commit 70df845

File tree

2 files changed

+33
-37
lines changed

2 files changed

+33
-37
lines changed

autoload/rails.vim

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,19 +1688,19 @@ endfunction
16881688
function! s:BufNavCommands()
16891689
command! -buffer -bar -nargs=? -complete=customlist,s:Complete_cd Rcd :cd `=rails#app().path(<q-args>)`
16901690
command! -buffer -bar -nargs=? -complete=customlist,s:Complete_cd Rlcd :lcd `=rails#app().path(<q-args>)`
1691-
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rfind :call s:Find(<count>,'<bang>' ,<f-args>)
1692-
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find REfind :call s:Find(<count>,'E<bang>',<f-args>)
1693-
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RSfind :call s:Find(<count>,'S<bang>',<f-args>)
1694-
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RVfind :call s:Find(<count>,'V<bang>',<f-args>)
1695-
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RTfind :call s:Find(<count>,'T<bang>',<f-args>)
1696-
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rsfind :<count>RSfind<bang> <args>
1697-
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rtabfind :<count>RTfind<bang> <args>
1698-
command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit Redit :call s:Edit(<count>,'<bang>' ,<f-args>)
1699-
command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit REedit :call s:Edit(<count>,'E<bang>',<f-args>)
1700-
command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RSedit :call s:Edit(<count>,'S<bang>',<f-args>)
1701-
command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RVedit :call s:Edit(<count>,'V<bang>',<f-args>)
1702-
command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RTedit :call s:Edit(<count>,'T<bang>',<f-args>)
1703-
command! -buffer -bar -nargs=* -range=0 -complete=customlist,s:Complete_edit RDedit :call s:Edit(<count>,'<line1>D<bang>',<f-args>)
1691+
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rfind :call s:warn( 'Rfind has been deprecated in favor of :1R or :find' )|call s:Find(<count>,'<bang>' ,<f-args>)
1692+
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find REfind :call s:warn('REfind has been deprecated in favor of :1RE or :find')|call s:Find(<count>,'E<bang>',<f-args>)
1693+
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RSfind :call s:warn('RSfind has been deprecated in favor of :1RS or :find')|call s:Find(<count>,'S<bang>',<f-args>)
1694+
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RVfind :call s:warn('RVfind has been deprecated in favor of :1RV or :find')|call s:Find(<count>,'V<bang>',<f-args>)
1695+
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RTfind :call s:warn('RTfind has been deprecated in favor of :1RT or :find')|call s:Find(<count>,'T<bang>',<f-args>)
1696+
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rsfind :call s:warn('Rsfind has been deprecated in favor of :1RS or :sfind')|<count>RSfind<bang> <args>
1697+
command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rtabfind :call s:warn('Rtabfind has been deprecated in favor of :1RT or :tabfind')|<count>RTfind<bang> <args>
1698+
command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit Redit :call s:warn( 'Redit has been deprecated in favor of :R')|call s:Edit(<count>,'<bang>' ,<f-args>)
1699+
command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit REedit :call s:warn('REedit has been deprecated in favor of :RE')|call s:Edit(<count>,'E<bang>',<f-args>)
1700+
command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RSedit :call s:warn('RSedit has been deprecated in favor of :RS')|call s:Edit(<count>,'S<bang>',<f-args>)
1701+
command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RVedit :call s:warn('RVedit has been deprecated in favor of :RV')|call s:Edit(<count>,'V<bang>',<f-args>)
1702+
command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RTedit :call s:warn('RTedit has been deprecated in favor of :RT')|call s:Edit(<count>,'T<bang>',<f-args>)
1703+
command! -buffer -bar -nargs=* -range=0 -complete=customlist,s:Complete_edit RDedit :call s:warn('RDedit has been deprecated in favor of :RD')|call s:Edit(<count>,'<line1>D<bang>',<f-args>)
17041704
command! -buffer -bar -nargs=* -range=0 -complete=customlist,s:Complete_related A :call s:Alternate('<bang>', <line1>,<line2>,<count>,<f-args>)
17051705
command! -buffer -bar -nargs=* -range=0 -complete=customlist,s:Complete_related AE :call s:Alternate('E<bang>',<line1>,<line2>,<count>,<f-args>)
17061706
command! -buffer -bar -nargs=* -range=0 -complete=customlist,s:Complete_related AS :call s:Alternate('S<bang>',<line1>,<line2>,<count>,<f-args>)
@@ -3806,10 +3806,10 @@ endfunction
38063806
" Mappings {{{1
38073807

38083808
function! s:BufMappings()
3809-
nnoremap <buffer> <silent> <Plug>RailsFind :<C-U>REfind<CR>
3810-
nnoremap <buffer> <silent> <Plug>RailsSplitFind :<C-U>RSfind<CR>
3811-
nnoremap <buffer> <silent> <Plug>RailsVSplitFind :<C-U>RVfind<CR>
3812-
nnoremap <buffer> <silent> <Plug>RailsTabFind :<C-U>RTfind<CR>
3809+
nnoremap <buffer> <silent> <Plug>RailsFind :<C-U>call <SID>Find(v:count1,'E')<CR>
3810+
nnoremap <buffer> <silent> <Plug>RailsSplitFind :<C-U>call <SID>Find(v:count1,'S')<CR>
3811+
nnoremap <buffer> <silent> <Plug>RailsVSplitFind :<C-U>call <SID>Find(v:count1,'V')<CR>
3812+
nnoremap <buffer> <silent> <Plug>RailsTabFind :<C-U>call <SID>Find(v:count1,'T')<CR>
38133813
if g:rails_mappings
38143814
if !hasmapto("<Plug>RailsFind")
38153815
nmap <buffer> gf <Plug>RailsFind

doc/rails.txt

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ actually edit a file from a Rails application.
7171
|:help| rails.
7272

7373
*rails-:Redit*
74-
:Redit {file} Edit {file}, relative to the application root. Append
75-
:line or #method to jump within the file, as in
76-
:Redit app/controllers/users_controller.rb:12 or
77-
:Redit app/models/user.rb#activate .
74+
:Redit {file} Deprecated in favor of |:R|.
75+
76+
*rails-:Rfind*
77+
:Rfind [{file}] Deprecated in favor of |:R| or |:find|.
7878

7979
*rails-:Rlog*
8080
:Rlog [{logfile}] Split window and open {logfile} ($RAILS_ENV or
@@ -145,19 +145,13 @@ following features will greatly ease navigating the Rails file structure.
145145

146146
The 'path' has been modified to include all the best places to be.
147147
>
148-
:find blog_controller
149-
:find book_test
148+
:find application_controller.rb
150149
<
151-
*rails-:Rfind*
152-
:Rfind [{file}] Find {file}. Very similar to :find, but things like
153-
BlogController are properly handled, and tab complete
154-
works.
155-
156150
File Under Cursor - gf ~
157151
*rails-gf*
158152
The |gf| command, which normally edits the current file under the cursor, has
159-
been remapped to take context into account. |CTRL-W_f|(open in new window) and
160-
|CTRL-W_gf| (open in new tab) are also remapped.
153+
been remapped to take context into account. |CTRL-W_f| (open in new window)
154+
and |CTRL-W_gf| (open in new tab) are also remapped.
161155

162156
Example uses of |gf|, and where they might lead.
163157
(* indicates cursor position)
@@ -208,15 +202,17 @@ Two commands, :A and :R, are used quickly jump to an "alternate" and a
208202
:AS either the same window (:A and :AE), a new split
209203
:AV window (:AS), a new vertically split window (:AV), a
210204
:AT new tab (:AT), or read it into the current buffer
211-
:AD (:AD).
205+
:AD (:AD).
212206

213207
*rails-:R* *rails-:RE* *rails-:RS* *rails-:RV* *rails-:RT* *rails-:RD*
214208
:R These are similar |rails-:A| and friends above, only
215209
:RE they jump to the "related" file rather than the
216-
:RS "alternate."
217-
:RV
218-
:RT
219-
:RD
210+
:RS "alternate." With a file name argument, they edit
211+
:RV a file relative to the application root (:R Rakefile),
212+
:RT and with a count and a file name argument, they find a
213+
:RD file in 'path' (e.g., :1R PostsController.) You can
214+
also append a line number (post.rb:42) or a method
215+
(PostsController#32) to both forms.
220216

221217
*rails-alternate* *rails-related*
222218
The alternate file is most frequently the test file, though there are
@@ -255,8 +251,8 @@ opening in a new tab, and reading the file into the current buffer. For
255251
:Rmodel, those variants would be :RSmodel, :RVmodel, :RTmodel, and :RDmodel.
256252
There is also :REmodel which is a synonym for :Rmodel (future versions might
257253
allow customization of the behavior of :Rmodel). They also allow for jumping
258-
to methods or line numbers using the same syntax as |:Redit|, and file
259-
creation can be forced by adding a ! after the filename (not after the command
254+
to methods or line numbers using the same syntax as |:R|, and file creation
255+
can be forced by adding a ! after the filename (not after the command
260256
itself!).
261257

262258
:Rcontroller |rails-:Rcontroller|

0 commit comments

Comments
 (0)