LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Change in Vim persistent undo behavior? (https://www.linuxquestions.org/questions/slackware-14/change-in-vim-persistent-undo-behavior-4175515075/)

astrogeek 08-16-2014 05:30 PM

Change in Vim persistent undo behavior?
 
I just installed a new-used machine with 64 bit Slackware from -current and noted a difference in the behavior of Vim - it litters my filesystem with .filename.un~ files!

These are persistent undo files, a feature that was introduced with Vim 7.3.

I have several machines installed from -current earlier this year that do not act this way (Vim-7.4.050), but the -current Vim-7.4.258 does create the files by default. (I often install from -current but do not follow it closely).

vim --version shows that both were built with +persistent_undo, and it is supposed to be disabled by default, but I do not see where it is enabled in either the global or local vimrc, so I do not know why it is suddenly turned on??!! :scratch:

Just wondering if anyone else noticed, or maybe it was a feature change and I missed the memo?

Easy enough to kill it...

Code:

In ~/.vimrc OR /usr/share/vim/vimrc

set noundofile


astrogeek 08-16-2014 06:10 PM

There is indeed a change to the global vimrc (must have crossed my fingers or eyes the first time):

Code:

# sdiff -s vimrc-258 vimrc-050
" Last change:  2014 Feb 05                                  | " Last change:  2011 Apr 15
  set backup            " keep a backup file (restore to prev |  set backup            " keep a backup file
  set undofile          " keep an undo file (undo changes aft <

So this comes from upstream.

I am surprised no one else has noticed it, surely I am not the last, lonely vim user?

jstg 08-16-2014 06:47 PM

I've always put
Code:

set undodir=$HOME/.vim/undo
in my ~/.vimrc so I never noticed the change.

keefaz 08-16-2014 07:06 PM

I confirm that vim v. 7.4.50 doesn't enable undofile by default...
Thanks for letting us know ;)

astrogeek 08-16-2014 07:45 PM

Quote:

Originally Posted by jstg (Post 5222208)
I've always put
Code:

set undodir=$HOME/.vim/undo
in my ~/.vimrc so I never noticed the change.

I guess I have been on the other end of that equation, I do not use it and have always relied on it being disabled by default, so the change hit me in the head!

Actually, because they are hidden files I had not noticed them on the new machine. But I used it to organize and re-master some of my older installation notes then tarred them up and sent them to another machine where I did notice them. The other machine had 7.4.050 on it so it really confused me at first because I knew I had the same ~/.vimrc and could not reproduce them!

Quote:

Originally Posted by keefaz (Post 5222219)
I confirm that vim v. 7.4.50 doesn't enable undofile by default...
Thanks for letting us know ;)

Thanks for the confirmation.

It is a small but important change - one more config to tweak on new installs!

GazL 08-17-2014 05:43 AM

Quote:

Originally Posted by astrogeek (Post 5222230)
It is a small but important change - one more config to tweak on new installs!

Up until recently, I've pretty much been an elvis guy, but "Thank you very much, huh-huh-huh" ;) for the warning. I'll likely be using vim in future as I'm planning on moving to utf-8.

I'll have to add a .vimrc to my post-install /etc/skel customisations to go with the .Xresources, .bashrc, and other essentials I stick in there.

saxa 08-17-2014 12:07 PM

I usually put in .vimrc file the line:

set nobackup

audriusk 08-17-2014 01:51 PM

Quote:

Originally Posted by saxa (Post 5222500)
I usually put in .vimrc file the line:

set nobackup

'backup' is for making backup before overwriting a file. It is not related to 'undofile' which saves undo history for a file, so you can quit Vim, open the file you were editing again and undo the recent changes as if Vim was never closed. See undo-persistence.

astrogeek 08-17-2014 02:24 PM

Quote:

Originally Posted by GazL (Post 5222388)
Up until recently, I've pretty much been an elvis guy, but "Thank you very much, huh-huh-huh" ;) for the warning. I'll likely be using vim in future as I'm planning on moving to utf-8.

I'll have to add a .vimrc to my post-install /etc/skel customisations to go with the .Xresources, .bashrc, and other essentials I stick in there.

I am a Vim/UTF-8 kind of guy, I think you'll like it (but no sequined suits please!).

I already include a fairly extensive .vimrc in my /etc/skel, plus a custom colors.vim so just added the set noundofile line to the vim configs.

In fact, I maintain a centrally managed collection of post-install notes, configs and scripts that I deploy as my second action for all new installs (the first action is ln -s /usr/bin/vim /usr/bin/vi). My collection has grown extensively from some original notes with Mandrake 7.2 but I have never specifically updated it for 64 bit Slackware and had decided to do so with this machine. In the process I updated and cleaned up many things, and extensively changed my base font setup.

It was only after I had archived those changes and sent them back to the master repo that I noticed all the undo files. When I figured out what had happened I found them pretty much everywhere on the new machine. Not a feature I can appreciate!

So in the end I guess my update exercise was a success, including identifying this new addition to my list...

You are the first to mention /etc/skel for a long time. I rarely see mention of it and my impression is that most people only ever use defaults for .Xresources, ~/.*rc files, etc.. It would be interesting to know and maybe share some of the specific adaptations out there in the wild. Would the new SlackDocs wiki be an appropriate place for something like that I wonder?

saxa 08-17-2014 06:06 PM

@audriusk, ups I misunderstood the initial question.

GazL 08-18-2014 04:52 AM

Quote:

Originally Posted by astrogeek (Post 5222544)
You are the first to mention /etc/skel for a long time. I rarely see mention of it and my impression is that most people only ever use defaults for .Xresources, ~/.*rc files, etc.. It would be interesting to know and maybe share some of the specific adaptations out there in the wild. Would the new SlackDocs wiki be an appropriate place for something like that I wonder?

I suspect most people only ever create the one user for their systems, so /etc/skel really doesn't buy them anything over popping the dotfiles into their $HOME directly. And yes, you're probably right that most users will just stick with defaults unless some issue forces them to make a change.

While I'm sure we could all pick up a few tips here and there from each others dotfiles, I'm not sure slackdocs is the place for that sort of stuff: much of what goes into them is down to personal preference and there's no "right answer". IMO it would just clutter the wiki up. I think sharing this sort of stuff with people is something that is probably best left to personal blog posts.


All times are GMT -5. The time now is 09:48 PM.