Open ljohnston opened 4 years ago
@ljohnston Are you receiving an error by chance? I'm not sure if this is related to your issue, but I'm also recently seeing odd save behavior. I'm getting the error below, which is triggered here and I think may related to these lines. I can look at it more closely later.
Error detected while processing function <SNR>145_close_window:
line 3:
E13: File exists (add ! to override)
Hey @emilford - Nope, no errors. :messages
after closing the scratch window shows nothing. I've also run with vim -V9vimlog -u ~/.minimal_vimrc
and have attached the vimlog... no errors.
I did in some of my earlier testing see that same error you show above. Not exactly sure what the state of things was when I saw it though.
Thanks, Lance
I have the same issue using ~/.scratch.vim
, if I put any content in that file (outside of vim) it shows up in the scratch, but I am not able to add new content
@emilford I was able to resolve the strange saving behavior by changing :w
to :w!
, this seems to be an easy fix unless this will cause other problems?
It seems to me that saving doesn't occur if autosave is disabled. Saving happens in s:close_window
1, which is only called via autoload when autosave is enabled 2. It seems that the proper thing to do is to break out s:close_window
into two separate functions that 1) saves and 2) closes if necessary, and have the autoload hooks in the appropriate places.
I have a fix here, if anyone wants to try. The fix isn't perfect; there's redundancy in saving files if the autoexit command is used. I'm not good with vimscript, so if anyone would like to refactor this, that would be greatly appreciated!
https://github.com/addcninblue/scratch.vim/commit/1406039d785878cbe7ceea9f0690eaf43d65c6f7
Hi,
I clearly must be doing something wrong, or I don't understand how persistence is supposed to work.
Given this vimrc:
I can't get anything to show up in
~/scratch_test
.$ vim -u ~/.minimal_vimrc
Open scratch buffer with 'gs' Enter text / esc / c-w o / :q
~/scratch_test
remains empty.I've confirmed
g:scratch_persistence_file
is getting correctly set toscratch_test
in my home directory (as an absolute path).What am I doing wrong?
Thanks, Lance