Live data from Hacker News

Vim Foot Pedal

hackaday.com

121–130 of 134 posts

Re: Vim Foot Pedal

#121
My setup is quite unusual in that I VNC into Linux over Samsung DeX. After working around its annoying unchangeable keybindings, I remap the keys back as they should be on the Linux side with xmodmap. But then it seems to only change keycode and not keysym or something, so many programs don't respect that (vim included). I can't get rid of the muscle memory for Esc, no matter how much I tried to use Ctrl+[ or jj or similar, so I use xte to simulate a key press which is slooow when you're really going fast. If anyone has any ideas on how to get around this please lmk!

Re: Vim Foot Pedal

#122
post #22

I resolved this pain by making the Caps Lock key work as it should: tap for “Esc” and hold for “Control”. Then I took the Escape key and made it Caps Lock—it’s occasionally useful, but not nearly enough to warrant a home row position. You can do this with Karaniner Elements on macOS. There’s a way to do it on Windows too, but how escapes me at the moment.

You can do this in QMK too if you have a custom mechanical keyboard. It'll work regardless of machine or os then.

I think a custom mechanical keyboard is going to be much nicer than a foot pedal.

Though, I'd encourage a custom keyboard where the thumb can reach 2-3 keys each (instead of only really being able to hit the spacebar). That way, you can put Esc on a thumb key. -- e.g. ZSA's moonlander or planck ez are nice.

Re: Vim Foot Pedal

#123

FTA: “Plus, there’s some ergonomic benefits to not having to strain one’s hand over to reach the ESC key.” Honest question: Is it that uncommon knowledge that Ctrl+[ is equivalent to ESC in vim default keybinds?

It’s equivalent in any terminal, not just in vim. ASCII “control” characters are paired up nicely with the letters and punctuation on a keyboard. Instead of having a key for each letter and another key for each control code, the control code can instead be typed by holding the control key and pressing the equivalent letter. This is why it is called the control key. The pairings are offset by 0100 in octal. The octal…

>Some other common ones are: line feed/^J, backspace/^H, tab/^I, and end-of-transmission/^D. If you ever type “exit” to end a shell session you can do the same with ^D.

Yes. Also line feed/^J, form feed/^L, carriage return/^M.

And, related: anyone not knowing the basics of vi, can check out my vi quickstart tutorial below. I had first written it at the request of two Windows sysadmin friends of mine, in a company where I was working at the time. They had been given additional charge of two Unix boxes and I wrote the tutorial to enable them to hit the ground running with common sysadmin editing tasks. After reading it and using Unix for a few days, they told me that it was useful and met their need.

The tutorial is small, so it can be read soon and you can start applying it right away:

https://vasudevram.gumroad.com/l/vi_quick?layout=profile

Re: Vim Foot Pedal

#124
post #41

Earlier quoted context omitted.

> Besides, everyone knows what Ctrl is the One True Key™ in place of the Caps Lock and that only degenerate infidels map it to anything else. Haha yeah I've heard about that and I like the joke =) But I was never interested in adopting it. Because I configure my alt keys to act as ctrl keys which imo results in a much more ergonomic setup. Ctrl is the most pressed control key for people like me who live in the termin…

I always wondered why people are finding it so hard to hit control. And then realized I've been using ThinkPad for 25years which has control closer. Maybe it's not as insane choice / change as I always thought!

That makes sense but I think it's still ergonomically incomparable to having ctrl right next to my thumb. At least for me who use it so very frequently.

Re: Vim Foot Pedal

#125
post #22

I resolved this pain by making the Caps Lock key work as it should: tap for “Esc” and hold for “Control”. Then I took the Escape key and made it Caps Lock—it’s occasionally useful, but not nearly enough to warrant a home row position. You can do this with Karaniner Elements on macOS. There’s a way to do it on Windows too, but how escapes me at the moment.

I did the same thing, but also mapped Caps Lock to Cmd+Shift+Ctrl+Option (so-called Super key) when it's pressed together with another key. Useful for application switching and other custom stuff.

Re: Vim Foot Pedal

#126

Earlier quoted context omitted.

> Most vim users swap esc with caps lock anyway "Some", sure, but "most"? Not so sure about that. Besides, everyone knows what Ctrl is the One True Key™ in place of the Caps Lock and that only degenerate infidels map it to anything else.

That, and "inoremap jk ".

Better is "inoremap fd " especially if you ever try to type Dijkstra or the alphabet.

Of course now you have to call your file descriptor something else. No free lunches.

Re: Vim Foot Pedal

#127
post #22

I resolved this pain by making the Caps Lock key work as it should: tap for “Esc” and hold for “Control”. Then I took the Escape key and made it Caps Lock—it’s occasionally useful, but not nearly enough to warrant a home row position. You can do this with Karaniner Elements on macOS. There’s a way to do it on Windows too, but how escapes me at the moment.

is a native remap to Esc btw

But it doesn’t work globally in the OS. It’s nice to casually mash capslock as esc to get out of modals and such all over the OS, even in games.

Re: Vim Foot Pedal

#128
post #82

Earlier quoted context omitted.

You can do the simple remapping. The “tap for escape, hold for control” takes additional software.

Here's a summary on how to do it on the respective OS's https://gist.github.com/tanyuan/55bca522bf50363ae4573d4bdcf0... It's an interesting concept. I have been using capslock as control for so long that I don't know I could get used to this though.

To be clear, that link shows how to use extra software to do it in each OS including Karabiner on macOS.

Re: Vim Foot Pedal

#129
post #22

I resolved this pain by making the Caps Lock key work as it should: tap for “Esc” and hold for “Control”. Then I took the Escape key and made it Caps Lock—it’s occasionally useful, but not nearly enough to warrant a home row position. You can do this with Karaniner Elements on macOS. There’s a way to do it on Windows too, but how escapes me at the moment.

I feel like people who think the "CTRL" key goes on the home row never pressed CTRL+Z, CTRL+X, CTRL+C or CTRL+V in their entire lives. Makes zero sense ergonomically to put the CTRL key on the home row. I tried it for about 0.05 seconds and after pressing CTRL+Z one time I knew it was not a good idea for me. pinky finger does not like pressing a key while being on a higher row than another finger also pressing a key.…

I just naturally used my ring or middle finger to press capslock in those cases. If you like the idea, then maybe stick with it longer than <1 sec. ;)

Re: Vim Foot Pedal

#130
post #22

I resolved this pain by making the Caps Lock key work as it should: tap for “Esc” and hold for “Control”. Then I took the Escape key and made it Caps Lock—it’s occasionally useful, but not nearly enough to warrant a home row position. You can do this with Karaniner Elements on macOS. There’s a way to do it on Windows too, but how escapes me at the moment.

I did and still comfortable with the following YMMV. Alt -> Ctrl Ctrl -> Alt Caps -> Esc Esc -> Caps
Post reply on HN