Skip to content

Commit ec0d8ff

Browse files
committed
Add aliases for path to rails#buffer()
In rails.vim, path() denotes an absolute path and name() a relative path. In fugitive.vim, it's the opposite. I'm not ready to fix this yet, so I'm adding some aliases that will provide for a safe transition at some point in the future.
1 parent a2c8dd8 commit ec0d8ff

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

autoload/rails.vim

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,18 @@ function! s:app_file(name)
579579
return extend(extend({'_app': self, '_name': a:name}, s:file_prototype,'keep'),s:readable_prototype,'keep')
580580
endfunction
581581

582+
function! s:readable_relative() dict abort
583+
return self.name()
584+
endfunction
585+
586+
function! s:readable_absolute() dict abort
587+
return self.path()
588+
endfunction
589+
590+
function! s:readable_spec() dict abort
591+
return self.path()
592+
endfunction
593+
582594
function! s:file_path() dict abort
583595
return self.app().path(self._name)
584596
endfunction
@@ -809,7 +821,7 @@ endfunction
809821
call s:add_methods('app',['default_locale','environments','file','has','test_suites'])
810822
call s:add_methods('file',['path','name','lines','getline'])
811823
call s:add_methods('buffer',['app','number','path','name','lines','getline','type_name'])
812-
call s:add_methods('readable',['app','calculate_file_type','type_name','line_count'])
824+
call s:add_methods('readable',['app','relative','absolute','spec','calculate_file_type','type_name','line_count'])
813825

814826
" }}}1
815827
" Ruby Execution {{{1
@@ -4358,6 +4370,7 @@ function! RailsBufInit(path)
43584370
if !has_key(s:apps,a:path)
43594371
let s:apps[a:path] = deepcopy(s:app_prototype)
43604372
let s:apps[a:path].root = a:path
4373+
let s:apps[a:path]._root = a:path
43614374
endif
43624375
let app = s:apps[a:path]
43634376
let buffer = rails#buffer()

0 commit comments

Comments
 (0)