Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set confirm does't work with minibufexpl #112

Closed
PetrusZ opened this issue Jan 3, 2014 · 1 comment
Closed

set confirm does't work with minibufexpl #112

PetrusZ opened this issue Jan 3, 2014 · 1 comment

Comments

@PetrusZ
Copy link

PetrusZ commented Jan 3, 2014

I add set confirm in .vimrc and install minibufexpl.

And if I modify one or more file and close it by ":MBEbd" or "d" in MBE, vim doesn't display the confirmation prompt, but actually the options stil work, type "y" can save the modified and close, type "n" can not save the modified and close, type "c" can cancel it, type nothing you will jam.

Additional: can't change current buffer name's and current modified buffer name's color, I have tried

hi MBEChanged
hi MBEVisibleNormal
hi MBEVisibleNormalActive
hi MBEVisibleChanged 
hi MBEVisibleChangedActive 

but no one work.

@PhilRunninger
Copy link

The problem with set confirm is happening because the bd command is running silently. See the DeleteBuffer function:

let l:cmd = 'silent! '.l:cmd.' '.l:bufNum
call <SID>DEBUG('About to execute the command "'.l:cmd.'"',5)

exec l:cmd

I restored the prompt by replacing the above code with these lines:

let l:cmd = l:cmd.' '.l:bufNum
if &confirm == 0
  let l:cmd = 'silent! '.l:cmd
endif
call <SID>DEBUG('About to execute the command "'.l:cmd.'"',5)

exec l:cmd

However, if I cancel the :MBEbd function, I get these error messages:

Save changes to "Untitled"?
[Y]es, (N)o, (C)ancel: C
Error detected while processing function <SNR>21_DeleteBuffer:
line 66:
E516: No buffers were deleted: bd 1

I assume these are the sort of messages silent was intended to hide. I'm not sure how or if they can be suppressed while still showing the confirmation prompt. (I'm relatively new to vimscript.) Then again, this may be a small prices to pay for having the prompt again, especially considering that (C)ancel may be a rarely used option.

@PetrusZ PetrusZ closed this as completed Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants