Skip to content

Commit 96f48b9

Browse files
committed
Add :Rmailer navigation command
1 parent d5179ee commit 96f48b9

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

autoload/rails.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,6 +2095,7 @@ function! s:BufFinderCommands()
20952095
call s:addfilecmds("model")
20962096
call s:addfilecmds("view")
20972097
call s:addfilecmds("controller")
2098+
call s:addfilecmds("mailer")
20982099
call s:addfilecmds("migration")
20992100
call s:addfilecmds("observer")
21002101
call s:addfilecmds("helper")
@@ -2181,6 +2182,10 @@ function! s:controllerList(A,L,P)
21812182
return s:autocamelize(con,a:A)
21822183
endfunction
21832184

2185+
function! s:mailerList(A,L,P)
2186+
return s:autocamelize(rails#app().relglob("app/mailers/","**/*",".rb"),a:A)
2187+
endfunction
2188+
21842189
function! s:viewList(A,L,P)
21852190
let c = s:controller(1)
21862191
let top = rails#app().relglob("app/views/",s:fuzzyglob(a:A))
@@ -2616,6 +2621,10 @@ function! s:controllerEdit(cmd,...)
26162621
return s:EditSimpleRb(a:cmd,"controller",controller,"app/controllers/",suffix)
26172622
endfunction
26182623

2624+
function! s:mailerEdit(cmd,...)
2625+
return s:EditSimpleRb(a:cmd,"mailer",a:0? a:1 : s:controller(1),"app/mailers/\napp/models/",".rb")
2626+
endfunction
2627+
26192628
function! s:helperEdit(cmd,...)
26202629
return s:EditSimpleRb(a:cmd,"helper",a:0? a:1 : s:controller(1),"app/helpers/","_helper.rb")
26212630
endfunction

doc/rails.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ itself!).
347347
:Rlayout |rails-:Rlayout|
348348
:Rlib |rails-:Rlib|
349349
:Rlocale |rails-:Rlocale|
350+
:Rmailer |rails-:Rmailer|
350351
:Rmetal |rails-:Rmetal|
351352
:Rmigration |rails-:Rmigration|
352353
:Rmodel |rails-:Rmodel|
@@ -416,6 +417,11 @@ itself!).
416417
no argument, checks config/environment.rb for the
417418
default locale.
418419

420+
*rails-:Rmailer*
421+
:Rmailer [{name}] Edit the mailer specified. This looks in both
422+
app/mailers for Rails 3 and app/models for older
423+
versions of Rails but only tab completes the former.
424+
419425
*rails-:Rmetal*
420426
:Rmetal [{name}] Edit the app/metal file specified. With no argument,
421427
defaults to editing config/boot.rb.

0 commit comments

Comments
 (0)