dmenu.vim

Unnamed repository; edit this file 'description' to name the repository.
git clone git://edryd.org/dmenu.vim
Log | Files | Refs

commit 9112dc325724593510fe6254893d293e66e9a8a9
parent 5c2a32cb5482cd41ecdcf532b6b9c093238a0657
Author: Ed van Bruggen <edvb54@gmail.com>
Date:   Mon, 10 Oct 2016 17:55:01 -0700

Change :DmenuBuf to show previous buffer on top

Diffstat:
plugin/dmenu.vim | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/plugin/dmenu.vim b/plugin/dmenu.vim @@ -51,11 +51,14 @@ endfunction " switch to already loaded buffer with cmd function! s:dmenu_buf(cmd) - let bufs = range(1, bufnr('$')) " get open buffers - call filter(bufs, 'buflisted(v:val)') " remove unlisted buffers + let bufs = range(1, bufnr('$')) " get open buffers + call filter(bufs, 'buflisted(v:val)') " remove unlisted buffers + if bufname('#') != bufname('%') " if there is a previous buffer, move it to top + let bufs = ['#'] + bufs + endif let files = map(copy(bufs), 'bufname(v:val)') " convert numbers to names - - call s:dmenu_open(join(files, '\n'), a:cmd) + let files = filter(copy(files), 'v:val !~ bufname("#") || v:key == 0') " only leave previous buffer at top + call s:dmenu_open(join(files, '\n'), a:cmd) " convert files list into string for dmenu endfunction function! s:dmenu_tag()