Live data from Hacker News

The problem with vim

haldean.org

21–30 of 90 posts

Re: The problem with vim

#21

Earlier quoted context omitted.

I think cf" is pretty standard. I think it is even a original vi command and not a vim extension. Change the text from the cursor position up to the first instance of the " char.

Thanks, my vim problem is I'm always missing out on faster commands :)

In that case, a couple of extensions of that which I use constantly:

cf" is change find "

But, since this is a grammar, there are other things than c we can use like d (delete find ") or y (yank find "). More than this we can swap out f. Instead of f, try i, which I think of as "inside".

So ci" deletes the text inside quotes and leaves you in insert mode. ci) deletes the text inside parentheses and leaves you in insert mode.

For example

    foobar[somekeyvar] = "wooyay"

    move to somekeyvar and ci] then type "anotherkey"

    foobar[anotherkey] = "wooyay"
I use this constantly while programming.

Re: The problem with vim

#22

I've always wondered how difficult it would be to extract the vim "engine" into a library that could easily be reused by other programs. I can only assume the answer is "very difficult". Another idea would be some kind of VimSpec that emulators could be run against to see how well they cover the whole range of vim actions. Again, probably not very feasible.

You would be correct, I have seriously looked into doing this type of thing and/or modifying the Vim codebase. My conclusion after a few hours is that the Vim codebase is a horrific unsalvageable mess of nested ifdef's. IMHO reimplementing a "vim engine" from scratch will be orders of magnitude easier.

Re: The problem with vim

#23
On the other hand VsVim for Visual Studio (https://github.com/jaredpar/VsVim/) is pretty good done and have many of the full Vim functionalities. I use it on daily basis and it feels almost as full Vim.

It lacks in support for plugins and many fancy settings but provides all the movements and register operations I use regularly in full Vim.

What is important it is fully open sourced and its maintainer makes pretty good job by implementing most of issues and accepting many pull requests. It is still updated and getting constantly better.

Many thanks to Jared Parsons for developing this plugin.

Re: The problem with vim

#24
I also feared I'd have a problem switching between vi(m) and other editors, but if you use both regularly, It's not a problem at all, at least for me. I'm heavily using Sublime Text for software development. Sublime has a "vintage" vi mode which I don't use, just to train my muscle memory on modeless editors.

It's the same with keyboard layouts. I've been using german keyboards all my life and just decided to switch to us layout a few years ago, because basically the keyboard layout had a huge influence on programming languages, stuff like []{}/ is way easier to type on us layout. I feared i will never be able to use a german keyboard again after switching layouts, but this is not the case. I can now use both layouts blind. The only problem are the () parentheses which are offset by one key on the german keyboard, i'll always press the wrong key for them.

Re: The problem with vim

#25

Though I'm a long-time vim user, I've never even used cf" nor do I know what it means. However, I find most vi emulators work very well with the standard movement, yanking and inserting commands, and some basic visual modes. I used ViEmu quite successfully a few years ago when I was doing C#, and I use vi mode on bash every day without many problems. If you keep it simple, you should be able to work across emulators…

If you do not know what cf" does, you've been using Vim like you would use a normal text editor. Which is fine. But you're missing out a lot.

Do yourself a favor and go figure out what's the difference between: cf" cF" ct" ci" ca"

Note: you can substitute c for any "verb" (d, y, ~, etc) and " for many delimeters.

  :help text-objects

Re: The problem with vim

#26

I also feared I'd have a problem switching between vi(m) and other editors, but if you use both regularly, It's not a problem at all, at least for me. I'm heavily using Sublime Text for software development. Sublime has a "vintage" vi mode which I don't use, just to train my muscle memory on modeless editors. It's the same with keyboard layouts. I've been using german keyboards all my life and just decided to switch…

Ditto. Also switching between US for coding and my local layout and I think it's definitely worth it due to the ease of typing the slashes and brackets when coding.

Re: The problem with vim

#28
I never considered using vim because the navigation is based on a query layout, which I don't use. It didn't seem worth the effort to try and re-bind the keys to make more sense.

With emacs, the key bindings sort of make sense (f-orward, b-ack) (n-ext p-revious) for the right-left-down-up. Not sure why v is for page down/up, but it seems to have stuck.

Re: The problem with vim

#29
post #28

I never considered using vim because the navigation is based on a query layout, which I don't use. It didn't seem worth the effort to try and re-bind the keys to make more sense. With emacs, the key bindings sort of make sense (f-orward, b-ack) (n-ext p-revious) for the right-left-down-up. Not sure why v is for page down/up, but it seems to have stuck.

    V : down arrow
    ^ : up arrow

Re: The problem with vim

#30
Emacs can have this issue too, often people wanna redesign keybindings, the community tries to explain that it's not worth it and won't catch.

Does readline defaults to emacs keybindings ? It surely benefits to Emacs, but the same can be said for Vim since he reuses a regexp syntax found in sed/grep, and even apply it on navigation

    `d$` : delete until EOL (aka $). 
    ^ for BOL ..
The composability of vim commands is a beautiful thing.

    cw
    cf"
    d/\.
Cute little finger DSL
Post reply on HN