Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions plugin/bufferhint.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
""let g:bufferhintLoaded = 1

" 0=path, 1=lru
if !exists("g:bufferhint_FullPath")
let g:bufferhint_FullPath = 1
endif

if !exists("g:bufferhint_SortMode")
let g:bufferhint_SortMode = 0
endif
Expand Down Expand Up @@ -324,7 +328,12 @@ fu! s:SortedByPath()
let maxpath = 0
for bid in range(1, lastbuf)
if !buflisted(bid) || s:IsBadTypeBuffer(bid) | continue | endif
let path = s:RelativeFilePath(bufname(bid))
if g:bufferhint_FullPath == 1
let path = s:RelativeFilePath(bufname(bid))
let path = bufname(bid)
else
let path = fnamemodify(bufname(bid), ":t")
endif
let pathidmap[path] = bid
let len = strlen(path)
if (len > maxpath)
Expand Down Expand Up @@ -709,8 +718,8 @@ fu! s:RelativeFilePath(bname)
if !filereadable(a:bname)
return "#" . a:bname . "#"
endif
let fullpath = fnamemodify(a:bname, ":p")
let workpath = fnamemodify(getcwd(), ":p")
let fullpath = fnamemodify(a:bname, ":t")
let workpath = fnamemodify(getcwd(), ":t")
let relpath = strpart(fullpath, strlen(matchstr(fullpath, workpath, 0)))
return relpath
endfu
Expand Down