Live data from Hacker News

Ten Years of Vim

matthias-endler.de

21–30 of 123 posts

Re: Ten Years of Vim

#21
One built-in feature (not enabled by default) that I absolutely love is persistent undo. Love it.

Basically, undo trees can be persisted across vim sessions. Have a read via ":help undo-persistence".

Re: Ten Years of Vim

#22
post #8
post #4

Regarding tabs: I bound F2 to previous tab, F3 to next tab and F4 to new tab. Besides highlighting the current line, I think this is my most important customisation.

Isn't `gt` and `gT` faster? You don't have to move your hands!

I like `gt` and `gT`, because they are available out of the box on remote servers too.

Re: Ten Years of Vim

#23
Tabs are great for organizing groups of related files. They are different from other editors that only let you have one file per tab.

With Vim you could split a tab with a frontend HTML and CSS file, and have a couple of backend files in another tab. Then `gt` or `gT` to switch between the groups.

If you use nerdtree, `t` opens a file in a new tab, so you don't need to type `:tabnew` often.

Re: Ten Years of Vim

#25

Surprised to see that he's gone back to an empty vimrc after years with high customization. To me customization is such a great part of vim that I can't imagine being without it. For instance, I have shortcuts to find and replace on visual selection. I also have at least 5 plugins in my vimrc that are absolutely necessary for my workflow. Pure vim is nice if you need to occasionally edit files, but if you use it as y…

I think it needs some customization for full-time use too. Example: you can toggle comments with things like `:norm i// ` and `:norm 03x`, but with nerdcommenter, you just type `gc` or `gcu`, which requires less attention.

Re: Ten Years of Vim

#26

One thing google can do that blows most peoples mind when I show them: Did you know vim supports time travel undo? Sometimes you do some things then undo and redo trying to get back to a certain point in time. In vim you can step forward and back through all this by doing "g-" or "g+" to travel backwards or forwards in time. Or you can say ":earlier 50s" to go back to where you were 50 seconds ago. Most editors treat…

All the JetBrains IDE's keep a history of your edits, I accidentally rm -rf'd the wrong dir and reverted my code back thanks to JetBrains. I can't imagine vim saving your old files that have yet to be checked in to SVN / git (breaking changes anyone?) that you've not yet opened on vim.

Funny you mention that though, a coworker opens files in vim and does changes and tests but keeps it open if he's going to try something else so he can always go back to those other changes (guessing he reverts the code, then opens yet another vim window). I work with a lot of VI(M) coders but they barely take full advantage of VI(M). I just use IDE's or Emacs / VS Code (w/ X Forwarding more recently) personally makes it easier to find the fancy features with a UI.

I'll share that time travel feature to my VIM coworkers maybe it'll save their tail sometime.

Re: Ten Years of Vim

#27

One thing google can do that blows most peoples mind when I show them: Did you know vim supports time travel undo? Sometimes you do some things then undo and redo trying to get back to a certain point in time. In vim you can step forward and back through all this by doing "g-" or "g+" to travel backwards or forwards in time. Or you can say ":earlier 50s" to go back to where you were 50 seconds ago. Most editors treat…

tell that to vs code!

Re: Ten Years of Vim

#28
> I don't use arrow keys to move around in text anymore but forced myself to use h, j, k, l. Many people say that this is faster. After trying this for a few years, I don't think that is true (at least for me). I now just stick to it out of habit.

Sounds like he's not a touch-typist.

And as a general note; learning and mastering vim can hardly be a pleasant activity for non touch-typists, or otherwise typing heroes.

Re: Ten Years of Vim

#29

All of the points in the "Some things I wish I could do better" section are the reason I use a regular memorization free-ish IDE. Out of the box the things I want to do are easy (multiple files, manipulating structure of blocks of text, searching and manipulating information across my project simultaneously) and the things that aren't are rare (Add a dollar sign at the beginning of the next 13 lines). I know how to u…

> Out of the box the things I want to do are easy

Easy what? Easy to learn or easy to do?

They are arguably easier to do in vim once you learn the proper method. Just not as easy to learn.

That a common trade-off shared by rather elaborate tools.

Re: Ten Years of Vim

#30
post #28

> I don't use arrow keys to move around in text anymore but forced myself to use h, j, k, l. Many people say that this is faster. After trying this for a few years, I don't think that is true (at least for me). I now just stick to it out of habit. Sounds like he's not a touch-typist. And as a general note; learning and mastering vim can hardly be a pleasant activity for non touch-typists, or otherwise typing heroes.

hjkl by themselves are probablly not a lot faster than arrow keys, after watching various people code in Vim on twitch, I notice quite a few use them like arrow keys to arrow to where they want. But it's how hjkl combo with other motions that makes getting around easy. Though I really like easymotion ( and derivitives ) for getting around to random places
Post reply on HN