From b199dd80cd1517f62ecaa694119fbe7aff9a8a9b Mon Sep 17 00:00:00 2001 From: "j5shi.vip@gmail.com" Date: Mon, 29 Feb 2016 15:07:20 +0800 Subject: [PATCH 1/2] fixed issue #9 and #10 --- autoload/ctrlp_bdelete.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autoload/ctrlp_bdelete.vim b/autoload/ctrlp_bdelete.vim index 3ad25c4..d1d6ff2 100644 --- a/autoload/ctrlp_bdelete.vim +++ b/autoload/ctrlp_bdelete.vim @@ -54,8 +54,10 @@ function! s:DeleteMarkedBuffers() " call bdelete on all marked buffers for fname in marked - let bufid = fname =~ '\[\d\+\*No Name\]$' ? str2nr(matchstr(fname, '\d\+')) - \ : fnamemodify(fname[2:], ':p') + let g:ctrlp_delete_buf_fname = fname + let bufid = fname =~ '\[\d\+\*No Name\]$' ? str2nr(matchstr(matchstr(fname, '\[\d\+\*No Name\]$'), '\d\+')) + \ : fnamemodify(fname, ':p') + let g:ctrlp_delete_buf_bufid = bufid exec "silent! bdelete" bufid endfor From 9f3108ea5f9f62823ab1e644edc86cf13dc90e33 Mon Sep 17 00:00:00 2001 From: "j5shi.vip@gmail.com" Date: Mon, 29 Feb 2016 22:17:50 +0800 Subject: [PATCH 2/2] fixed a bug when the path contains spaces --- autoload/ctrlp_bdelete.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/autoload/ctrlp_bdelete.vim b/autoload/ctrlp_bdelete.vim index d1d6ff2..74fa6c6 100644 --- a/autoload/ctrlp_bdelete.vim +++ b/autoload/ctrlp_bdelete.vim @@ -55,10 +55,11 @@ function! s:DeleteMarkedBuffers() " call bdelete on all marked buffers for fname in marked let g:ctrlp_delete_buf_fname = fname - let bufid = fname =~ '\[\d\+\*No Name\]$' ? str2nr(matchstr(matchstr(fname, '\[\d\+\*No Name\]$'), '\d\+')) - \ : fnamemodify(fname, ':p') - let g:ctrlp_delete_buf_bufid = bufid - exec "silent! bdelete" bufid + let bufid = fname =~ '\[\d\+\*No Name\]$' + \ ? str2nr(matchstr(matchstr(fname, '\[\d\+\*No Name\]$'), '\d\+')) + \ : fnamemodify(fname, ':p') + let g:ctrlp_delete_buf_bufid = substitute(bufid, ' ', '\\ ', "g") + exec "silent! bdelete" g:ctrlp_delete_buf_bufid endfor " refresh ctrlp