Hacker News new | ask | show | jobs
by Lio 2049 days ago
I guess I’ve got used to working with both sets of shortcuts but I miss the Vim undo system in other apps.

It’s worth noting that u and ctrl-r don’t operate on an undo stack but on an undo tree.

So if you have a series of edits and undo them all then do something else you can still get back to where you were before.

Use g+ and g- to walk the tree and the Gundo plugin is gives you a nice visual diff interface.

So having a separate shortcut and “stack” is actually a great feature of Vim IMHO.

2 comments

Wow I didn't know about the undo tree! That would have definitely helped in a few scenarios
This is really cool, and I had no idea about Vim using a tree instead of a stack for undos. I'll check out Gundo.

Do you have any other similar recs that would help for learning?

Drew Neil’s vimcasts.org is a mine of useful tips.

His book Practical Vim[1] is particularly good because it teaches you the “vim way” without plugins.

Not that there’s anything wrong with plugins, I use a load of them, but there’s loads you can do without them.

1. https://pragprog.com/titles/dnvim2/practical-vim-second-edit...

vim generally doesn't need any of those fuzzy file finders that most people use. If you add

  set path+=**
to your vimrc, and open vim from the top level directory for your project :find <unique_filename_part> will just work

Setting up ctags will give vim some IntelliSense-like functionality that people tend to miss from their IDEs. More info here: https://andrewra.dev/2011/06/08/vim-and-ctags/

> vim generally doesn't need any of those fuzzy file finders that most people use. If you add > > set path+=

Be wary of this, it can end up being quite slow. Here is an excellent write up detailing the usage of the path setting.

https://gist.github.com/romainl/7e2b425a1706cd85f04a0bd8b389...