Skip to content

Commit da318dc

Browse files
committed
Shorten the app path for :E<command>
That way, instead of opening e.g. "/home/<user>/projects/<app>/path/to/file", it'll just open "path/to/file", if we're in the root directory.
1 parent 0bb6d90 commit da318dc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

autoload/rails.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,7 +3064,7 @@ function! s:readable_open_command(cmd, argument, name, projections) dict abort
30643064
let file = ''
30653065
endif
30663066
if !empty(file) && self.app().has_path(file)
3067-
let file = self.app().path(file)
3067+
let file = fnamemodify(self.app().path(file), ':.')
30683068
return cmd . ' ' . s:fnameescape(file) . '|exe ' . s:sid . 'djump('.string(djump) . ')'
30693069
endif
30703070
endfor
@@ -3104,7 +3104,8 @@ function! s:readable_open_command(cmd, argument, name, projections) dict abort
31043104
let template = s:split(get(projected, 0, ''))
31053105
endif
31063106
call map(template, 's:gsub(v:val, "\t", " ")')
3107-
return cmd . ' ' . s:fnameescape(simplify(file)) . '|call setline(1, '.string(template).')' . '|set nomod'
3107+
let file = fnamemodify(simplify(file), ':.')
3108+
return cmd . ' ' . s:fnameescape(file) . '|call setline(1, '.string(template).')' . '|set nomod'
31083109
endif
31093110
endfor
31103111
return 'echoerr '.string("Couldn't find destination directory for ".a:name.' '.a:argument)

0 commit comments

Comments
 (0)