Live data from Hacker News

How I boosted my Vim

nvie.com

1–10 of 69 posts

Re: How I boosted my Vim

#2
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

#3
post #2

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…

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

#4
post #2

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…

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

#5
post #3
post #2

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…

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 t…

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

#6
I have a similarly hacked up Emacs environment and it's actually gotten to the point that I'm taking a hard look at IDEs again. Having all this functionality available in a single integrated package with a visual debugger thrown in is starting to look strangely appealing.

Re: How I boosted my Vim

#7
post #2

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…

> vim can crash

It can?

Re: How I boosted my Vim

#8
post #7
post #2

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…

> vim can crash It can?

yes, i've had it crash once in a rare while.

Vim: Caught deadly signal SEGV

Re: How I boosted my Vim

#9
post #5
post #3

Earlier quoted context omitted.

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 t…

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

Or cron-job the pruning.

Re: How I boosted my Vim

#10
This is actually a really good guide. I use vim daily at work, and my .vimrc shares most of these settings.

One big productivity boost for me was remapping the Escape key to something a little more convenient. I just remapped the ESC key altogether, but this can throw you off if you find yourself working at lots of different computers. If you prefer something less permanent, you can map a key sequence to ESC. I like this one, which maps 'sdf' to ESC if you're in insert mode:

  imap sdf 
jkjk is also a sequence I've seen used.
Post reply on HN