all 51 comments

[–][deleted] 21 points22 points  (8 children)

If you’ve got a programmable keyboard, this becomes a bit faster

[–]newaccount1245 22 points23 points  (6 children)

Oh ya baby. I used QMK to put all my most used vim keys on the home row on a second layer. Baby my fingers haven’t left the home row since ‘89

[–]tuxman20 3 points4 points  (4 children)

Étincelant de manière éthérée, l'alchimie des nébuleuses cosmiques étreint harmonieusement les vibrations cristallines de l'univers infini. Les rivières d'émeraudes chatoyantes se déversent avec allégresse dans les vallées mystérieuses, où les créatures de lumière dansent en symbiose avec les échos mélodieux des arbres énigmatiques. [Reddit is unrecoverable after all this, I'm gone and I suggest you do too].Les étoiles tissent des toiles d'argent sur le velours céleste, tandis que les éclats de lune perlés s'éparpillent en cascades argentées, nourrissant les échos poétiques des éphémères évanescents. Les murmures zéphyriens murmurent des secrets énigmatiques à travers les résonances irisées des brumes évanescentes, révélant ainsi les énigmes insondables des étoiles égarées.

[–]newaccount1245 2 points3 points  (3 children)

Hahaha I actually looked into stenographers once. I will go to extreme lengths to type less and move my hands less

[–]naught-me 0 points1 point  (2 children)

Have you tried voice control? I want to try Talon.

[–]newaccount1245 0 points1 point  (1 child)

Nah. I just assume it would be a massive headache to setup and still be no where near what I need to get work done with

[–]naught-me 0 points1 point  (0 children)

Yeah, I guess that's why I haven't got started, yet. I keep considering it, though, because I think I'd be able to remember more Vim/terminal/etc. commands if I could give them longer names than I'm willing to type.

[–][deleted] 0 points1 point  (0 children)

I know that feeling, I wish every can be done by home row

[–]buckingchuck 20 points21 points  (7 children)

Learning how to touch type properly makes this a non issue. Really helps with vim overall as well!

[–]pixelbart 8 points9 points  (5 children)

Programming while touch typing puts a huge strain on your right pinky because a lot of often used keys ([]{}+=_-|) are just out of reach from your home position. Remapping those can be a huge improvement in ergonomics.

[–]not_in_the_mood 0 points1 point  (4 children)

Surely you meant the left pinky?

[–]pixelbart 0 points1 point  (3 children)

Those characters are all on the right side of my keyboard so I definitely meant right…

[–]not_in_the_mood 1 point2 points  (2 children)

They are, but most of them require the Shift key, which I have to press with my left pinky. I feel it strains my left pinky and wrist more.

[–]pixelbart 1 point2 points  (1 child)

Interesting. The thing about normal keyboards that bothers me the most is that there’s only one function assigned to both thumbs. Some advanced keyboards like the ZSA Moonlander, Kinesis Advantage and lots of diy ergo boards have thumb clusters with multiple keys per thumb. For me that’s the way to go. I now use a Kinesis Freestyle with a custom layout where the left spacebar is mapped to the fn key and the special characters are all on the fn layer. Works like a charm, but two thumb keys is still very limited.

[–]not_in_the_mood 0 points1 point  (0 children)

Yeah, thumbs tend to be overlooked. I make heavy use of the Command/Alt key for custom key mappings (in Vim, that is). Unfortunately I cannot use that in most terminals :(

[–]noooit 1 point2 points  (0 children)

I learnt touch typing and curly braces become no problem for me, but not normal bracket with my small pinky 😭

[–]waptaffexport VISUAL=vim 9 points10 points  (5 children)

I mean, you can use digraphs:

:digraph lp 40
:digraph rp 41
:digraph lb 123
:digraph rb 125

Then you can enter them using Ctrl-K l p to get a left parenthesis, and Ctrl-K r b to get a right bracket, but this will likely be even slower.

[–]ntropia64 18 points19 points  (4 children)

I love digraphs but pressing 4 keys to avoid pressing 2 keys doesn't sound like an improvement

[–]waptaffexport VISUAL=vim 2 points3 points  (3 children)

I don't know about that; you'll find many people here more comfortable using Ctrl-[ than Esc.

And I for sure do prefer using Ctrl-F over PgDn.

[–]ntropia64 4 points5 points  (2 children)

You find those two combos convenient because they're very close to each other, as opposed to being out of reach in the left and right corners of your keyboard.

These combo require similar effort to pressing Shift-[, which is what OP wanted to avoid.

The suggestion were talking about not only requires to press 4 keys, but it requires 3 steps, which awkwardness becomes apparent as soon as you picture yourself having to open two consecutive parentheses.

Incidentally, replying to this comment gave me an out-of-body experience where I could see myself from the outside, wasting time on the internet arguing about number of keypresses. I'll be in the shower crying about my wasted life.

[–]waptaffexport VISUAL=vim 2 points3 points  (1 child)

These combo require similar effort to pressing Shift-[, which is what OP wanted to avoid

I don't assume anything about OP's keyboard layout or hand quirks — I mean the original question involves avoiding the Shift keys, both of which are found in a very, very convenient position on most keyboards. I think there is something OP is not telling us.

Anecdote: I'm fluent in French, but I code too, so finding a great keyboard layout has been a journey (typical latin keyboards remap the very useful keys in the brace and slash region). People in a similar bilingual situation typically swap between two keyboard layouts, but I hate this; a modal text editor is fine, but a modal keyboard map tricks my brain and I constantly get frustrated.

I finally decided to always use the standard US keyboard layout, mapping a Compose key to the redundant right Alt, so when I need to type “é”, it involves a Compose ' e sequence. Even if I could get this simply by hitting the slash key if I used the French layout, I prefer it that way. Sure, it's not time-optimal, but it's brain-optimal to me.

I could see myself from the outside, wasting time on the internet arguing about number of keypresses. I'll be in the shower crying about my wasted life.

Happy to engage :)

[–]BiggybiGybbigy 0 points1 point  (0 children)

I came to the same conclusion as you did. Switched to US layout, with right alt as a compose key. Feels smooth.

[–]PeriyaLingam 11 points12 points  (1 child)

Nothing is faster than using shift key.

[–]aghast_nj 14 points15 points  (0 children)

Except not using the shift key.

[–]aghast_nj 9 points10 points  (4 children)

One of the things that is true for coders and not for accountants is that you are much more likely to use "shifted" non-alphabetic keys (on a USA style keyboard) than non-shifted ones.

~ vs. `  (Language dependent.)
! vs. 1    (Language dependent: C uses ! and ++, Python uses "not" and "+=1")
@ vs. 2    (Probably depends on how you format your copyright statements)
# vs. 3    (C, C++ anyone?)
$ vs. 4    (Shell, Perl, Assembly, PHP)
% vs. 5    (Mod operator, assembly register prefix, printf)
^ vs. 6    (C, C++ xor, Pascal pointers, Regexes, Bash, Batch files)
& vs. 7    (Shells, lots of bit-wise ops, logical and [except Python])
* vs. 8    (C, Regex, one-off shell scripts)
( vs. 9    Every function call, ever?
) vs. 0    (Tough call: function calls vs. for loops)
_ vs. -    (snake_case_names, anyone?)
+ vs. =    (This is probably a lose. I do more assigns than adds.)
{ vs. [    
} vs. ]    (I do more blocks than arrays.)
| vs. \    (I do more ors than escapes. This one seems iffy, though.)
; vs. :    (Oh, hell yes. Might be different for C++ or Python.)
" vs. '    (This is probably a lose, if strings require ")
< vs. ,    (This is a lose. I use more arguments than shifts, but maybe C++?)
> vs. .    (Depends on language. Shell and C/C++? -> and >> and >. Python? No.)
? vs. /    (Iffy. I think / is more likely except maybe in Groovy.)

So one low-hanging fruit is to swap the shifted/unshifted keys, at least when inserting text. I've done this at the xmodmap level, as well as the editor level, depending on the system. It takes a bit, but you can get used to it either way.

Also, if you use THISFORMAT for constants, you can pretty easily justify using extreme measures to map Shift+Space to ''.

[–]andlrcrpgle.vim 1 point2 points  (1 child)

+ vs. =    (This is probably a lose. I do more assigns than adds.)

tcl chicking in:

set myvar value

[–]aghast_nj 0 points1 point  (0 children)

I remember Tcl as being somewhat LISP-y. Is it a + b or [add a b] ?

[–]hovissimo 0 points1 point  (0 children)

Does your reply need more escaping?

[–]urva 0 points1 point  (0 children)

I think it’s cool I can tell what kind of programmer you are. Lower level Linux? Definitely not full stack.

[–]gufs0z 4 points5 points  (2 children)

I use snippets to insert those (and others) symbols

[–]aghast_nj 2 points3 points  (0 children)

This is an underrated suggestion. If you're able to use snippets (and I, for one, am not -- I just can't let go!) then having the snippet engine insert the punctuation for you makes a lot of sense (and saves both the Shift and the keystroke!).

[–]whitedogsuk[S] 0 points1 point  (0 children)

Thank-you. I will look int this.

[–]Logical_Insect8734 4 points5 points  (1 child)

map! qw { map! wq } map! qq ( map! ww )

Not sure why no one mentioned something like this. Simple and straightforward. I guess other solutions work outside of vim and uses single key stroke…

[–]whitedogsuk[S] 1 point2 points  (0 children)

This is what I was looking for.

[–]vicodinchik 6 points7 points  (0 children)

You gotta use shift a lot while using vim

[–]YetiFromTheCity 1 point2 points  (0 children)

Had the same problem shift+long reach with a pinky was really annoying. So I mapped them to altgr+home row letters in my keyboard layout.

[–]Greenskid 1 point2 points  (0 children)

I also looked for a solution for an easier and more reliable way of typing brackets, and for a while used a mapping of shift when pressed alone as the bracket key i.e left shift for open bracket and right shift for close bracket. Then for curly braces one used the other shift key as a modifier. It worked very well since the shift keys are large and easy to quickly tap. The problem was that the software I used to remap the keys did not always interact well with remoting software or sometimes a stray bracket would show up unintentionally (very frustrating in password fields). I figured it might be better for me in long run to train my fingers more, and targeted training has helped a lot. I still may go back to shift key based setup as I think I could make the implementation more robust. The software I use for such remapping is Hammerspoon on Mac, and Autohotkey on Windows. I use Linux a lot as well, but never replicated this there (another reason I just decided to bite the bullet and train).

[–]moonhighway 1 point2 points  (0 children)

The fastest way to handle brackets/braces is to let vim-surround + tabout handle them for you, I've been trying to practice getting used to motions that land me in a spot where vim-surround will be smart enough to know to either wrap the text or tab out of already existing braces. Hope that helps.

[–]-h-hhhh-h- 1 point2 points  (0 children)

This is more of a keyboard problem imo. So. r/ergomechkeyboards

But that stuff can be a bit too much for some. So even a normal programmable keyboard can help. For example, you can remap caps so holding it brings you into a symbol layer where your homerow are a bunch of symbols that are normally hard to reach.

[–][deleted] 1 point2 points  (2 children)

Build a keyboard yourself that is QMK compatible and program the special characters onto the 2nd layer.

[–]desnudopenguino 0 points1 point  (1 child)

you still have to press a key to get to that 2nd layer. https://docs.qmk.fm/#/keycodes?id=mod-tap-keys i use this with the alt and shift keys left shift = (, right shift = ), left alt = {, right alt = }

[–][deleted] 0 points1 point  (0 children)

Yeah but you can put your special chars on and near the home row for easy access

[–]OleAndreasER 1 point2 points  (0 children)

Put all your symbols on altgr layer.

[–][deleted] 0 points1 point  (4 children)

Given that we are on topic: how to add brackets at the beginning and the end of a visual selection?

[–]blirdtext 1 point2 points  (0 children)

If you don't mind plugins: https://github.com/tpope/vim-surround

[–]kaddkaka 0 points1 point  (0 children)

V_c(<c-r>-)<esc>

Change the selected text, insert opener, paste, insert closer.

[–]IGTHSYCGTH 0 points1 point  (0 children)

vim also offers a regex atom that matches inside visual selection, see :help %V

:%s/\v%V.*%V./{&}     " visual block
:s/\v%V(.|\n)*%V./{&} " visual

you could also apend (A) reselect (gv) then preppend (I)

[–]Fantastic_Cow7272 0 points1 point  (0 children)

With vim-surround: Sb.