Live data from Hacker News

Vim clutch

github.com

141–150 of 227 posts

Re: Vim clutch

#141
post #65

I don't know how this would work out ergonomically. My dad is a cab driver and he often complains that pressing the clutch with his foot often giving him RSI kind of pain. But however I think this is purely subjective. From an experiment perspective, this is really cool! And this generally qualifies into what could one call a 'real hack'. This has a air of freshness to it. Now the real power of vim is in getting into…

You have to learn h,j,k,l are not just navigational keys but also can be combined with multipliers like 20h(Moves 20 positions to the left). You know, I've understood this for a while, but to this day I still don't use it. I can't count characters that fast! If you're going to lean forward and count out chars, you might as well count them out with presses of 'h'.

For what it's worth, I remapped vim's navigation keys from the awkward hjkl to the normal inverted-T arrangement i,j,k,l. Then I remapped the inserts, i & I, to h & H.

With that, my natural finger movement on the arrowkeys and on the vim home row match each other.

The reason vim's navigation keys (hjkl) today are arranged the way they are, left-means-down and right-means-up instead of up-means-up and down-means-down, is among the dumbest reasons there can be. Decades ago, the keyboard Bill Joy happened to be using when he wrote vi just happened to have arrows printed on the keycaps of the hjkl keys. He was trying to think of ways to make memorizing lots of commands easier, so he decided to take advantage of what was printed on those keycaps. There were no arrowkeys on that keyboard. That, in itself, was not a dumb choice, because it would have been a useful mnemonic on his own keyboard and he'd probably never seen an inverted-T set of arrowkeys, which didn't become popular until years later.

The dumb part is the insistence on maintaining this onion in the varnish as sacrosanct decades after that silly keyboard disappeared and in an era where every new vim user is accustomed to using the inverted-T arrowkeys found on virtually every keyboard. Anyone who, for some reason, hasn't ever used his arrowkeys picks it up immediately: up-down-left-right mean up-down-left-right. Got it.

That's why so many people who want to use vim have to be "broken" of the habit of using the arrowkeys and forced to learn an additional, weird arrowkey arrangement, because ("trust us") using the home keys is better.

Well, using the home keys is better, but not because of the awkward arrangement. That part is worse. It's better because that's where your fingers rest normally on the keyboard, from where you can operate the full set of vi commands and enjoy its full power.

You can have both. It wouldn't take much convincing to wean people off the arrowkeys if both sets of "arrow keys" on their keyboard had the same natural arrangement they've been used to for years.

I was worried when I abandoned the onion that it would handicap me on plain-vanilla installations of vi/vim until I realized that, these days, yes, there are two sets of arrowkeys on every keyboard, and I can use the real arrowkeys if I have to work on a version of vi/vim without my .vimrc, because they're arranged just like my ijkl. I can live with using the real arrowkeys for a while, and if I'm staying longer, I'll "curl -O mydomain.com/myvimrc" and restart vim with my full customizations and go back to the home row. (I also have my zsh in vi mode, and my .zshrc remaps keys the same way and can also be fetched using curl.)

I fully understand that changing this fundamental arrangement is NOT attractive to experienced vim users, because muscle memory has long since automatized the arrangement. The old fogey's vociferously defend the old onions for various, mostly self-serving, reasons.

(They tell me, for example, that this will make it impossible to use a vim on a different machine on the same page where they brag about their extensive and brilliant .vimrc customizations that they "couldn't live without." Hmm.)

But I'm starting to teach my kids to use terminals, command lines, and editors, and I didn't want to pass this onion on to their generation. I remapped the keys and retaught myself to make it easier for them. Now we can share the same .vimrc and .zshrc. They'll have one, consistent set of muscle habits for arrowkey motion from the start, whether playing games, editing text, or on the zsh command line.

Re: Vim clutch

#142
post #128

I'll be the one voicing a contrarian opinion here. vi and vim are holdbacks from the days of 300 to 9600 BAUD modems. A time when more sophisticated interfaces were prohibitive. Back in those days it wasn't too uncommon for people to actually write their own text editors. I wrote a few, mainly in Forth, as I would bring-up self-designed systems. While I use VIM today when I have to I continue to think that in today's…

> The damn text box I am using in this browser to enter this comment is far more user-friendly than VIM. Either you're a terrible Vim user or you have a pretty awesome browser text box. I had to install a third party browser extension just to make the damn thing resizeable - woe is me if I want to do search/replace, indent anything, or do anything but the most trivial undo/redo operation. And who hasn't permanently l…

Bad comparison on my part at some level.

Yes, I am a terrible VIM user. I have far more important things to do than to get good at using modem-age text editors. My efficiency comes from planning, not counting keystrokes.

Re: Vim clutch

#143

Earlier quoted context omitted.

You have to learn h,j,k,l are not just navigational keys but also can be combined with multipliers like 20h(Moves 20 positions to the left). You know, I've understood this for a while, but to this day I still don't use it. I can't count characters that fast! If you're going to lean forward and count out chars, you might as well count them out with presses of 'h'.

Note: this post assumes Vim, not other implementations of VI If you type fast, you don't want to have to spend time correcting for line estimations that are slightly off as a result of thinks like 20h. For navigation, just use forward slash to search and you'll land right where you want. It's also almost always faster to use f/F/t/T in conjunction with semicolon or comma for jumping to specific letters than using h o…

In emacs, we do the same with C-s (search-forward) and C-r (search-backward). It is highly recommended to "jump" to the exact text you want, rather than fiddling around guessing and correcting numerical character and line jumps. Just a bit of support from the dark side!

Re: Vim clutch

#144
post #65

I don't know how this would work out ergonomically. My dad is a cab driver and he often complains that pressing the clutch with his foot often giving him RSI kind of pain. But however I think this is purely subjective. From an experiment perspective, this is really cool! And this generally qualifies into what could one call a 'real hack'. This has a air of freshness to it. Now the real power of vim is in getting into…

Regarding emacs pinky, many people find remapping CAPSLOCK to CONTROL helps quite a bit. Here is one popular xmodmapping:

  remove lock = Caps_Lock
  remove Control = Control_L
  keysym Caps_Lock = Control_L
  add lock = Caps_Lock
  add Control = Control_L

Re: Vim clutch

#145

I'll be the one voicing a contrarian opinion here. vi and vim are holdbacks from the days of 300 to 9600 BAUD modems. A time when more sophisticated interfaces were prohibitive. Back in those days it wasn't too uncommon for people to actually write their own text editors. I wrote a few, mainly in Forth, as I would bring-up self-designed systems. While I use VIM today when I have to I continue to think that in today's…

Vim when you're learning feels like this. Vim when you're using it with 3-5 buffers, some specialized, on screen with lots of plugins feels just like an ide or something like Sublime Text 2 Vim keybindings in Sublime Text 2 or Visual studio/outlook/word via ViEmu is pretty good in my experience.

Sublime Text looks interesting. I am going to check it out. Thanks.

Re: Vim clutch

#146
post #126

Earlier quoted context omitted.

Start here: http://www.vim.org/docs.php

That doesn't really answer the question, does it? The other poster made an assertion about VIM being more efficient. I would like to get a list from him (or her).

> I would like to get a list from him (or her).

Why is an answer from sofal not acceptable?

Re: Vim clutch

#147
post #128

Earlier quoted context omitted.

> The damn text box I am using in this browser to enter this comment is far more user-friendly than VIM. Either you're a terrible Vim user or you have a pretty awesome browser text box. I had to install a third party browser extension just to make the damn thing resizeable - woe is me if I want to do search/replace, indent anything, or do anything but the most trivial undo/redo operation. And who hasn't permanently l…

Bad comparison on my part at some level. Yes, I am a terrible VIM user. I have far more important things to do than to get good at using modem-age text editors. My efficiency comes from planning, not counting keystrokes.

> My efficiency comes from planning, not counting keystrokes.

As if the two are mutually exclusive...

Re: Vim clutch

#148

Earlier quoted context omitted.

Vim when you're learning feels like this. Vim when you're using it with 3-5 buffers, some specialized, on screen with lots of plugins feels just like an ide or something like Sublime Text 2 Vim keybindings in Sublime Text 2 or Visual studio/outlook/word via ViEmu is pretty good in my experience.

Sublime Text looks interesting. I am going to check it out. Thanks.

I haven't been using it very long, but the vibrant plugin community (make sure you get BOTH vim plugins) and intelligent shortcuts make it feel like a winner.

Re: Vim clutch

#149
post #124

Earlier quoted context omitted.

With no justification of how you think a military helicopter cockpit is user friendly, I suspect you're just trolling now.

Your first personal attack was subtle: "I understand that you like to click through your menus" Now you resort to calling me a troll? That's nice. There's nothing unfriendly about a helicopter cockpit. Even if you've only played with flight simulators anyone half-way intelligent can probably figure out most of it within a few minutes. Flying one is a different deal, as mastering and understanding the complex relation…

As a follow-up to that. When I hire programmers I only care about how well they can reduce a problem to a viable game-plan and how clean and well-documented their code might be. I could not give a crap about whether or not they are 3% more efficient at pounding out keystrokes on a text editor. We waste far more time in other areas than in the mechanics of editing code. In other words, if editor efficiency is adequate and the programmer is really good at hitting the nail on the head, the editor is not a problem. As an optimization problem, the text editor is the wrong place to focus one's attention. It is far more important to create product that is well-written, well-documented (I hate code without comments), easy to maintain and extend.

If you are doing embedded work that involves systems that could cause harm to people or property it is far more important that a programmer understand how to write safe code and take the time to make sure it is safe than to optimize editing speed.

Nothing I have seen in my career justifies contorting ones' brain to learn the commands of a modem-era text editor. It's an utter waste of time when compared to optimizing what really matters.

Re: Vim clutch

#150
post #65

I don't know how this would work out ergonomically. My dad is a cab driver and he often complains that pressing the clutch with his foot often giving him RSI kind of pain. But however I think this is purely subjective. From an experiment perspective, this is really cool! And this generally qualifies into what could one call a 'real hack'. This has a air of freshness to it. Now the real power of vim is in getting into…

You can start thinking in vim by reading this answer on stack overflow: http://stackoverflow.com/a/1220118 Moving word wise,(w,e) is used a lot. Next occurrence of word under cursor is useful. *,# Learning effective macros is extremely useful. di" is one of my favorite commands. Delete everything inside the quotes not including the quotes. Put inoremap jj into your .vimrc so that you can press jj quickly in insert mo…

addendum to the above advice from me:

How could I forget the substitution command? s/old/new/g (g == all occurrences on the line.) range can be a lot of different options. The most useful options in my experience would be:

%(all lines in the file),

select something in visual mode and press :,

-x, +y for + and - x and y lines from where you are.

exact range is not that useful in my daily use.

The other thing to note about the s command is that you can use other delimiters instead of / I like to use #

% s#/some/path/to/a/file#/another/path/#g works just fine and is much more readable than % s/\/some\/path\/to\/a\/file/\/another\/path\//g

Post reply on HN