[HN Gopher] Vim Foot Pedal
___________________________________________________________________
Vim Foot Pedal
Author : tomerbd
Score : 82 points
Date : 2022-12-17 08:25 UTC (1 days ago)
(HTM) web link (hackaday.com)
(TXT) w3m dump (hackaday.com)
| _def wrote:
| I love it. Some months ago I had a Bluetooth pedal with several
| footswitches. It could be used as a keyboard. I thought about
| mapping it to a step debugger :D
| baumschubser wrote:
| I love the creativity in the comments to address this ,,problem"
| if you want to call it that. A couple of years ago I made a
| software-only thing to trigger two alternating key sequences
| (e.g. Esc and i) by pressing down one of those cheap USB pedals.
| A little bit hacky but it works.
| https://github.com/baumschubser/footswitcher
| easygenes wrote:
| 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?
| bornfreddy wrote:
| This person here didn't know. Thank you, need to try it out.
| keybored wrote:
| There is no reason to assume that people don't know of it
| simply because they don't use it.
|
| For me: annoying to use a modifier for a common key + doesn't
| work on my keyboard.
| systemvoltage wrote:
| I wanna see a double-eye-blink detection for ESC key in vim.
| Super easy (try it!) and very natural. Probably straight forward
| to detect 2 rapid eye blinks using a cheap webcam + CV.
| lawn wrote:
| It's a fun idea, but I'd imagine it's far too slow to press down
| your foot compared to tapping your fingers.
|
| I personally use a home-row combo as escape, by pressing down the
| left index and ring finger at the same time.
| [deleted]
| keybored wrote:
| > Plus, there's some ergonomic benefits to not having to strain
| one's hand over to reach the ESC key.
|
| Doubt. I simply move my hand. There is no strain.
|
| Gross movement is not unergonomic.
| lcuff wrote:
| Sexy idea, but as someone who started using vi in 1987, a
| software solution seems way better. I map the seldom-otherwise-
| used key sequence jk to <ESC>. If I were doing it over, kj would
| be slightly better, for times when I am Just Kidding. I do this
| in both .vimrc and .inputrc (using different syntax, sigh). My
| fingers generate the escape without thought. (As is true for tons
| of vim normal mode actions I use regularly.)
| Lio wrote:
| Nah, that's not the way. If you go that route it'll only work
| in Vim itself and not other programs with a vi-like interface.
|
| Better to map caps to ctrl and build up the muscle memory to
| use ctr-[
|
| If you do that you also get easy access to all those other
| Insert mode ctrl shortcuts.
| toxik wrote:
| Both jk and kj appear in normal writing for me :(
|
| I briefly considered a foot pedal but it seems to me that foot
| dexterity is far lower than finger, meaning typing ihello<esc>
| is FAR faster than <pedal down>hello<let go>, not to mention
| that pedal travel is way longer.
|
| Of course you map esc to caps.
| [deleted]
| blumomo wrote:
| Ready made for use: https://kinesis-ergo.com/foot-pedals/
| danschumann wrote:
| I remapped pressing jk kj kk jj to escape. As a regular vim user,
| only sometimes do I actually press i to insert, usually it's cw,
| a, s, etc.
| cristoperb wrote:
| I wrote a post a while ago about getting an inexpensive three-
| button foot pedal to work under Linux.[1] I have the different
| buttons mapped to different keys in Xorg (which can then be
| mapped to any commands in .vimrc), but I'm not sure how to map
| the keydown and keyup events to different keys so that the
| "clutch" behavior can be implemented in software only.
|
| 1:
| https://catswhisker.xyz/log/2018/8/27/use_vecinfinity_usb_fo...
| zwayhowder wrote:
| Until I switched to a kneeling chair I had a 3 button foot
| pedal under my desk. I programmed it with
| https://github.com/rgerganov/footswitch and it worked an
| absolute treat. As an i3 devotee it was even more special.
|
| It didn't support up/down events but that was ok for me.
|
| For me the mapping was: button 1 i3 workspace back_and_forth.
| button 2 exec a floating urxvt terminal. button 3 i3-lock.
| TheLocehiliosan wrote:
| I swear sometimes I feel like I'm the only person in the world
| that thinks hitting the ESC key is easy and no big deal.
|
| Maybe it's decades of doing it, and I don't consider myself
| especially dexterous, but I never have any problem with it.
| the_third_wave wrote:
| You're not alone, it is one of the easiest keys to hit since it
| lies all by its own in a corner with no danger of hitting any
| other keys when whacking it with whatever finger - or
| combination thereof - is at hand. To be honest I had to guffaw
| a bit at the rationalisation for using a foot pedal:
|
| _The basic concept was to use a pedal to enable switching
| between normal and insert modes. In Vim's predecessor, vi,
| switching modes was easy, with the ESC key located neatly by
| the Q on the keyboard of the ADM-3A terminal. On modern
| keyboards, though, it's a pain, and so a foot pedal is a
| desirable solution._
|
| So let me get this straight... it is easier to blindly grope
| for a foot pedal somewhere under a desk than it is to hit that
| very visible, very close-at-hand key on the keyboard with
| whatever appendage happens to be closest? Of course it isn't,
| this is just rationalisation for making that foot pedal - as if
| any reason is needed to indulge in such projects other than
| 'because I (want to find out if I) can'.
| agrippanux wrote:
| It wasn't that easy on the ill fated Touch Bar, which prompted
| my move to Caps.
| gwn7 wrote:
| Agreed. Most vim users swap esc with caps lock anyway, making
| it even easier to reach.
|
| I don't think pedals bring any significant ergonomic benefit,
| but pedal setups look cool nonetheless.
|
| Swapping keys isn't interesting and you can't write a blog post
| about it.
| Beltalowda wrote:
| > 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(tm)_
| in place of the Caps Lock and that only degenerate infidels
| map it to anything else.
| cbm-vic-20 wrote:
| That, and "inoremap jk <Esc>".
| galangalalgol wrote:
| My personal heresy is: ino jj <esc>
|
| I like it because my fingers never leave the home row.
| gwn7 wrote:
| > Besides, everyone knows what Ctrl is the One True Key(tm)
| 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 terminal. But the default placement of the ctrl
| keys in modern layouts is so wrong. I have never understood
| it. I guess there has to be a historical reason but I've
| yet to find out. (Help me, greybeards)
|
| I should't have to move my hand and strain my pinky to
| reach out the most pressed control keys. With alt it's so
| much easier. I don't have to move my hands nor use my
| pinkies. My thumbs already rest on the spacebar and I just
| have to make a little thumb movement.
|
| Swapping ctrl with caps lock is an ok remedy but alt keys
| are in a much better place.
|
| So ctrl goes where alt is by default.
|
| But do I swap ctrl with alt? No!! Alt is a frequently used
| key as well so the default ctrl keys aren't a good fit for
| alt either. Instead I set the keys immediately adjacent to
| the default alt keys to act as alt. It's the Super key
| (sometimes referred as the "Windows" key) on the left side
| and the context menu key on the right.
|
| Lastly, I set the default left ctrl key to act as Super and
| the right ctrl key to act as context. Because I virtually
| never use those.
|
| (I think Apple got this mostly right. cmd is the most used
| control key for the average Apple user, and opt is next.
| Their placements are perfect. Though it's still problematic
| for developers as ctrl is again at the worst place
| possible. Because of that, what I do in Macs is swapping
| ctrl with cmd while leaving opt where they are.)
|
| If I'm an infidel for doing this so be it. But with this
| setup, I'm extremely efficient one. I type and code and
| enter & exit from repls and jump between interfaces like a
| damn machine, impressing mostly everybody who watch me use
| my computer.
|
| Ergonomics FTW
| NikolaNovak wrote:
| 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!
| polyamid23 wrote:
| > Ctrl is the most pressed control key for people like me
| who live in the terminal. But the default placement of
| the ctrl keys in modern layouts is so wrong. I have never
| understood it. I guess there has to be a historical
| reason but I've yet to find out. (Help me, greybeards)
|
| I've seen this talk here and the speaker mentioned the
| ADM-3A (that is also mentioned in the article itself)
| terminals at about the 17/18 minute mark. Mind the
| keyboard layout :)
|
| https://jackrusher.com/strange-loop-2022/
| https://en.m.wikipedia.org/wiki/ADM-3A
| Beltalowda wrote:
| I actually don't really care, although trying the
| "regular" Ctrl on my laptop feels odd, but I'm also not
| used to using it.
|
| It's just what I'm used to. I grew up on the MSX which,
| like many keyboards of its day, had Ctrl where we now
| have Caps Lock. When we upgraded (well, "upgraded") to
| Windows 95 I found some hack to make CapsLock behave like
| Ctrl because I was so used to it. Later I started using
| Linux and BSD and of course carried over the mapping with
| xmodmap. I've never really known anything else than Caps
| Lock being Ctrl.
|
| Another oddity from my MSX days that took me years to get
| rid of was that a line would only be saved if you pressed
| "enter" at the end of it. That is, if you were editing
| some file, went up a line, edited it, and then just went
| down a line (without pressing enter) it wouldn't actually
| get saved. It took me quite a long time to get rid of the
| habit of "End + Enter" to make sure the line got saved
| (which wasn't needed on any other system I've used).
| kfajdsl wrote:
| Emacs pinky isn't really a problem if you don't use Emacs
| keybindings ;)
| atrettel wrote:
| I tend to use escape in most circumstances, but I am
| increasingly partial to Ctrl-[ when using certain keyboards
| where the escape key is a bit too far for me. It's another
| option that's always available by default.
| cristoperb wrote:
| Ctrl-[ is so ingrained in my muscle memory that even when I
| finally mapped capslock to esc I still never use it.
| LAC-Tech wrote:
| I think a lot of keyboard ergonomics comes down to the facts
| that some people do anything to avoid moving their hands, and
| others don't.
|
| If you don't move your hand, you'll have to stretch your
| fingers, and might be better suited to a minimalist keyboard
| with function layers.
| pengaru wrote:
| For ages I lived with X40 and X60 form-factor ThinkPads, which
| have perfectly sized keyboards for my hands. The ESC key is
| easily accessed on these for me without leaving home row
| placement, palms comfortably planted.
|
| Every ThinkPad I've had since then has been a regression in
| this department, beginning with the X201s and now I'm on an
| X230 and my typing is awful compared to the 4:3 X-series glory
| days. Reaching for the ESC key is noticably annoying compared
| to what I know so well to be the ideal. Why Lenovo kept
| stretching the keyboard to accommodate their widescreen
| transition instead of relocating better speakers to the
| keyboard flanks is beyond me.
|
| But having suffered through this mess I fully understand why
| vi(m) users remap ESC to CAPS or pursue other mitigations. ESC
| key access is highly sensitive to keyboard-size:hand-size, and
| I suspect for many it's just inconveniently distant like my
| X230 is for me.
| rendall wrote:
| `Ctrl-[` works like escape in vanilla Vim. I prefer it because I
| don't have to lift my hand from the keyboard, unlike hitting
| escape
| pkkm wrote:
| My preferred solution is to map Caps Lock to Control, then map
| Control-Space to exiting insert mode in Vim. That way, I get
| improved convenience both in Vim and in other programs, such as
| the shell and web browsers.
| wardedVibe wrote:
| I actually bought one a while back for the emacs metakeys issue
| which had 4 buttons (it was originally designed for turning pages
| on a pad while playing music). It worked pretty well while it
| lasted, but broke after like a year.
|
| Having a qmk split keyboard (the iris specifically
| https://keeb.io/collections/iris-split-ergonomic-keyboard) was a
| more lasting solution that also solved some other ergonomic
| issues. Now my thumbs do more than just thonk the space bar.
| Control, shift, space, meta, backspace/delete, enter alt and esc
| are now done by thumbs instead of pinkies.
| photochemsyn wrote:
| I think resourcing foot pedals from the music world (guitars
| and bass mostly) would be the way to go, they're designed for
| heavy use and would likely be much more durable.
| Galicarnax wrote:
| I have remapped caps lock on my keyboard to Esc, so it works
| everywhere, not only for Vim. Very convenient, symmetric to
| Enter. I hardly ever need caps lock as such.
| Galicarnax wrote:
| The only downside is that it's a pain to work with a regular
| keyboard due to muscle memory. Though that doesn't occur often
| in my case.
| teeray wrote:
| 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.
| johannes_ne wrote:
| Kmonad for Linux
| agrippanux wrote:
| Switching ESC to Caps Lock took significantly less time to
| retrain muscle memory than I expected.
| Sirened wrote:
| On macOS you can do this using just the stock OS. It's under
| keyboard settings. You can also do this on iOS, it's awesome if
| you have a physical keyboard and like to use vim on your iPad
| jack_the_dev wrote:
| I don't know what's cooler. This setting in MacOS / iOS or
| having a dedicated foot pedal to press "i" or "esc"
| keybored wrote:
| Tried that some years back. Or the simpler version where it is
| just Control. Didn't work I found out because I was using my
| pinky to activate a very common modifier key. It was
| uncomfortable. I ended up remapping caps lock to Ctrl-C.
|
| I just use the good old control keys now. Either by using my
| palm or (more commonly for the left one) the last knuckle of my
| pinky finger.
| xigoi wrote:
| I think AutoHotkey would be the program to use on Windows?
| pletnes wrote:
| I'd recommend Power Toys for that. AHK is cool but better for
| scripts and automations. Power Toys has lots of other neat
| functions and support by MS.
| [deleted]
| woleium wrote:
| Karabiner elements*
| seri4l wrote:
| https://gitlab.com/interception/linux/plugins/caps2esc
|
| Works great in Windows and Linux.
| cramjabsyn wrote:
| Or switch to a sun keyboard where this was the native layout
| nsb1 wrote:
| Someone long ago, probably here, suggested binding the sequence
| 'K-J' to 'ESC'. Now I don't even have to take my fingers off the
| home row.
| xigoi wrote:
| If you're going to do this, I recommend mapping both jk and kj,
| so you can just mash the keys simultaneously.
| RileyJames wrote:
| I recently took on pedal steel guitar. Which has both foot pedals
| and knee levers. Along with both hands (plucking and barring
| chords).
|
| It's really changed the way I think about input methods. Pedals
| have always been a thing, but primarily for effects, not part of
| inputting notes. Those lazy knees weren't doing anything!!
| samus wrote:
| Using Emacs on contemporary keyboards causes similar problems
| because the Ctrl key used to be in a much more convenient
| location. I have had good experiences switching the left side Alt
| and Ctrl keys to remedy the problem. But the foot pedal is almost
| more elegant.
| chrisprice wrote:
| Just for a little bit of context lost in the HAD summary, this
| was not a serious build!
|
| > ... what better way to show my appreciation to an infrequent
| Vim user, than to add another rarely useful peripheral to their
| bag!
|
| > ... As much as I built the pedal for a joke, I can't deny that
| there is something very satisfying about using it.
| 0x008 wrote:
| When reading all these recommendations, I wonder why nobody is
| using ctrl-c to exit insert mode..?
| xigoi wrote:
| It behaves differently than Esc.
| logical_proof wrote:
| I am also curious as to how. I have been using CTRL-c for
| quite some time and even remapped sublime vintage mode to use
| it on Windows when I am. It using Vim.
| xigoi wrote:
| See my reply to the other comment.
| 0x008 wrote:
| How?
| xigoi wrote:
| 2ix<esc> inserts "xx"
|
| 2ix<c-c> inserts "x"
|
| Also, <c-c> does not trigger InsertLeave.
| freedomben wrote:
| Dang that's a great idea. C-c C-c for me triggers vim slime,
| but the semantic of using it to exit insert mode might warrant
| a change
| tipsytoad wrote:
| Map holding caps lock to control and esc on tap, you never use it
| anyway :)
| hxugufjfjf wrote:
| Correct answer. This is one of the few defaults that makes
| sense to change as it can be done at the OS level, which will
| then be inherited to the tens of different systems i use vi on
| a day.
| ironmagma wrote:
| For me, caps lock is no better than ctrl. There's only one,
| meaning key combos on your left require stretching your 4th
| (pinky) finger out. I caused permanent damage to my 4th finger
| that way. Do not recommend.
| samus wrote:
| OS offer emulating Caps Lock by pressing both Shift keys, no?
| This would be a solution for people who HAVE TO WRITE UPPERCASE
| A LOT for some reason.
| djha-skin wrote:
| I would love to use something like this to get back on emacs, but
| it doesn't travel well. I'm on the bus, I'm at a friend's house
| or my mother-in-law's house or my brother's house all the time
| with my computer open. I don't want to be tied down to a specific
| device or get out a foot pedal on the bus every time I want to
| program.
___________________________________________________________________
(page generated 2022-12-18 23:00 UTC)