News for hackers. Stuff that matters.
Re:How I boosted my Vim by there on Monday September 13, 2010 @04:21PM (#1688068)
Oh, and man… never ever let Vim write a backup file! They did that in the 70’s. Use modern ways for tracking your changes, for God’s sake.

set nobackup set noswapfile

backup files are one thing, but turning off swap files is a terrible idea. vim can crash, you can accidentally close the window, your ssh session can die, etc. if you exit vim cleanly then the swap files will be transparent, so i don't see the point in disabling them.

Re:How I boosted my Vim by jessor on Monday September 13, 2010 @04:37PM (#1688144)
or just do:

set backupdir=./.backup,.,/tmp

set directory=.,./.backup,/tmp

This way, if you want your backups to be neatly grouped, just create a directory called '.backup' in your working directory. Vim will stash backups there. The 'directory' option controls where swap files go. If your working directory is not writable, Vim will put the swap file in one of the specified places.

(http://vim.wikia.com/wiki/Remove_swap_and_backup_files_from_...)

Re:How I boosted my Vim by parfe on Tuesday September 14, 2010 @10:33AM (#1690673)

    set backupdir=~/.vim/backup//
    set directory=~/.vim/swp//
The double tailing slash will store files using full paths so if you edit two different models.py files you won't clobber your swap or backups.
Re:How I boosted my Vim by davidu on Tuesday September 14, 2010 @02:05PM (#1691571)
Oh man, this is awesome. Too bad it's vim-specific and not a shell built-in, which would be handy.
Re:How I boosted my Vim by Vitaly on Monday September 13, 2010 @10:40PM (#1689207)
the minute I've read it I went and set the noswapfile option. I don't care if vim crashes, I save all the time. if it crashes I will just repeat the last edit. The stale swapfiles etc has caused me more time wasted over the years then lost edits.

But, I soon realized that noswapfile has another problem which caused me to disable it after all: it will allow you to open same file in more then one vim editor instance. And this is really asking for troubles.

It is less of a problem with graphical vim as you can use "autoread" to sync changes between instances, but it is a disaster on console.

Re:How I boosted my Vim by prasanmishra on Tuesday September 14, 2010 @02:13AM (#1689679)
I too very much happy after getting these two option. By looking those swap file and backup file I started hating vim. Why on earth it is creating all the un-necessary stuffs (though they useful at some case). Now for newbie like me I love this tips :)
Re:How I boosted my Vim by hasenj on Monday September 13, 2010 @04:35PM (#1688128)
so far, swap files have caused me more headache than anything else. I'm a paranoid maniac and I save every minute or two, so worst case I'll repeat a minute worth of coding.

What really ends up happening is I try to edit a file and something annoying pops up telling me about something requiring my attention (swap file already exists .. read only mode .. bla bla). In other words, it's just a distraction, most of the time.

Re:How I boosted my Vim by gfodor on Monday September 13, 2010 @04:37PM (#1688147)
Until it saves your ass. Which will happen, if you use vim for a few years.

You can configure it to put your swap files in a canonical dir, instead of polluting the directory you're editing files in:

set backupdir=/var/tmp,/tmp

set directory=/var/tmp,/tmp

Now you can just nuke the swap files in one swoop:

rm -rf /var/tmp/*.swp

Re:How I boosted my Vim by jamesbritt on Monday September 13, 2010 @05:02PM (#1688292)
Or cron-job the pruning.
Re:How I boosted my Vim by bostonvaulter2 on Tuesday September 14, 2010 @04:59AM (#1689956)
Swap files can save you from editing the same file in two vim instanstances as once. Possibly overwriting each other.
Re:How I boosted my Vim by junkbit on Monday September 13, 2010 @08:56PM (#1688948)
Screen can help with the accidental closing of a window or a dropped ssh session. You can even restart X and just reattach to the daemon when you log back in.
Re:How I boosted my Vim by EdiX on Monday September 13, 2010 @04:56PM (#1688252)
> vim can crash

It can?

Re:How I boosted my Vim by IgorPartola on Monday September 13, 2010 @08:17PM (#1688851)
Never had vim crash, but I've had the OS crash. Or X server. Better safe than sorry.
Re:How I boosted my Vim by there on Monday September 13, 2010 @05:00PM (#1688280)
yes, i've had it crash once in a rare while.

Vim: Caught deadly signal SEGV