Live data from Hacker News

How I boosted my Vim

nvie.com

61–69 of 69 posts

Re: How I boosted my Vim

#61
post #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_s…

    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

#62
post #52

Earlier quoted context omitted.

> Having all this functionality available in a single integrated package... s/available/trapped/ s/integrated/monolithic/ ;-) I think IDEs are useful, yet they always make me think what a bad example of code reuse they are. Code reuse? Are you kidding? Much better rewriting each plugin with each IDE ;-) EDIT: By "monolithic" I don't mean that IDEs are not modular; I mean you can't use their modules elsewhere.

You're not suggesting Emacs or Vim is somehow better, are you?

Emacs and Vim are as good as the tools they can build upon, just like Eclipse is as good as available plugins. If you are going to develop in Erlang or Common Lisp, chances are Emacs is the best free IDE around (I don't know about Vim). It isn't so if you are going to develop in Java.

There is a lot of wheel reinventing in the Emacs and Vim's camps too, however. I just wanted to say that no matter how much code reuse is valued by developers, the tools they use the most are made with the less reusable pieces of software around.

Re: How I boosted my Vim

#63
post #61
post #4

Earlier quoted context omitted.

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

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.

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

#64
post #49

Earlier quoted context omitted.

I agree that this is true, if you have no desire to learn how Emacs and your chosen modes work. If you are willing to dig in, the ability to fix your tools with a simple C-M-x is indispensable, and is a feature that no IDE has. What features do you think Emacs is missing?

Firstly, emacs is not a quick-start environment. If I want to get started in a new language, let's say Java, downloading Eclipse will make getting started with Java insanely easy. The same with C++ and Visual Studio. Compare with emacs, in which I have to spend time getting things to work. I'm not saying it's worse in the long run (although I suspect you can't beat Java on Eclipse), but the overhead every time I want…

Makefiles are an acceptable barrier to entry. I've lost a lot of hair trying to figure out how to build huge Java projects that the developers just built inside their five-major-versions-old IDE. ("Oh, just build it by clicking the 'export to WAR' button and then copy the file to each production server." No.)

Considering how trivial it is to write an ant file to do the same thing, it's appalling that the IDEs don't just do this by default. How can you write a good application if you don't even know how to compile it?

But the biggest problem with Emacs is the "project management" functionality. Pick up many modern editors, and you can, with one command, point to a directory and have a project tree, a "jump to file", etc, all built for you.

Emacs does this too: http://github.com/jrockway/eproject.

Of course, Emacs' version is a lot more flexible. The user can hook it, so he gets a fresh project REPL the first time he visits a new project. Or, he can hook the eproject-after-save hook, and commit the changes to a "backup" git branch, so that he never has to worry about not being able to undo.

The idea behind Emacs is that it can do things that nobody else has ever done before, and it continually lives up to this expectation.

(Also, "this is too hard for beginners". OK. Then how did I learn Emacs?)

Re: How I boosted my Vim

#65
post #49

Earlier quoted context omitted.

I agree that this is true, if you have no desire to learn how Emacs and your chosen modes work. If you are willing to dig in, the ability to fix your tools with a simple C-M-x is indispensable, and is a feature that no IDE has. What features do you think Emacs is missing?

Firstly, emacs is not a quick-start environment. If I want to get started in a new language, let's say Java, downloading Eclipse will make getting started with Java insanely easy. The same with C++ and Visual Studio. Compare with emacs, in which I have to spend time getting things to work. I'm not saying it's worse in the long run (although I suspect you can't beat Java on Eclipse), but the overhead every time I want…

It's not that Emacs or vi are lacking the features of an IDE, is that they were not designed to be one. If you want to make vim or Emacs an IDE you can, but it is not easy.

Re: How I boosted my Vim

#66
post #44
post #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…

I typically just remap the escape key to capslock at the OS level. Even though it can through you off like you said, I still find it more convenient than key walks to generate an escape.

Unfortunately I don't think you can do that on a Mac. Because it would be the most portable way (would work with the shell command line too).

Re: How I boosted my Vim

#67
post #20
post #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.

IMO, IDEs are better for almost everything, except for actual text editing. For that, vim and emacs are still the best (I prefer vim for plain text editing prowess, but emacs has a lot of other goodies which make it closer to an IDE, but still not as good). Obviously, these are only my personal opinions.

yep, back when i had a job coding under windows, i used to use gvim for text file editing, but visual studio for compiling, debugging and the really good search utilities.

Re: How I boosted my Vim

#68
post #18
post #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…

Why jk twice? I just use jk. Almost never appears in actual writing, and it makes vim much easier to use.

Dijkstra would disapprove (:

Re: How I boosted my Vim

#69
post #16

Earlier quoted context omitted.

You can type it... Just slowly My combination is just kj.

I have jj in my .vimrc.

vf is the easiest-to-type two-letter sequence i could find that doesn't appear in any english word. other languages' mileages may, of course, vary. (and if some chavfucker wants to object, well...)
Post reply on HN