Skip to content

Commit 44a5e8a

Browse files
author
skywind3000
committed
Refactor buffer path retrieval in asyncrun locator plugin
1 parent f282cf1 commit 44a5e8a

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

autoload/asyncrun/locator.vim

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,54 @@ function! asyncrun#locator#nofile_buffer_path() abort
7272
if t != '' && isdirectory(t)
7373
return t
7474
endif
75+
elseif &ft == 'tagbar'
76+
if bufname('%') =~ '\v^__TagBar__\.'
77+
if exists('t:tagbar_state')
78+
try
79+
let t = t:tagbar_state._current.fpath
80+
return t
81+
catch
82+
endtry
83+
endif
84+
endif
85+
elseif &ft == 'vista' || &ft =~ '\v^vista_'
86+
try
87+
let t = g:vista.source.fname
88+
return fnamemodify(t, ':p')
89+
catch
90+
endtry
91+
elseif &ft == 'aerial'
92+
if exists('b:source_buffer')
93+
let name = bufname(b:source_buffer)
94+
return name
95+
endif
96+
elseif &ft == 'Outline'
97+
try
98+
let t = luaeval("require('outline').current.code.buf")
99+
return bufname(t)
100+
catch
101+
try
102+
let wid = luaeval("require('symbols-outline').state.code_win")
103+
let bid = winbufnr(wid)
104+
return bufname(bid)
105+
catch
106+
endtry
107+
endtry
75108
endif
76109
if exists('b:git_dir')
77110
return b:git_dir
78111
endif
79112
endif
113+
if &ft == 'oil' && &bt != ''
114+
let name = bufname('%')
115+
if name =~ '\v^oil\:[\\\/][\\\/]'
116+
let t = strpart(name, s:windows? 7 : 6)
117+
if s:windows && t =~ '\v^\w[\\\/]'
118+
let t = strpart(t, 0, 1) . ':' . strpart(t, 1)
119+
endif
120+
return t
121+
endif
122+
endif
80123
return ''
81124
endfunc
82125

0 commit comments

Comments
 (0)