-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
I was using this plug I found some time ago until finding your lovely alternative:
function! toggle#GetBufferList()
redir =>buflist
silent! ls
redir END
return buflist
endfunction
function! toggle#ToggleList(bufname, pfx)
let buflist = toggle#GetBufferList()
for bufnum in map(filter(split(buflist, '\n'), 'v:val =~ "'.a:bufname.'"'), 'str2nr(matchstr(v:val, "\\d\\+"))')
if bufwinnr(bufnum) != -1
exec(a:pfx.'close')
return
endif
endfor
if a:pfx == 'l' && len(getloclist(0)) == 0
echohl ErrorMsg
echo "Location List is Empty."
return
endif
let winnr = winnr()
exec(a:pfx.'open')
if winnr() != winnr
wincmd p
endif
endfunctionThe thing I miss is the error message that alerts you that the list is empty.
Not sure if you'd be cool with adding something like that or not?
Metadata
Metadata
Assignees
Labels
No labels