Skip to content

Commit db4997c

Browse files
committed
Reduce :Rnavcommand to a removal notification
1 parent c67fe01 commit db4997c

File tree

2 files changed

+12
-38
lines changed

2 files changed

+12
-38
lines changed

autoload/rails.vim

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,34 +2556,16 @@ function! s:Navcommand(bang,...)
25562556
let suffix = '.rb'
25572557
let affinity = ''
25582558
for arg in a:000
2559-
if arg =~# '^-suffix='
2560-
let suffix = matchstr(arg,'-suffix=\zs.*')
2561-
elseif arg =~# '^-default='
2562-
let default = matchstr(arg,'-default=\zs.*')
2563-
if default =~# '()$'
2564-
let affinity = default[0:-3]
2565-
unlet default
2566-
endif
2567-
elseif arg !~# '^-'
2568-
if !exists('name')
2569-
let name = arg
2570-
else
2571-
let prefixes += [s:sub(arg, '/=$', '/')]
2572-
endif
2559+
if arg =~# '^[a-z]\+$'
2560+
for prefix in ['E', 'S', 'V', 'T', 'D', 'R', 'RE', 'RS', 'RV', 'RT', 'RD']
2561+
exe 'command! -buffer -bar -bang -nargs=* ' .
2562+
\ (prefix =~# 'D' ? '-range=0 ' : '') .
2563+
\ prefix . arg . ' :echoerr ' .
2564+
\ string(':Rnavcommand has been removed. See :help rails-projections')
2565+
endfor
2566+
break
25732567
endif
25742568
endfor
2575-
if !exists('name') || name !~# '^[a-z]\+$'
2576-
return s:error("E182: Invalid command name")
2577-
endif
2578-
if empty(prefixes)
2579-
return ''
2580-
endif
2581-
let command = map(prefixes, '{"pattern": v:val . "*" . suffix, "affinity": affinity}')
2582-
if exists('default')
2583-
let command += [{"pattern": default}]
2584-
endif
2585-
let deprecation = ':Rnavcommand is deprecated. See :help config/projections.json for replacement.'
2586-
return s:define_navcommand(name, command, 'call s:warn('.string(deprecation).')')
25872569
endfunction
25882570

25892571
function! s:define_navcommand(name, projection, ...) abort

doc/rails.txt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Author: Tim Pope <http://tpo.pe/>
88
|rails-gf| File Under Cursor - gf
99
|rails-alternate-related| Alternate and Related Files
1010
|rails-type-navigation| File Type Commands
11-
|rails-custom-navigation| Custom Navigation Commands
1211
|rails-rake| Rake
1312
|rails-scripts| Script Wrappers
1413
|rails-refactoring| Refactoring Helpers
@@ -362,17 +361,6 @@ There are also "classic" versions of these commands that start with :R (e.g.,
362361
given with an extension, a new file will be created.
363362
This is a quick way to create a new view.
364363

365-
Custom Navigation Commands ~
366-
*rails-custom-navigation*
367-
368-
The officially supported way to create custom navigation commands is with
369-
projections, as described under |rails-projections|.
370-
371-
*rails-:Rnavcommand*
372-
:Rnavcommand [options] {name} [{path} ...]
373-
Create a custom navigation command. Deprecated in
374-
favor of |rails-projections|.
375-
376364
Finally, one Vim feature that proves helpful in conjunction with all of the
377365
above is |CTRL-^|. This keystroke edits the previous file, and is helpful to
378366
back out of any of the above commands.
@@ -870,6 +858,10 @@ Rails file is loaded.
870858
This file used to be sourced automatically from the root of the application,
871859
but has been superseded by |rails-projections|.
872860

861+
*rails-:Rnavcommand*
862+
:Rnavcommand This command has been superseded by
863+
|rails-projections|.
864+
873865
*rails-:Rset*
874866
:Rset This command has been superseded by
875867
|rails-projections|.

0 commit comments

Comments
 (0)