Live data from Hacker News

Ten Years of Vim

matthias-endler.de

31–40 of 123 posts

Re: Ten Years of Vim

#31

Earlier quoted context omitted.

I have been noticing this effect as well, and I was thinking that there needs to be a change in how we design programming languages. The old programming languages are treating characters or words as atomic units, but human mind does not really work at words. We work at sentences or lines. Each line can have its own context and can host more flexible syntax. On one hand, the programming languages can be more expressiv…

Lisp?

Yes and no. In my experience vim is great for manipulating s-expressions because it has expressions like da( which means "delete everything between the parens wrapping the cursor".

But no, many lisp dialects have a tendency towards nesting expressions which will force them accross many lines which doesn't match up with ^^'s idea of keeping lines context free.

Re: Ten Years of Vim

#32

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".

Pairing this with undotree[1] is really handy, as it allows you to see your full edit history, branches and all, and jump back and forth.

[1] https://github.com/mbbill/undotree

Re: Ten Years of Vim

#33

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…

One of my favorite vim plugins is https://github.com/sjl/gundo.vim , which can open a pane showing the actual tree of versions, including at what time the version changed. j and k can move around in the tree, and the pane with the file will show what it was at a given time. I've definitely used it to pull out a version of a file as it existed an hour ago...

Re: Ten Years of Vim

#34
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!

`gt` will still be slow because you're using the same finger for both keys.

Re: Ten Years of Vim

#35

I know you said that you like maintaining a super minimal .vimrc, but fwiw there's a couple of plugins that really helped me with the workflow issues you mentioned struggling with: > Jumping around in longer texts: I know the basics, like searching (/), jumping to a matching bracket (%) or jumping to specific lines (for line 10, type 10G), but I still could use symbols more often for navigation. vim-sneak is real nic…

Vim buffers are great. For me the best thing is that you can go to any buffer by ":b some-unique-part-of-the-file-path". If I'm switching between a ruby file and its spec file (tests), usually I'll just have to type ":b spec" to get there. Usually I'll have 2 open windows and will just be jumping to specific buffers all the time.

I like this kind of workflow because I have poor vision and selecting from a list of files, or a list of buffers is a really painful operation for me. Instead, I'm just thinking "What do I want to work on?" and type in part of the file name/path. If I forget, I can look at the list of open buffers, but it almost never happens.

One other thing I make great use of is ctags and vimgrep (just remember to use noautocmd with vimgrep so that it doesn't take a million years to parse all the files). Once I've got my working set up buffers for a problem, then it's just bouncing around inside them.

Re: Ten Years of Vim

#36
post #3

It's highly overstated how hard it is to learn imo. I would learn it again without a doubt.

I ran 'vimtutor' twice and felt comfortable enough to switch. I think the only reason people think it's so difficult is they maybe try to go too deep too fast?

Re: Ten Years of Vim

#37
I use (Vim IMproved - not vi) vim all the time. I find it interesting to see what features other people tend to use in vim, there seems to be some minor differences in their workflows, but it's not clear who "wins" the productivity battle.

I only use a very small number of it's features:

* `:tabe` Create a new tab

* `:e .` Start browsing files in that tab

* `:w` Write the file

* `:q` Quit the file (`:q!`, seriously, please do quit the file)

* CTRIL+SHIFT+UP/DOWN To switch tab (doesn't reliably work on every machine)

* `/WORD` To search for something

* `:NUM` To go to a specific line

* `i` To insert

* SHIFT+V to select lines

* `d` To delete lines

* `x` To extract lines

* `y` To "yank" (copy) lines

* `p` To paste lines

>Here are a few things I wish I could do better:

I don't have a great memory, so memorizing more than what I use every day is a little too much. One thing that I'm working on remembering is the ability to replace strings (although I don't really like regex).

>Would I learn Vim again?

I'm yet to experience anything compelling enough to stray me away. The advanced features are there if I ever need them, but for the most part I am free to have a lightweight editor.

Re: Ten Years of Vim

#38
OP should consider using buffers: you can :ls to display the list of buffers (which I have mapped to gl) and then :bn (where n is a buffer number) to go to some specific buffer. Also, in the same fashion of gt and gT for tabs, I mapped gb to go to the next buffer, gB to the previous one, and g space to go to the last one. IIRC all these key bindings are unused by default. In my opinion tabs are more useful/interesting when you work with multiple windows layouts.

https://github.com/pera/vim/blob/master/.vimrc

Re: Ten Years of Vim

#39
post #37

I use (Vim IMproved - not vi) vim all the time. I find it interesting to see what features other people tend to use in vim, there seems to be some minor differences in their workflows, but it's not clear who "wins" the productivity battle. I only use a very small number of it's features: * `:tabe` Create a new tab * `:e .` Start browsing files in that tab * `:w` Write the file * `:q` Quit the file (`:q!`, seriously,…

>Vim IMproved

Oh, so you are using an improved version of Vi IMproved? ;)

Re: Ten Years of Vim

#40

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…

My experience has also been with a decaying amount of customization. As I get better with Vim I learn more and more how to do things in a "Vim-native" manner which I had previously needed plugins for. For example, when I first started using Vim, I relied heavily on NERDTree. These days, netrw works perfectly fine for me.
Post reply on HN