News for hackers. Stuff that matters.
Re:Build muscle memory with your favorite editor by viggity on Monday July 16, 2012 @11:56AM (#4251182)
If you want better shortcut muscle memory, just unplug your mouse for a couple days. Do this once a year or so. You can thank me later.
Re:Build muscle memory with your favorite editor by to3m on Monday July 16, 2012 @01:32PM (#4251661)
No need to be so drastic! - just put it on the other side of your desk.

I've done this a few times when I've needed the space for taking notes. I'm now pretty good at mousing with either hand - but the key part is not making mousing more annoying, like it was the first time I swapped, but rather just making you realise when you're reaching for it. That gives you a chance to consciously think about what you're about to do. And then you have a chance to decide that you're going to figure out how to do it with the keyboard.

Re:Build muscle memory with your favorite editor by SuitAndThai on Monday July 16, 2012 @12:28PM (#4251337)
This is similar to how I learned the DVORAK layout actually. I switched to DVORAK, made sure that I had a couple of essays pushed off til the last minute, and bam! I knew it like the back of my hand by 3AM.
Re:Build muscle memory with your favorite editor by RegEx on Monday July 16, 2012 @03:15PM (#4252050)
Dvorak was a long process for me. It took me about 3 months to get to 70 wpm (was 120 qwerty). Online gaming had a lot to do with the delay: switching keybindings for every game was annoying, and I needed to quickly communicate with teammates (or smacktalk opponents ;P)
Re:Build muscle memory with your favorite editor by dkersten on Monday July 16, 2012 @05:33PM (#4252807)
I'm hoping to get there soon. On linux, I use vim, a keyboard centric window manager and I've recently started using uzbl for my web browsing. Not there yet, but getting there - already I find I don't need to reach for the mouse very often at all!
Re:Build muscle memory with your favorite editor by bangbang on Monday July 16, 2012 @12:07PM (#4251229)
In OSX, are all dialogue boxes able to be accessed by the keyboard?
Re:Build muscle memory with your favorite editor by jasonwebster on Monday July 16, 2012 @12:17PM (#4251274)
Yes, but you have to enable it. It's not on by default.

System Preferences -> Keyboard -> Keyboard Shortcuts

And change the radio at the bottom to "All controls" under Full Keyboard Access.

Re:Build muscle memory with your favorite editor by JadeNB on Monday July 16, 2012 @12:24PM (#4251314)
To get to System Preferences, you can use CTRL-F2 to get to the Apple menu, CTRL-F3 to get to the Dock, or—if those shortcuts aren't set up (but I think that they are by default)—CMD-TAB to get to Finder, CMD-A to get to the Applications folder, and type a few letters to get to 'System Preferences.app'. :-)

In the System Preferences window, you can start typing to select 'Keyboard' (keyboard focus is in the Spotlight menulet).

You can tab to the 'Keyboard' / 'Keyboard Shortcuts' tab bar, then arrow over to 'Keyboard Shortcuts', then tab to the 'Full Keyboard Access' radio buttons. Sadly, these last few steps require that Full Keyboard Access already be turned on! The text below the radio buttons says that you can toggle the setting with CTRL-F7, but that doesn't work for me; I'm not sure if some other keybinding is interfering.

Re:Build muscle memory with your favorite editor by m4rkuskk on Monday July 16, 2012 @12:38PM (#4251383)
Event quicker ⌘+space spotlight and type `keyboard` =)
Re:Build muscle memory with your favorite editor by daniel02216 on Monday July 16, 2012 @01:05PM (#4251524)
Do you have the 'use F1, etc as function keys' unchecked? You'll need to use fn+control+F7 instead.
Re:Build muscle memory with your favorite editor by JadeNB on Monday July 16, 2012 @01:06PM (#4251529)
Nope—the machine is a laptop, but I'm using an external keyboard. For example, CTRL-F2 and CTRL-F3 both work fine.
Re:Build muscle memory with your favorite editor by philfreo on Monday July 16, 2012 @12:48PM (#4251451)
How do you keyboard navigate the TextEdit save dialog that comes up when you Cmd+w on a window when you don't want to save it? (Can you do better than press tab 5 times then space?)
Re:Build muscle memory with your favorite editor by dwich on Monday July 16, 2012 @01:11PM (#4251558)
Prior to Lion, Cmd+D means "don't save" in the dialog. With Lion, it's Cmd+Backspace.
Re:Build muscle memory with your favorite editor by guns on Monday July 16, 2012 @12:55PM (#4251481)
Working once on a MacBook with a disabled trackpad, I found the only window that I could not focus using the keyboard was the password dialog. I realized later that AppleScript could do the trick:

    (as root)
    # ps axo ucomm | grep -q SecurityAgent && osascript -e 'tell application "SecurityAgent" to activate'
Re:Build muscle memory with your favorite editor by zdw on Monday July 16, 2012 @02:54PM (#4251955)
There's a direct way to do this:

Command + first letter button title

will activate that option, with a few caveats - Command-C won't work as Cancel, but Command-. will.

Re:Build muscle memory with your favorite editor by daniel02216 on Monday July 16, 2012 @01:03PM (#4251516)
I believe they are if you enable 'Full Keyboard Access' for 'All Controls' in the Keyboard prefpane (under Keyboard Shortcuts tab)

Or just hit Control-F7.

Re:Build muscle memory with your favorite editor by bashzor on Monday July 16, 2012 @12:14PM (#4251265)
Not sure about OSX, but in Windows you can. This is a huge miss in Linux I find (all distributions I've tried so far), you need the mouse to get anything done without resorting to a terminal.
Re:Build muscle memory with your favorite editor by kleiba on Monday July 16, 2012 @12:20PM (#4251291)
Step 2: undefine the arrow keys.
Re:Build muscle memory with your favorite editor by farslan on Monday July 16, 2012 @12:42PM (#4251412)
In vim you can do that by putting these lines into ~/.vimrc:

  map <up> <nop>
  map <down> <nop>
  map <left> <nop>
  map <right> <nop>
  imap <up> <nop>
  imap <down> <nop>
  imap <left> <nop>
  imap <right> <nop>
This will disable the arrow keys in normal and insert mode.
Re:Build muscle memory with your favorite editor by dickfickling on Monday July 16, 2012 @02:37PM (#4251901)
I'm not trying to be difficult here, just genuinely curious: why disable the arrow keys? Is it simply the speed boost you get from using hjkl on the home row vs moving your hand to the arrows?

I use Colemak, so hjkl is very counter-intuitive for me, whereas the arrow keys make sense and aren't /that/ far away.

EDIT: http://news.ycombinator.com/item?id=3684515 has some good explanations. So does anyone have suggestions for non-QWERTY users? remap the keys that are in the HJKL space, leading to a cascade of keys moved around? Deal with the counter-intuitiveness of actually using HJKL?

Re:Build muscle memory with your favorite editor by koenigdavidmj on Monday July 16, 2012 @03:39PM (#4252163)
When I use Vim I barely even use hkjl except to fine-tune larger movement commands. I'll search for a symbol, or move word-by-word, or use f/F/t/T to move to a different character on a line, which gets me in the ballpark.

Even if hjkl is faster, I would be optimising for a case that just doesn't show up that much.

Re:Build muscle memory with your favorite editor by RegEx on Monday July 16, 2012 @03:18PM (#4252059)
Dvorak users can get away with using hjkl with the dvorak layout - it's not that counter-intuitive. Your Colemak layout, however, looks beyond salvageable in terms of using Colemak hjkl. I think a re-binding is in order there.
Re:Build muscle memory with your favorite editor by SiVal on Monday July 16, 2012 @03:50PM (#4252223)
Or, remap the hjkl of vim, a ridiculous legacy of an obsolete keyboard Bill Joy just happened to be using at the time, to the normal inverted-T of cursor movement: ijkl. Then continue using the "arrowkeys" that are now under your right hand on the home row.

You'll then need to move the insert on left side of cursor, which was i, to h, the key on the left side of your index finger. Reach left to insert left. Easy for muscle memory. With that, both sets of arrowkeys on the keyboard work the same, and you won't need to disable one of them. Normal arrowkey muscle memory, and reach left to insert left. So easy.

Bill Joy was working in an era when keyboards didn't have separate arrowkeys and the ESC key was within easy reach. He wanted it to be as easy as possible to remember lots of different command keys. He used what was printed on his key caps, such as a straight line of arrows on hjkl and various English words such as "yank" in his design. It was a good idea at the time. He also realized that keyboards varied, so he made it all remappable to adapt to future keyboard designs--also a good idea.

But the programmers themselves couldn't adapt. The choices Joy made for that obsolete keyboard were frozen in amber by programmers whose habits were frozen in amber. These days, almost all keyboards have real arrowkeys, and people develop the muscle memory to use them long before they ever hear of vim. Also the ESC key, such a fundamental key, is off in Siberia.

For every vim user with vim habits based on an obsolete keyboard they don't use, there are 10,000 potential vim users with keyboarding habits based on the modern keyboards they DO use. Those 10,000 people use inverted-T arrowkeys, x/c/v as cut, copy, paste, they can't reach their ESC key, etc. Vim was designed to adapt, but old vimmers apparently weren't, so the design features that give vim its power are forever stuck behind arbitrary key layouts optimized for the wrong keyboard.

It makes more sense to remain consistent with existing muscle memory and keyboards, using the inverted-T arrangement ijkl, mapping your left-side insert to the left side key ('h'), and mapping ESC to something easy to reach, such as ';;'. Then, if you ever need to use a non-customized vim, just use the real arrowkeys, which will still feel natural. If you ever need to use another app with a serious vi mode, like zsh, it will be remappable to match your vi. (If it's not a serious vi mode but just a couple of vi-like keyboard shortcuts, either use the arrowkeys or do what we always do, given that every app has its own unique set of keyboard shortcuts: just learn a few new shortcuts for that app.)

Re:Build muscle memory with your favorite editor by gosu on Monday July 16, 2012 @05:11PM (#4252701)
What's so ridiculous about hjkl? I'm actually an emacs user, and I've gone to great lengths to set up hjkl layouts in my editor and browser.

It seems like the perfect setup to me. An inverted T would cause you to reposition a finger every time you wanted to change direction. I do that often enough that it doesn't seem very efficient to me. I had some doubts as to whether jkl; would be a better option, but it really does seem more convenient to have the "down" key below your index finger.