News for hackers. Stuff that matters.
Re:Why was '~' chosen to represent the home directory? by SiVal on Monday January 21, 2013 @07:01AM (#5091072)
Every keyboard now has a set of hardware arrowkeys sensibly arranged in an inverted-T, where up means up, left means left, etc. Since everyone is used to that arrangement without any mental effort, macho vim types tell you to force yourself to write with your feet basically to show how hardcore you are. They tell you to use your customization ability in .vimrc to block the sensible arrangement in order to force yourself to learn a ridiculous one that has no advantage other than being the one that we old-timers had to learn before there were sensible arrowkeys.

I used that arrangement back in the 1980s myself, but when keyboards evolved, so did I. I remapped the movement keys to match the other movement keys (arrowkeys).

If you're going to go to the effort of customizing your vim to force yourself to learn a new keyboard arrangement, customize it so that the movement keys are ijkl instead of hjkl, so that both of your sets of arrowkeys are in the same, natural, modern, inverted-T arrangement. Then you don't have to deactivate those real arrowkeys, because there won't be any temptation to use them with the ijkl keys in the same arrangement and easier to reach.

"Oh, no!" people half my age will shriek. "Then what happens to the 'i' key? This would be impossible." Just use the now-unused key on the left ('h') for your insert-on-left. Reach left to insert on left. There, easy.

Funny how those who insist that YOU should relearn something as fundamental as the entire inverted-T arrowkey structure built into the hardware of every keyboard and used by almost all apps on all platforms including kids' game boxes find relearning a single, arbitrary 'i' key such an insurmountable obstacle to themselves.

But what if you have to use a copy of vim on a machine without your customized .vimrc? Sorry, but that's just an argument against ANY useful customization of vim. It's just not a problem, because the real arrowkeys on the keyboard are in the arrangement you're used to using on the ijkl keys. Just use the real arrowkeys temporarily or copy over your .vimrc. I've done it for years.

But what about other editors that have a vi mode? What about something like zsh with a vi mode? These things can be remapped to match your .vimrc unless they only offer a couple of keys, in which case they can be treated just like all apps with their own couple of local keyboard shortcuts.

Really, if the standard advice is, "You'll have one or two frustrating days, but after that your muscle memory will take care of remembering "hjkl" for you," then you can take your own advice and keep the inverted-T muscle memory you already have for the movement keys and reduce your task to learning a single 'h' key for insertion, and save the next generation from this nonsense.

If a 30-yr user of vi like me isn't stuck with the historical accidents of the past, why should new users have to be?

Re:Why was '~' chosen to represent the home directory? by anonymouz on Monday January 21, 2013 @07:52AM (#5091234)
What a rant! Unfortunately, it is entirely misguided. Nobody wants to force anyone to use the 'hjkl' arrangement, I was merely sharing a tip on how to get used to it if someone already wants to switch from arrow keys to 'hjkl' (like I did at some point in time).

The reason for doing this is, for me, simply that it is on the home row, and therefore I can reach it quicker. If you like 'ijkl', fine, do that. I feel more comfortably with 'hjkl'.

Or rather, what I am actually using is 'dhtn', being a Dvorak user. And my delete is on 'e'. Because that is how I like it.

Use whatever you like, but in any case switching from one variant to another (for whatever reason) will take a few days of retraining the muscle memory.

Re:Why was '~' chosen to represent the home directory? by SiVal on Monday January 21, 2013 @03:54PM (#5093716)
[Your rant is entirely misguided.] Nobody wants to force anyone to use the 'hjkl' arrangement

No, instead, they advise all new users that they should force themselves. Why are new vim users so often advised to deactivate their arrowkeys? Apparently the arrowkeys tempt them to take their hands off the normal keys. Why are they so tempted to do something so awkward? Because to new vim users with a lifetime of experience with inverted-T arrangements, the weird, archaic hjkl arrangement is even more awkward. "Well," they're told, "the solution is to make your arrowkeys YET MORE awkward by deactivating them entirely."

What I'm saying is that the significant vim benefits that come from staying on the normal keys can be obtained with a carrot instead of a stick. Instead of making their arrowkeys even more difficult than the awkward hjkl keys, make their normal keys even more tempting.

Re:Why was '~' chosen to represent the home directory? by anonymouz on Monday January 21, 2013 @04:17PM (#5093807)
I think they are simply advised to learn the 'hjkl' navigation because many of those already using have made good experiences with it. That's the nature of advice: Allow someone else to profit from your experience. But it's just that, advice, you're free to ignore it. I honestly don't see what's the big deal about it or why this in particular seems to irk you so much.

When I started out using Vim someone teaching me the basics pointed out the 'hjkl' navigation and recommended that I learn it, because I will be faster with it. Having to learn a lot of other commands, I kind of ignored the advice since it was simply a reflex for me to reach for the arrow keys. I happily used the arrow keys for years; nobody complained about it. At some point I finally decided to give the 'hjkl' navigation a serious try, and for that reason deactivated the arrow keys to help me break my old habit and take up the new one.

I would have found taking up 'ijkl' equally awkward, since either case I would have to retrain my muscle memory. Honestly, 'ijkl' and 'hjkl' doesn't seem to make much of a difference to me. Either one has to be trained a bit, and then it's automatic.

The one advantage of 'ijkl' that I see is that it forms a basis for the quaternions :-).

Re:Why was '~' chosen to represent the home directory? by SiVal on Tuesday January 22, 2013 @01:03AM (#5095795)
Well, I guess we can both agree that in the end, as usual, it all comes down to quaternions. ;-)
Re:Why was '~' chosen to represent the home directory? by chimeracoder on Monday January 21, 2013 @05:03PM (#5094001)
> No, instead, they advise all new users that they should force themselves.

Because it may make you slightly slower for a week, but it makes you faster for the rest of your life.

Depending on how much time you think you'll spend in Vim for the rest of your life, that tradeoff may be very smart indeed.

Doing what seems easiest or most "natural" at first may not always be the best user interface in the long run.

Re:Why was '~' chosen to represent the home directory? by ShirtlessRod on Monday January 21, 2013 @10:41PM (#5095375)
So why not make ijkl the new standard? It has all the benefits of the "traditional" arrow key layout without losing the speed of staying on the home row.
Re:Why was '~' chosen to represent the home directory? by jlgreco on Tuesday January 22, 2013 @02:51AM (#5096075)
If it ain't broke, don't fix it?

The only people that would benefit are people who have not yet learned hjkl, and those people have no influence. What are you expecting to be done, Vim wildly breaks standards, pisses off existing users, and changes the default key layout? Never going to happen, never should happen. First off, because it will piss off existing users for no reason whatsoever, and secondly because nobody in a position to make that call would make that call. Thankfully.

Distribute Vim yourself with these changes; see how far you get.

Re:Why was '~' chosen to represent the home directory? by zzleeper on Monday January 21, 2013 @09:48AM (#5091675)
Bravo! From the other comments, I guess you are going against the 'common sense' of vim users, but actually hjml has been the reason I never bothered with vim. Having to replace years (or decades) of T-arrowkeys (in windows, and in every FPS) seems utterly insane to me (and probably to most people that grew up with them)
Re:Why was '~' chosen to represent the home directory? by cgag on Monday January 21, 2013 @11:39AM (#5092184)
How can you be so attached to taking your hand off the home row to move around? Or to that arrow shape?

This comment thread is kind of blowing my mind, how can so many people have an issue with this? It's such a tiny simple thing to put into muscle memory. Are you guys all hunt and peck typers?

I feel a little bad for being insulting, but it really is hard to imagine so much resistance to memorizing j=down, k=up.

The hjkl pattern is the same pattern as the arrows at the top of dance dance revolution and people seem to pick that up pretty quickly.

Re:Why was '~' chosen to represent the home directory? by martinced on Monday January 21, 2013 @01:53PM (#5092991)
Touch-typist here: I don't hunt and peck and I can tell you that from a pure probabilistic standpoint if you're entering a typing contest with me you'll probably look like the one hunt and pecking ; )

It's not that it's hard to memorize: Emacs' 'p' for up and 'n' aren't hard to memorize. They're just utterly dumb. Just like 'jk'.

You're not sounding insulting: you're sounding like someone who has never put any thought into that issue arguing vs someone who did.

I'm an Emacs user and yet it's 'ijkl' for me (it's Emacs heresy of course).

Now I don't doubt that dance dance revolution players are representative of professional programmers... But lots of gamers (eg professional first-person shooter players) do use the inverted T arrow principle to quickly move up/down/right/left -- typically WASD and sometimes ESDF.

It simply makes more sense to "train your muscle memory" to something that also logically makes a lot of sense. You know, like... Up to go up. Down to go down. Left to go left. Right to go right.

Re:Why was '~' chosen to represent the home directory? by anonymouz on Monday January 21, 2013 @10:35AM (#5091885)
You don't have to. The arrows work just fine. You can use 'hjkl' (or whatever pleases you), and many people choose to, for the main reason that having navigation keys in the home row is really nice.

Having navigation on 'hjkl' for me was never about a lack of arrow keys, and has always been about convenience. The reason it's specific to Vi/m is that you need a modal editor to be able to pull it off.

Re:Why was '~' chosen to represent the home directory? by martinced on Monday January 21, 2013 @01:57PM (#5093023)
But it's easier for a touch-typist to hit 'i' than 'h' (your middle finger doesn't stretch as much when hitting 'i' than your index when hitting 'h'). Try it.

Then in addition to that ijkl is more logical than hjkl.

Re:Why was '~' chosen to represent the home directory? by UnoriginalGuy on Monday January 21, 2013 @01:09PM (#5092740)
I wish Linux just came with Edit.com.

Arrow keys for movement, letter keys for input (what a novelty?!), and a working mouse. All available since MS Dos 6 or earlier.

I understand that some people like VIM and or Emacs, but why must UNIX people force such arcane editors down people's throats? Edit.com put them to shame almost twenty years ago.

Yes, I know, if you spend YEARS learning clever key combinations you can be ever so slightly more efficient, what a novelty...

Re:Why was '~' chosen to represent the home directory? by antiterra on Monday January 21, 2013 @02:25PM (#5093189)
Vim happily uses arrow keys for movement and you can easily learn the basics in a day. Saying that edit puts it to shame is ridiculous, and I'm someone who occasionally types 'edit' out of habit in a dos prompt to edit text files.
Re:Why was '~' chosen to represent the home directory? by jlgreco on Monday January 21, 2013 @02:38PM (#5093262)
You can use Nano/Pico if you want edit.com capabilities... but there is a reason nobody takes them seriously.

Non-modal (I consider Emacs modal too) non-programmable editors are toys.

Re:Why was '~' chosen to represent the home directory? by msh on Monday January 21, 2013 @01:24PM (#5092818)
Nano and pico gives you that... Available on most unix systems.
Re:Why was '~' chosen to represent the home directory? by tracker1 on Monday January 21, 2013 @04:23PM (#5093827)
+1 for nano... I only make relatively quick config changes from a console... so nano is much less of a learning curve... I'd rather not have to memorize a bunch of commands for my general text editing. I do prefer a GUI editor, and ironically enough, Sublime Text has been increasingly my goto editor (needing to remember certain hotkeys, but still works for general arrow-key and mouse editing).
Re:Why was '~' chosen to represent the home directory? by legutierr on Monday January 21, 2013 @10:47AM (#5091937)
Creating custom mappings is great until you need to ssh into an unfamiliar production system and you begin mashing up config files and cron jobs because your muscle memory doesn't match the standard mappings.
Re:Why was '~' chosen to represent the home directory? by chimeracoder on Monday January 21, 2013 @05:11PM (#5094037)
This is the number one reason I've kept my .vimrc to 11 lines. Anything else I've tried adding - particularly in the way of plugins - has only caused me annoyances when working other machines.
Re:Why was '~' chosen to represent the home directory? by tokipin on Monday January 21, 2013 @12:33PM (#5092518)
all of Vim is just a bunch of muscle memory, to one degree or another, and i think you're overstating the intuitiveness/stubborness of the navigational keys. i use Programmer Dvorak and i've never messed with any navigation bindings, and i don't have a problem navigating. (hjkl -> jcvp. not even on the same hand, though it does have some incidental "intuitiveness")

more importantly though, is you should almost never use hjkl in the first place. these are the commands you should be using:

  b B w W e E ge gE
  H M L I A $ ^ 0 %
  { } [[ ]] [] ][
  t<char> T<char> f<char> F<char> ; ,
  /<chars>
    (search counts as a movement command,
     d/foo<enter> will delete everything to foo)
probably the commands i use the most are w b and { }
Re:Why was '~' chosen to represent the home directory? by to3m on Monday January 21, 2013 @04:33PM (#5093875)
I found this while using vim, too. Perhaps I could have eked out a little more efficiency by switching from the cursor keys to hjkl, but I found the (substantial) gains from being consistent about using the higher-level motion commands large enough to keep me happy.
Re:Why was '~' chosen to represent the home directory? by mturmon on Monday January 21, 2013 @03:00PM (#5093378)
Yes. The character-at-a-time motion commands are not really that common in idiomatic vi usage.
Re:Why was '~' chosen to represent the home directory? by sanderjd on Monday January 21, 2013 @10:38AM (#5091896)
You use a lot of words to make one good point, which is that jikl for movement and h for insert is a sensible key mapping. Whether or not you're aware of the advantages of near-home-row movement keys, all the snark surrounding your point is a disservice to it.

I'm going to try your suggestion though, it makes sense.

Re:Why was '~' chosen to represent the home directory? by philwelch on Monday January 21, 2013 @11:10AM (#5092039)
I barely even use h and l anyway, in favor of b and w. And it turns out j and k are ubiquitous in Unix by their own right.
Re:Why was '~' chosen to represent the home directory? by mml on Monday January 21, 2013 @10:01AM (#5091733)
Have you considered the possibility that having nav keys in the home row is a significant advantage over moving the (usually) right hand off the home row entirely to screw around with arrow keys, then back into the homerow to continue working?

I'm surprised you didn't mention it.

(nice rant though!)

Re:Why was '~' chosen to represent the home directory? by martinced on Monday January 21, 2013 @02:01PM (#5093044)
I'm sure that, just like me, he did consider that possibility.

And he did realize that it's easier, from the home position of a touch-typist, to hit 'i' than it is to stretch your index finger and hit 'h'. Just ing try it and you'll see.

In addition to that, it's also more logical to have the inverted 'T' arrow.

Have you considered the possibility that you find what you're using a "significant advantage" simply because it is the same as what an old arcane keyboard did use back in the days?

Re:Why was '~' chosen to represent the home directory? by arethuza on Monday January 21, 2013 @07:48AM (#5091218)
"Every keyboard now has a set of hardware arrowkeys sensibly arranged in an inverted-T"

I've never got into the habit of using anything other than arrow keys even though I've been an occasional vi user for 26 years. Indeed the ancient model of TeleVideo terminal I first learnt Unix on had arrow keys - although not in an inverted-T:

http://www.backglass.org/duncan/gimix/gimix_terminal.jpg

Re:Why was '~' chosen to represent the home directory? by jlgreco on Monday January 21, 2013 @01:53PM (#5092997)
The inverted-T has never made any sense to me. It makes it easy to keep your fingers on left and right, but you can only easily have a single finger on either up or down.

The only time I use an inverted-T is when playing games that use wasd and it really doesn't make sense there, to the extent that when I used to be really into Q3A I started using asdf. (asdf, unlike hjlk, has unfortunately not stayed in my muscle memory.)

The importance of any sort of t-shape is only clear to me if the user cannot type.

Re:Why was '~' chosen to represent the home directory? by tracker1 on Monday January 21, 2013 @04:32PM (#5093871)
Back in the really old days.. I used to map the left ctrl-shift, and z-x as down,up,left,right respectively... it was pretty comfortable, and the muscle memory made it really effective... the position on ctrl, vs shift was physically up/down, but let my hand still be in a natural shape. After around Q3A though, I just got used to wasd, and got tired of remapping all my games around, since it usually messed up other keys, and the inverted T is very common.
Re:Why was '~' chosen to represent the home directory? by jlgreco on Monday January 21, 2013 @05:17PM (#5094068)
I was having some trouble trying to figure out how ctrl/shift/z/x was comfortable at all, but then I realized the idiotic ctrl/fn positioning on this thinkpad was my issue. Seems like a layout with some potential.
Re:Why was '~' chosen to represent the home directory? by qu4z-2 on Wednesday January 23, 2013 @05:05PM (#5105598)
You can probably swap Ctrl/Fn in the BIOS settings on your ThinkPad -- I have, it's much more sane.
Re:Why was '~' chosen to represent the home directory? by jarek on Monday January 21, 2013 @01:58PM (#5093028)
> The inverted-T has never made any sense to me. It makes it easy to keep your fingers on left and right, but you can only easily have a single finger on either up or down.

Contracting fingers to slide between up and down keys is a lot easier than sliding them sideways.

Re:Why was '~' chosen to represent the home directory? by stcredzero on Monday January 21, 2013 @03:08PM (#5093418)
Just adopt a "never retreat" policy in FPS. (I suck at FPS, BTW.)
Re:Why was '~' chosen to represent the home directory? by jlgreco on Monday January 21, 2013 @02:00PM (#5093040)
There is no sliding when I use hjkl.
Re:Why was '~' chosen to represent the home directory? by jarek on Monday January 21, 2013 @02:22PM (#5093178)
Do you find yourself frequently pressing j and k simultaneously?
Re:Why was '~' chosen to represent the home directory? by jlgreco on Monday January 21, 2013 @02:30PM (#5093216)
Simultaneously? No. No more often than any other keys which my fingers are both on.
Re:Why was '~' chosen to represent the home directory? by martinced on Monday January 21, 2013 @01:44PM (#5092937)
+100 000

I'm on Emacs but... I'm doing exactly like you. Inverted 'T' arrows on 'ijkl' ("jkl" being, for a touch typist, the default position for already three of four fingers of the right hand).

It makes sense: pro-gamers for example (not programmers but 'pro-gamers') do often use 'wasd' or 'esdf' because most are right-handed, so they use the mouse with their right hand and they use an inverted 'T' arrows on their left hand (both 'wasd' and 'esdf' do work... I preferred 'esdf' backed when I used to game but that was a long time ago).

'ijkl' makes no sense besides for historical reasons.

Let's not talk about Emacs (and I love Emacs) 's totally stupid 'pbnf': that has to be one of the dumbest way ever way to move the cursor.

Yet people would rather catch RSI than take the time it takes to configure their Emacs to use 'ijkl' instead of 'pbnf' (Previous / Backward / Next / Forward... Zomg. They really did this).

Emacs has a lot of other stupid problems too: I saw some people were remapping the totally Control+x (which you need all the time) to other things using ctl-x-map. I'll look into that next.

And I agree with you: it doesn't take long to get use to a logical way of moving your cursor.

Oh well. We won't convince anyone but... At least both vim and Emacs (and probably many others) are configurable so at least the ones who put thoughts into that matter are able to modify their environment to use a saner configuration.

Re:Why was '~' chosen to represent the home directory? by MartinCron on Monday January 21, 2013 @04:37PM (#5093889)
This is the first I've heard of ESDF instead of WASD for gaming. At least on this keyboard I'm using, it makes more sense, because F has a tiny ridge on the bottom to find by touch, but none of the wASD keys do.