Why "hjkl" is highly recommended? [duplicate] - vim

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
VimTutor arrow keys v/s hjkl
Why "hjkl" is highly recommended?
I think it's more convenice using arrow key.
Is there any advantages using "hjkl"?

It is a bit like using the mouse. Every time you reach the mouse, or the arrow keys, you have to move your hand back to the main part of the keyboard to access other very common commands like i, y and you will lose some time.
Rather than the time, I think that the main issue is you are losing some focus on what you are doing, because you have to look at (or think about) your hand rather than the screen.

You keep your fingers on the home row and if you're using touch typing (which you should) you are much faster at editing.
Check this page to get more info.

Related

Haskell: How to capture keyboard press like up, down, left and right [duplicate]

This question already has answers here:
Haskell read raw keyboard input
(6 answers)
Closed 8 years ago.
I am planning to create a game using haskell, but cannot figure out the way to capture key events like pressing up, down, left and right on keyboard.
I tried getChar but it does not capture these. (or probably i am not aware how it does)
Also it would be great to capture CTRL, ALT combinations as well.
Asynchronous keyboard IO is OS-specific, so you'd need a library to abstract that.
As to the "processing" part of it, such libraries usually allow you to register callbacks for the events. From them, you can for example use TQueue from STM to push the events onto, and then process them sequentially in your pure code.
GLFW-b demo has a pretty nice example of that technique in practice. If you want to create a text game, it would probably be an overkill to pull a whole thing for that; maybe look for some ncurses binding?

Vim Navigation Requires Too Much Thinking [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I've been using vim for a few years and I love how easy it is to do simple tasks like insert above current line, delete whole line, etc. I've even mapped my caps lock to escape because of it!
One problem with vim that I could never get over was how much thinking navigation requires compared to mouse movements, even after you've learned the keys. I know about some of the movements like %, ^, $, f/F, t/T and using numbers before a command but I feel like it takes a lot more effort to use them and they disrupt my workflow.
For example, I need to delete the "/many/sections/" of this url and the cursor is in the middle of the word "really":
http://this/is/a/real|ly/long/url/with/many/sections/
With a mouse, it takes no thinking power to just click and select the sections I want to remove and hit delete.
If I do this in vim, I find myself thinking: Ok, first $ brings the cursor to the end. Then I want to delete those sections so I can use the '/' as deliminator and now I have to count how many of the '/' I want to move back. It's two and I have to search backwards so it's F, not f. So I think the command should be $d2F/.
Alternatively, I could have used 'm' as a landmark for the cursor and delete to the end from there but then I'd have to scan the url to look for letters to use. And if there was another m, I'd also have to press ; repeatedly or start counting.
This seems a lot harder than just using a mouse, even with the delay of moving my hands off the keyboard. This is especially true for multiple line selections where I find myself spending a lot of time counting words or lines or looking for deliminators.
Also, sometimes the command either deletes or doesn't delete some extra deliminator characters because I used f instead of t or vice versa whereas with a mouse, I can pinpoint exactly what I'm trying to select.
The / key is your friend. From where you are hit /ma ENTER. Then, hit D to delete the rest of the line.
The /maEnterD is probably the quickest solution and does not require hard motion planning. (And similarly use ? for reverse motion).
But if you feel you need more motion, you should definitely check Easymotion plugin. it expands the f,F motion to the whole window, rather than the single line.
Actually, I do agree that using F is quite cumbersome, I'd rather use text object, like vi) or dip.
Use gvim so you can use your mouse.
If you don't like planning, what about repeating?
$dF/.
doesn't require any thinking whatsoever.
wwwwwwwD
doesn't require any thinking either.
Anyway, I would do /ma<CR>D like already mentioned.
And nothing prevents you from using the mouse if you are more comfortable with it.

One handed coding -- tablet, special keyboard, one-handed typing?

I recently broke my finger and can now only type with my right hand. This has seriously impacted my typing speed. Since I write software for a living, this is a serious problem.
I have been doing some research, but haven't found a great solution yet. Here's what I've come up with:
Wacom tablet + hand writing recognition software. Is it possible to write code with hand writing recognition software?
one handed keyboards -- I have only found expensive (> $100) keyboards. These look like they have a steep learning curve.
one handed typing instructions: http://www.aboutonehandtyping.com/manualcompare.html. Does this really work?
What do the one handed coders out there use?
If you're a two-hand touch typist, the answer is a "mirrored" layout.
Mirroring lets you begin touch-typing with one hand almost immediately. Pretty crazy how easy it is. Based on the muscle memory you already have.
If you're typing with your right hand:
Type all right-hand keys normally.
Don't type left hand keys. Instead type the same motion (but mirrored) with your right hand.
So if you want to type:
"D" -> type "K" instead.
"W" -> type "O" instead.
"S" -> type "L" instead.
Same row of keyboard, same finger, same motion. Your muscle memory can already do this... kind of like how you're unable to pat your head and rub your belly at the same time. The wires in your brain are crossing somewhere.
Software to mirror the keyboard as described above:
Hold Spacebar to mirror:
Linux - MirrorBoard
Mac - Mirror-QWERTY
Windows - AutoHotkey version of Half-QWERTY Half-Keyboard
Predictive Text; Automatic Mirroring
Mac - One-Hand Keyboard
Windows - One-Hand Keyboard
Regarding one-handed keyboards, I've tried using a frogpad and found it ok for typing text, but unusable for coding. The symbols require several consecutive key presses and I found it impossible to use shortcuts reliably. It was too easy to hit the wrong key and get it stuck in the wrong mode.
Nobody has mentioned ENTI-key aka Coffee++ Layout yet? It is exactly designed for programming with one hand (left). And unlike qwerty, it is even optimized for speed and ergonomics. I used it some years ago for a short while and I don't know if it still works on newer systems. I think I used it for writing CSS: Typing the words with left, typing all those numbers on the numpad with right.
I can not recommend pen+handwriting. I usually use a tablet PC and handwriting code is terrible. I tried it on Windows 8 and Linux with Cellwriter, and both are not bad programs, but I still switch to onscreen keyboard whenever I can. But maybe the problem is my scratchy writing :)
I also can tell from experience that learning a new layout is not as complicated as it sounds. Especially if the layout is more logical than qwerty. I use Neo Layout since 10 years and getting the hang of it went smoothly, I was able to write a blog article after an evening of training.
"But what if you have to use qwerty on another PC?" This, also, is no problem, really. My simple trick is to never look at the keyboard when using Neo, but glimpse at it when qwerty-ing.
Good luck to anyone who wants to or has to use one hand for typing!
Now, the time to heal a broken finger will be shorter than it takes to adapt to one handed coding, not to mention the time it takes afterwards to get back to two-handed coding
Also, the time it takes to learn the methods is time you could've spend on coding (read: making a living).
Knowing this, we need a quick-fix, short term solution.
First of all, A good IDE, with code completion and similar functionality will help you a lot.
Secondly, use the shortcuts of the IDE, remember, there are Shift, Altand Ctrl keys on both sides of your keyboard.
(you might want to create a cheatsheet for those shortcuts)
In addition to helping you during your time with your injury, learning the shortcuts will also improve your coding speed when you're back up again.
Now, my comments on your proposals:
Don't, simply, Don't, it'll take even more time to fix writos (typos) beacause recognition will be flaky.
That learing curve will slow you down even more.
Won't even comment on that one...
Mirrorboard
A friend of mine broke his wrist snowboarding, and he had reasonable luck using speech recognition software (Nuance Dragon Naturally Speaking). It worked quite well for email and documentation, which would solve a part of your problem.
Another colleague, Nils Klarlund of AT&T, developed a version of emacs hooked into speech recognition. He even had a home-brewed set of foot pedals for doing shift, control, etc. He used this exclusively for years (due to bad carpal tunnel syndrome).
And maybe your feet can take up some of the burden. This is part of a parallel discussion going on in this question.
And off-topic, but extremely interesting, T.V. Raman, who's been blind since the age of 14, wrote a version of emacs that works with keyboard input and audio output. There's a chapter on it in Beautiful Code. I've seen him use it, and it's completely awesome. And of course emacs is a great interface for more than just text editing.
If you anticipate that your left hand will be out of commission for a long while, and if it's worthwhile for you to learn a new layout, then there exist one-handed Dvorak layouts.
There's some information at PC Guide: Single-Handed Dvorak Alphanumeric Layouts.
There also once was software for Qwerty Half Keyboards that used the space bar as an extra shift key that reversed the keyboard.
Good luck with your injury!
We have a developer in the office that lost mobility in his right hand and probably won't gain back full use of it. He has mainly learned to type well with his left hand and kind of fill in for his right hand. Although he lets his right hand kind of peck for things. He has gained enough speed back for it not to affect his day too greatly from what i can tell.
Only thing i can think of that might let you speed up some while typing with one hand and maybe being able to get a key or two with the other hand might be to use an IDE instead of text editor if you already don't, so you can use tab completion. Kind of a lame solution if you don't like IDEs or just don't have that option in your work environment but might help out a bit.
The same thing happened to me (I destroyed my left pinky). At the time, I didn't touch type, so my only use for my pinky was left-control, left-shift, and caps-lock.
This sounds as if it just happened to you. I promise you'll quickly learn to compensate. Remember, it's quality, not speed, that counts most.
Perhaps you should seize the opportunity and read to improve yourself as a programmer. Or spend some time debugging.

Why are there so few modal-editors that aren't vi*? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Pretty much every other editor that isn't a vi descendant (vim, cream, vi-emu) seems to use the emacs shortcuts (ctrl+w to delete back a word and so on)
Early software was often modal, but usability took a turn at some point, away from this style.
VI-based editors are total enigmas -- they're the only real surviving members of that order of software.
Modes are a no-no in usability and interaction design because we humans are fickle mammals who cannot be trusted to remember what mode the application is in.
If you think you are in one "mode" when you are actually in another, then all sorts of badness can ensue. What you believe to be a series of harmless keystrokes can (in the wrong mode) cause unlimited catastrophe. This is known as a "mode error".
To learn more, search for the term "modeless" (and "usability")
As mentioned in the comments below, a Modal interface in the hands of an experienced and non-fickle person can be extremely efficient.
Um... maybe there isn't much of a need for one, given that Vi/Vim is pretty much available everywhere and got the whole modal thing right? :)
I think that it's because vi (and its ilk) already occupies the ecological niche of modal editors.
The number of people who prefer modal and haven't yet been attracted to vi is probably 0, so the hypothetical vi competitor would have to be so great as to make a significant number of vi users switch. This isn't likely. The cost of switching editors is huge and the vi-s are probably already as good as modal editors go. Well, maybe a significant breakthrough could improve upon them, but I find this unlikely.
#Leon: Great answer.
#dbr: Modal editing is something that takes a while to get used to. If you were to build a new editor that fits this paradigm, how would you improve on VI/VIM/Emacs? I think that is, in part, an answer to the question. Getting it "right" is hard enough, competing agains the likes of VI/VIM/Emacs would be extremely tough -- most people who use these editors are "die hard" fans, and you'd have to give them a compelling reason to move to another editor. Those people who don't use them already are most likely going to stay in a non-modal editor. IMHO of course ;)
Modal editors have the huge advantage to touch typists that you can navigate around the screen without taking your hands off the home row. My wrists only hurt when I'm doing stuff that requires me to move my hand off the keyboard and onto the mouse or arrow keys and back constantly.
Remember that Notepad is a modal editor!
To see this, try typing E, D, I, T; now try typing Alt, E, D, I, T. In the second case the Alt key activates the "menu mode" so the results are different. :oP People seem to cope with that.
(Yes, this is a feature of Windows rather than specifically of Notepad. I think it's a bad feature because it is easy to hit Alt by mistake and I don't think you can turn it off.)
VIM and emacs make about as much user interface design sense as qwerty. We now have available modern computer optimized key layouts (see the colemak layout and the carpalx project); it's only a matter of time before someone does the same for text editors.
I believe Eclipse has Vi bindings and there is a Visual Studio plugin/extension, too (which is called Vi-Emu, or something).
It's worth noting that the vi input models survival is in part due it's adoption in the POSIX standard, so investing time in learning would mean your guarenteed to be able to work on any system complying to these standards. So, like English, theres power in ubiquity.
As far as alternatives go, I doubt an alternate model editor would survive a 30 day free trial period, so its the same reason more people drive automatics than fly jets.
Since this is a question already at odds with the "no subjective issues" mantra, allow me to face that head on in kind.
Non-Modal editing seeks to solve the problem caused by non-modal editing in the first place.
Simply put, with Modal editing I can do nearly everything without my hands leaving the keyboard, and without even tormenting my pinky with reaching for the control, or interrupting my finger placement by hunting for the arrow keys.
Reaching for mouse completely interrupts the train of thought. I have hated the intense reliance upon this with Intellij IDEA and Netbeans for many years. Even with vim-style addons.
Most of what you do has to do with fine-tuning with very small increments and changes within the same paragraph of code. Move up, move over, change character, etc., etc. These things are interrupted with control keys and arrows and mouse.
Though not really answering your question, there used to be a "modal like" way to write Japanese on cell phones before :
The first letter you hit was a conson let's say K, and then, and then the next key you would hit would have the role of a conson. (Having two conson in a row is impossible in Japanese)
Though it was main a few years ago, today it's only used by people who really want to hit fast.
I think the answer to the question is actually there are quite a few modal text editors that aren't forks of vi/vim. However they all use the vi key bindings. Vi users get the key bindings into their muscle memory so relearning a different set of key bindings would be really hard, so no-one would create a different set of key bindings.
But lots of different editors have re-implemented the vi key bindings from scratch. Just look at this question about IDEs with vi key bindings. At least half of the answers are editors built from scratch that implement vi key bindings, not versions of vi embedded.
I recently came across divascheme - an alternative set of key bindings for DrScheme. This is modal, and part of the justification is to do with RSI - specifically avoiding lots of wrist twisting to hit Ctrl-Alt-Shift-something. The coder has done an informal survey of fellow coders and found that emacs users suffered from more wrist pain than vi coders.
You can see him doing a short talk at LugRadio Live USA. (The video is a series of 5 minute talks and I can't remember how far through it is, sorry - if someone watches it and posts that here I'll edit this post to say when in the video it is).
Note I have not used divascheme.
The invention of the mouse took one mode and moved it to an input device, and context menus took another mode and moved it to a button. Ironically, the advent of touch devices has had the reverse effect, producing multi-modal interfaces:
aware multi-modal - touch and speech are aware of each other and intersect
unaware multi-modal - touch and speech are unaware of each other and conflict
The traditional WIMP interfaces have the basic premise that the information can flow in and out of the system through a single channel or an event stream. This event stream can be in the form of input (mouse, keyboard etc) where the user enters data to the system and expects feedback in the form of output (voice, vibration, visual, etc) when the system responds. But the channel maintains its singularity and can process information one source at a time. For example, in today’s interaction, the computer ignores typed information (through a keyboard) when a mouse button is depressed.
This is very much different from a multimodal interaction where the system has multiple event streams and channels and can process information coming through various input modes acting in parallel, such as those described above. For example, in an IVR system a user can either type or speak to navigate through the menu.
References
User Agent Accessibility Guidelines working group (UAWG): Keyboard Interface use cases
W3C Multimodal Standard Brings Web to More People, More Ways
Next steps for W3C work on Multimodal Standards
The Future of Interaction is Multimodal
Beyond Mouse and Keyboard: Expanding Design Considerations for Information Visualization Interactions - naturalinfovis_infovis2012.pdf
Setting the scope for light-weight Web-based applications
Jan. 26, 1983: Spreadsheet as Easy as 1-2-3
Multi-modal design: Gesture, Touch and Mobile devices...next big thing? | Experience Dynamics

Keyboards with the number pad in the middle? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'm suffering from early RSI symptoms and am looking for a way to avoid injury. My physiotherapist has determined that the worst thing I seem to be doing is using my mouse at such a weird angle. The problem for me is, I keep my keyboard positioned such that my left and right forearms are angled in the same amount, i.e., my body is centred roughly with the B key. On my current keyboard, which is not a split, this means the wide Enter key, the arrow keys, and the number pad all jut out to the right before I have space for my mouse. I have a medium-width frame, but even still, this leaves my wrist at a really awkward angle when using the mouse. I'd prefer not to have to push my keyboard out of the way every time I switch between the two, but I do use the num pad occasionally, so I wouldn't want a keyboard without that.
I think it'd be ideal to have about a 30-50 cm space between the left and right halves of the keyboard, so my arms are more perpendicular to my collarbone, and the arrow keys and number pad in the middle, maybe even with the numbers on a 45 degree angle, so I could configure them for use with either hand.
(In case you were wondering, then a touch-screen with a stylus that has a right-click modifier button for mousing, because otherwise the mouse pad would be right where I'd put the right half of the home row, in the most natural position for my right arm while sitting.)
With that much space, you could fit so many custom keys for things that you normally use two-key combos for...or you could detach them completely (save for a wire) and just have, you know, actual desktop showing through.
What's the closest keyboard you've seen to this?
I use a keyboard with the numeric keypad on the left hand side. This allows me to bring my mouse in closer on the right hand side, allowing for a more natural position. I am right handed. You can see the keyboard I use here.
(source: keyboardco.com)
http://www.thehumansolution.com/keyboards.html
I've been looking here at some keyboards (I've got severe Carpal Tunnel). The Kinesis keyboards are nice, but there where a few there with the number pad in the middle.
alt text http://us.st12.yimg.com/us.st.yimg.com/I/thehumansolution_2020_3491616
alt text http://us.st12.yimg.com/us.st.yimg.com/I/thehumansolution_2016_1198996
Just an advice. I was also suffering from the RSI symptoms, up to the shoulders. I've tried MS and Logitech ergonomic keyboard without succes. It was even worth than before because the mouse was more distant than before.
Then I founded the TypeMatrix Keyboard and it reduce my RSI to nearly nothing.
Unfortunately, they are hard to found for non US nor Canada citizens.
(source: typematrix.com)
In line with Joel Coehoorn's suggestion, I find that a trackpoint (aka "nipple") is even more ergonomical than a touchpad. Lenovo's USB Keyboard with UltraNav has both.
My mouse usage is minimal, though, because I focus on using the keyboard for everything. This might not be easy in your particular development environment.
(source: ibm.com)
A few years ago I had wrist problems, too.
What worked for me was changing my posture, how I hold myself, my arms. I move my keyboard and mouse around, I change my position and the position of those two.
Additionally I use keyboard shortcuts a lot to not overuse the mouse.
This way I got rid of my wrist problems without replacing keyboard or mouse.
As a fellow RSI suffer, I hope one of these helps out.
The ErgoMagic and ErgoFlex keyboards are split into 3 sections, and you can position the number pad in the middle.
The ErgoFlex is a flat design:
http://www.safecomputingtips.com/blog/ergonomic-keyboard/ergoflex-keyboard/
http://www.comfortkeyboard.com/keyboards_ergoflex.html
(source: safecomputingtips.com)
The ErgoMagic has adjustable tilts for each section:
http://www.comfortkeyboard.com/keyboards_ergomagic.html
(source: comfortkeyboard.com)
I did try a PCD Maltron keyboard for a while when I was having some problems with referred pain, but I never really got used to it. I'm left handed, so my mouse is quite close to the keyboard. If you're having trouble with your mouse being too far out to the right you could try a small footprint keyboard such as a Happy Hacking Keyboard and a Separate Numeric Pad on the left or somewhere else to get a more clement key layout.
I also learned to use a mouse with both hands - you might also try learning to use a mouse left-handed.
alt text http://www.maltron.com/images/keyboards/maltron-usb-dual-l90-uk-mac-qwerty-gray-1-600.jpg
(source: geekstuff4u.com)
The main problem about keyboards is not the keyboard layout or form factor, the main problem of keyboards is the layout. I had really strong RSI problems, to the point I could barely type (only by when accepting major pain!) for two weeks. I couldn't touch a keyboard for 3 weeks till it finally got better. After that the problems always came back every now and then. I tried different keyboards as well. I have a GoldTouch split keyboard, a Microsoft Natural split one, I have even the TypeMatrix one that gizmo mentioned, but it all helped little.
Then I discovered the Dvorak layout. At first I thought it's a silly idea, but I took that route. It was a hard training and it took me quite a long time, but now it's the only one I keep using, as it's the only one I can type on for ours without any RSI symptoms. At first things seem to have gotten worse, but that's only because a new layout will lead to new finger movements.
Recently I found out about Colemak, another alternative to QWERTY, it seems even more promising than Dvorak; I'm just trying to learn it... and I have a hard time again.
Another thing that helped me much more than replacing the keyboard is replacing the mouse. I'm not using a mouse any longer, I'm using a trackball.
(source: arstechnica.com)
And after I tried plenty of keyboard (I have more than 20 at home, no kidding!) I stayed with the Microsoft Natural 4000 keyboard. It might be huge, but I can type very well on it.
I don't know of any keyboards like that, but what might help is a keyboard with a built-in touchpad (like for a laptop) that you can use instead of your other mouse for some of your mousing: small adjustments, quick taps to click, etc, to avoid having to go out to the mouse.

Resources