Why was '~' chosen to represent the home directory?
unix.stackexchange.com
unix.stackexchange.com
I really have my problems, to wrap my head around "hjkl", as there is (imho) no logical mnemonic for the directions. It is sadly just "learn by rote".
" Disable arrow keys
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
You'll have one or two frustrating days, but after that your muscle memory will take care of remembering "hjkl" for you.But non the less, the logic didn't register with me. (something like clockwise/counter-clockwise, or anything remotely recognizable ;-) )
I also disabled Home, End, PgUp and PgDown:
noremap <home> <nop>
noremap <end> <nop>
noremap <pageup> <nop>
noremap <pagedown> <nop>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?
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:
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.
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.
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 :-).
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.
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.
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.
Then in addition to that ijkl is more logical than hjkl.
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.
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.
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...
Non-modal (I consider Emacs modal too) non-programmable editors are toys.
I'm surprised you didn't mention it.
(nice rant though!)
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?
I'm going to try your suggestion though, it makes sense.
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 { }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.
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.
Contracting fingers to slide between up and down keys is a lot easier than sliding them sideways.
I use whatever my hand happens to be closer to. 85% of the time that's the home row, hjkl. But if my hand is closer to the arrow keys I'll use that, and if my hand is on the mouse I'll use that.
" Arrow keys set up for easy buffer switching
nnoremap <left> :bprev<cr>
nnoremap <right> :bnext<cr>
nnoremap <down> :buffer #<cr>
nnoremap <up> :buffers<cr>:buffer<space>http://jwvideo.free.fr/ImagesMac/AppleII/Apple%20II%20int%C3...
I've always thought that was so much better than the inverted T on PC keyboards, since you can press all the keys without moving your fingers - much faster for games.
Oh, this `j` key has an inset to distinguish it from the rest. Surely this means I need to press this one!
(You can easily figure out the three other keys from there).
H & L are left & right - fairly intuitive, leftmost is left, rightmost is right
J looks kinda like a down arrow
That leaves K, which must be up by process of elimination :)
Once you have integrated them in your workflow, you'll wonder why you even got into the trouble to force yourself to use hjkl instead of the arrows.
Remapping the movement keys in Worms Reloaded also helped massively, though did result in me getting completely thrashed for the first twenty or thirty matches I played.
These four keys are the most basic thing about vim. Yes there doesn't seem to be much to remember them by, but for these at least, there doesn't need to be. Just muscle through it as long as it takes. It won't take long if you're using vim regularly. Soon you won't think about it, you'll just think "up" and you'll be up a line without consciously thinking "... um ... k".
There are ways to get around these four: arrow keys, macros, whatever. Don't. Just learn them.
Bonus, those keys show up in other vim-like command interfaces, including bash and other shell command line shortcuts. And if you use .inputrc, they'll show up in database and language repls and similar environments.
Just learn them.
Display a big arrow, grab an input, make a nice boop noise if it's right and a nasty beep noise (with a graphic flash) if it's wrong. Keep score of how many key presses were right, and average time for each press.
· Control-H is Back Space: it moves the cursor one position left.
· Control-J is Line Feed: it moves the cursor one line down.
The other two seem to be arbitrary on the part of the ADM-3A designers, and having Control-L (Form Feed) perform cursor-right rather than clear-screen seems a bit dubious, but given their constraints and the desire to keep all the motions together, it's hard to argue for any different choices.
"hjkl", as there is (imho) no logical mnemonic for the directions.
left: "h" is leftmost in the groupright: "l" is rightmost in the group
down: "j" extends down below the baseline
up: "k" extends up to the topline
h: move left ctrl-h (which is backspace in ASCII): move left a space while doing something
j: move down ctrl-j (line feed): move down a space while doing something
Unfortunately, this doesn't extend to k (vertical tab) or l (form feed), but... maybe it's helpful?
If you need to practice, play robots or nethack...
(I started to write "and my middle finger (on K) is pointing up", but then I realize that an upward-pointing middle finger means something entirely different.. <:)
Nowadays I don't even need to think about using any of those keys for moving around. In fact, I use them in pretty much every application that supports them, including Firefox (with pentadactyl) and less.
At least some of you now understand that these tools were designed as you see them today because they were dealing with crippled hardware (from today's vantage point). There was no magical study on keystroke efficiency at the inception. They had lemons and made lemonade.
Now, quit arguing and get back to reading Facebook!
Yup, that's me ducking in the corner.
It's also true that functions can be mapped to arbitrary inputs and systems. But I think there's value in learning HJKL rather than remapping them:
1. They're on the home row, giving a slight speed benefit for these commonly used actions.
2. You get used to the movement keys that will be the default in any copy of Vi/m and quite a few other tools. (HJKL, along with WASD and dedicated arrow keys, is probably the most common mapping of left, right, up, and down to keys on a keyboard.)
Arrgh. This is an example of why programmers are different, not of a bad interface for ordinary people. Thanks for considering me so daft as to think non-programmers people use VIM.
I still disagree that HJKL is madness, however. It's not the best possible scheme, but it is reasonable to keep it for its remaining advantages.
http://www.engadget.com/2005/03/04/music-thing-the-chromaton...
https://en.wikipedia.org/wiki/Janko_keyboard
I really want one.
I could agree with you and get the anti-vim guys all worked up. I could even back it up with random links and examples from all over the web.
I could also disagree with you and get pro-vim guys all riled-up. Again, suitable links, stats and a photo of some guy with carpal-tunnel would do the trick.
That's great stuff!
To quote one of the most memorable lines in motion picture lore:
"Interesting game. The only way to win is not to play."
I use vim. And I've used everything else. I don't care. All of it pales in magnitude to the efficiency losses elsewhere in the process of developing a software product.
My guess is that on a daily basis I waste more time going for a cup of coffee, shooting the shit, reading/posting on HN, getting pulled in all manner of directions on the internet than any text editor could save me short of a brain-to-code interface.
And, of course, there's the actual work of figuring out how to code something. I've spent days diagraming state machines with, yes, hold-on, paper and pencil. Once there, an hour or two and the bug-free code is written and working. Yes, even if you use Notepad.
You want to be more efficient? Get really good at going from problem to finished, shippable, documented, flexible, reusable and bug-free code. What you use to enter said code probably does not matter.
I'm going back to polishing my keyboard.
Maybe you guys ought to do the same.
For me (and I appreciate the irony) I like vim because it has a lower cognitive load. I can say things like "Change the contents of the quotes to say Goodbye Planet", rather than having to actually execute the instructions --
move left a word, move left a word, start highlight, move right a word, move right a word, move right a word, stop and check to see my cursor is in the right place, press delete, type phrase "Goodbye Planet"
The benefits measured in time are no doubt negligible (or even negative -- as you say, editing time pales in comparison to other work), but the benefits to my concentration are much higher. Tedious, repetitive work makes me frustrated, distracted, or both. If I can keep myself in a good mental space and not be constantly interrupted by having to babysit my source editor, I can be more productive.
PS: And then I spend the time on HN :/
(also Enter, ESC, space, delete, backspace, etc etc)
:set incsearch
:set hlsearch
(ObFlameRetardant: I prefer Emacs myself for programming, but vim is a perfectly excellent editor.)Do you have a link to the study about mouse vs cell-based key movement?
I have a couple of questions:
- While I fully believe that navigating by mouse is faster, on a desktop the overhead of switching between typing and mousing is quite high. On my laptop I often use the trackpoint over relevant keyboard shortcuts because it's already right under my fingers, but on my desktop I much prefer using the shortcuts due to the overhead of switching.
- For a movement that's three cells or fewer, I find it hard to imagine that mouse would be faster (unless perhaps it's set to follow the cursor?). I assume the study averages over a variety of distances across the entire screen. I hope that most vim users aren't using hjkl for adjustments of more than three or so cells. A combination of {}wb and especially ?/ will handle the bulk of jumps quickly. hjkl are then useful keys for adjusting just a couple of characters to refine your jump -- and now they're already right under your fingers.
There's a slowdown associated with considering too many different options, too, btw. It's just more invisible.
The terminfo entry seems to confirm this (apt-get source ncurses-term && less +/^adm3a ncurses-5.9/misc/terminfo.src):
adm3a|lsi adm3a,
OTbs, am,
cols#80, lines#24,
OTma=^K^P, OTnl=^J, bel=^G, clear=\032$<1/>, cr=^M, cub1=^H,
cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c,
cuu1=^K, home=^^, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^L,
kcuu1=^K, rs2=^N,
I think the speculations about ^ in regexps coming from the same source are misplaced, because I think the ed editor was already using ^ to mean "beginning of line" before there were any CRT terminals.The ADM-3A had direct cursor addressing, as referenced in the "cup" capability in the above terminfo entry, so the "home" feature was, strictly speaking, redundant. As you can see from the simplicity of the terminfo entry (notably its almost complete lack of escape sequences) logic was aggressively minimized in this termainal. I seem to recall from glancing inside the ADM-3As I bought at auction in my childhood that it was built almost entirely out of discrete 7400-series logic, so every extra control character involved adding several chips.
In light of this, I suspect that the "home" feature may have been retained for backwards compatibility with something else — maybe the ADM-3? But the ADM-3 terminfo entry doesn't mention "home", so I don't know.
More details about the ADM-3A can be found at <http://manx.classiccmp.org/details/11,5618>.
C and Java programmers.
http://docs.oracle.com/cd/E19683-01/806-6642/images/BR.unix....
This is not entirely hilarious when a junior sysadmin 'tidies up' the keyboards connected to the main database server (and even further from funny when the slave is currently down for maintenance ...)
I still had the e1000 (and disk array) which was skip dived until last year but the wife made me get rid of it :( She didn't want that kind of coffee table...
He could have gone for wasd or ijkl. But he had to go with hjkl!
Anyway, the fact that j looks like a down arrow is a very good thing that makes me remember it and allow me to play nethack.
But seriously, I spent the longest time assuming that the talk about better keyboard were exaggerations or placebo effect deals, until I started using the MBP keyboard, which just felt significantly better than anything I'd used before, sort of satisfying.
So I've got an open mind now, and am planning on hand-me-downing my apple wireless to a friend in need. Does anyone have a specific recommendation for a keyboard for programming that might be a decent replacement?
My only brush with that kind of thing was servicing computers that wrote to the paper tape punches we used in the Marines in the early 90s.
I blame the VT220 for screwing this up.
lmgtfy is hateful because it often links to the same search that the asker has previously done, and returns the same not-useful hits. But the answerer doesn't check the returned hits, and just smugly slaps lmgtfy in to "teach" the asker a lesson about searching before asking.
Actually, I stumbled over that question during my quest of unifying my keyboard-layouts (Mac=Work and Linux=Private) via xmodmap.
Unless you're just trying to simulate an Apple keyboard configuration on Linux, that is.
Why do we use X?
Because N years ago, the environment looked like E1, and so X made sense. Then, people got used to X as a convention, and even though our environment changed to E2, we still use X because of network effects.
A great way to improve the world is to understand where X came from, understand how E2 differs from E1, and then invent Y to better fit E2.
The hard part is that Y needs to be significantly better than X so that you can get people to switch given that X has stronger network effects.