fmoralesc / vim-pad

a quick notetaking plugin
MIT License
319 stars 22 forks source link

g:pad_open_in_split doesn't open if file not saved #52

Closed bdillahu closed 10 years ago

bdillahu commented 10 years ago

Seems if you have g:pad_open_in_split set to open in the main window, and the file already in the main window isn't saved, it just ignores the open action and leaves you there.

I see this is safe (obviously don't want to lose edits), but any options here? Maybe a "do you want to save" question, or open in another buffer or something?

Not sure what I suggest, but wanted to mention it.

fmoralesc commented 10 years ago

I understand. Will see what I can do.

fmoralesc commented 10 years ago

Implemented a schemd for handling this case. Basically, if g:pad#open_in_split is 0, the plugin will ask the user if he wants to save. If he replies that he does, autowriteall will be temporarily used to save the buffer changes on opening the note. If he replies that he doesn't, the note is opened in a split, with a warning.

bdillahu commented 10 years ago

Seems to work, with one quirk...the "do you want to save" status line doesn't clear off the screen. I can redraw the screen (CTRL-L) and it goes away.

This might be my environment, don't know, but thought I would mention it.

Thanks for the fix!

fmoralesc commented 10 years ago

I think I fixed that just now. Can you confirm?

bdillahu commented 10 years ago

Yep, that seems to have it correct.

Thanks!