13 ms·
Vim Foot Pedal
- easygenes 4y agoFTA: “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 4y agoThis person here didn't know. Thank you, need to try it out.
- keybored 4y agoThere 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.
- Jedd 4y agoYup, this is what I've been using since I started with vi[m] (~30 years ago). It's pure muscle memory after the first week or two, is obviously faster than fumbling around for ESC (which may move slightly between keyboards). It works on every terminal, also on every keyboard, doesn't require customisation of your vim environment (compare to remapping CAPSLOCK) which is highly preferable if you're moving between ephemeral hosts and/or hosts you don't own or can't conveniently customise.
- gorgoiler 4y agoIt’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 ordinal for escape is 033. 0133 maps to [ so ^[ (control-open-square-bracket) is equivalent to escape. Some other common ones are: line feed/^J, backspace/^H, tab/^I, and end-of-transmission/^D. If you ever type “exit<enter>” to end a shell session you can do the same with ^D. Similarly of course you don’t have keys for upper and lower case letters. You use the shift key for that, which shifts the code by 040 instead of 0100. Technically it’s down by 040 because while most keys are labelled in capitals their default behaviour is to send the lower case letter.
- vram22 4y ago>Some other common ones are: line feed/^J, backspace/^H, tab/^I, and end-of-transmission/^D. If you ever type “exit<enter>” 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 https://vasudevram.gumroad.com/l/vi_quick?layout=profile
- TheLocehiliosan 4y agoI 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.
- gwn7 4y agoAgreed. 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 4y ago> 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.
- kfajdsl 4y agoEmacs pinky isn't really a problem if you don't use Emacs keybindings ;)
- cbm-vic-20 4y agoThat, and "inoremap jk <Esc>".
- hoosieree 4y agoBetter is "inoremap fd <Esc>" 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.
- I_complete_me 4y agoFor some unremembered reason I changed from that to set <esc>=jk. No idea why but it also works.
- nsb1 4y agoSomeone 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 4y agoIf you're going to do this, I recommend mapping both jk and kj, so you can just mash the keys simultaneously.
- Galicarnax 4y agoI 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 4y agoThe 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.
- cristoperb 4y agoI 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_foot_pedal_as_a_keyboard_under_linux/ https://catswhisker.xyz/log/2018/8/27/use_vecinfinity_usb_fo...
- zwayhowder 4y agoUntil 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 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.
- lawn 4y agoIt'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 4y ago[deleted]
- teeray 4y agoI 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.
- godelski 4y ago<C-[> is a native remap to Esc btw
- hombre_fatal 4y agoBut 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.
- woleium 4y agoKarabiner elements*
- agrippanux 4y agoSwitching ESC to Caps Lock took significantly less time to retrain muscle memory than I expected.
- xigoi 4y agoI think AutoHotkey would be the program to use on Windows?
- pletnes 4y agoI’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.
- keithnz 4y agoI found power toys didn't work too well, especially when you want to turn it off and on, or put exceptions for some programs I just have a simple autohotkey script + vim like keys for going up and down in textboxes/selection/dropdowns. <!k::Send {Up} <!j::Send {Down} Capslock::Esc Only downside is the mess that happens when on other machines that don't have that, also try to use ^[ as much as possible.
- 0x008 4y agoWhen reading all these recommendations, I wonder why nobody is using ctrl-c to exit insert mode..?
- freedomben 4y agoDang 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
- xigoi 4y agoIt behaves differently than Esc.
- 0x008 4y agoHow?
- xigoi 4y ago2ix<esc> inserts “xx” 2ix<c-c> inserts “x” Also, <c-c> does not trigger InsertLeave.
- logical_proof 4y agoI 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 4y agoSee my reply to the other comment.
- samus 4y agoUsing 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 4y agoJust 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.
- wardedVibe 4y agoI 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 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 4y agoI 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.
- trynewideas 4y agoA lot of these USB pedals are about as sturdy as piano sustain pedals. More literally though, the Logidy UMI3[1] is a MIDI-over-USB foot controller that uses guitar pedal-like switches. It's designed to serve as a hardware interface to software loop control, but you can use a MIDI yoke or translator[2][3][4][5][6][7][8] to turn MIDI input into keystrokes, game input, etc. 1: https://www.logidy.com/umi3 https://www.logidy.com/umi3 2: Using just `aseqdump` to capture input, `xdotool` to simulate keystrokes, and a 7-line shell script to glue them together: https://superuser.com/questions/1170136/translating-midi-input-into-computer-keystrokes-on-linux https://superuser.com/questions/1170136/translating-midi-inp... 3: https://www.bome.com/products/mtclassic https://www.bome.com/products/mtclassic 4: http://www.varal.org/ttymidi/ http://www.varal.org/ttymidi/ 5: https://midikey2key.de/ https://midikey2key.de/ 6: https://hautetechnique.com/midi/midishortcut/ https://hautetechnique.com/midi/midishortcut/ 7: https://github.com/xobs/midi-to-keypress https://github.com/xobs/midi-to-keypress (Rust, Linux/macOS/Windows, open source) 8: https://charlie-roberts.com/midiStroke/ https://charlie-roberts.com/midiStroke/, https://github.com/charlieroberts/midiStroke/ https://github.com/charlieroberts/midiStroke/ (macOS, open source)
- deleted 4y ago
- _def 4y agoI 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
- blumomo 4y agoReady made for use: https://kinesis-ergo.com/foot-pedals/ https://kinesis-ergo.com/foot-pedals/
- djha-skin 4y agoI 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.
- RileyJames 4y agoI 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!!
- TylerE 4y agoOrganists might dispute that
- baumschubser 4y agoI 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 https://github.com/baumschubser/footswitcher
- pkkm 4y agoMy 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.
- danschumann 4y agoI 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.
- version_five 4y ago> As a regular vim user, only sometimes do I actually press i to insert This is important and the same thing I came to post. I'm not by any means a power user, but even for me, just having i as the way to get into insert mode pretty much defeats the purpose of not having to use the keyboard, because you still need the keyboard to get the cursor where you want it. The concept of a pedal system is cool, it would be nice to think about how it could be made more comprehensive to handle a bigger subset of mode changes.
- rendall 4y ago`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
- keybored 4y ago> 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.
- systemvoltage 4y agoI 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.
- wrd83 4y agoI'd make two pedals. Crtl and alt. Caps as escape..
- godelski 4y agoWhy don't people use <C-[>? It's a vim native function and even in vimtutor. You're probably using control and hard brackets already for programming (yes, I understand you Europeans have keyboards hostile to programming. I accept your remaps just fine)
- Slackwise 4y agoThis is completely useless. Who even uses `i` to enter insert mode? I am almost always using one of the following instead: - o: open new line below current line - O: open new line above current line - I: insert at beginning of current line - A: append to end of current line - cc: change current line - C: change to end of line - ci(: change in current parenthesis - ci": change in double quotes - ctX: change to character X - cfX: change to found character X Each of these will perform an action and leave you in insert mode after the action. Then using `.` you can repeat both the changing action and the insert, all in one keystroke. Obviously impossible to do if you only use `i` and `a`. Vim is not about toggling modes. Vim is an entire language to express text transformation, that you can then repeat with `.`, or undo with "micro commits" to your file, traversing the history back and forward in sensible chunks instead of the usual chaos of Ctrl-Z in other editors. (You can even branch your undo history!)
- shepherdjerred 4y ago> Who even uses `i` to enter insert mode? Most novice vim users.
- saint-loup 4y agoThere's is also this similar project from 11 years ago. https://github.com/alevchuk/vim-clutch https://github.com/alevchuk/vim-clutch
- voxelghost 4y agoYeah, this works for the accelerator, I want brake pedal to send Ctrl+[:wq though
- FpUser 4y agoNah. Vangelis had it way better. https://youtube.com/watch?v=GWggDMDhwIA&feature=shares&t=80 https://youtube.com/watch?v=GWggDMDhwIA&feature=shares&t=80
- caxco93 4y agoI've always used Ctrl + C. I thought everyone did the same. Can't even remember where I learnt it from.
- tombert 4y agoI tried doing that for awhile, but I kept hitting `fn` by accident on the Macbook keyboard, since that's the button on the bottom left corner. I probably would have eventually gotten used to it, but I found it easier to just remap caps lock to escape.
- jerpint 4y agoI’m not sure I understand the pedal, according to the wording it sounds like I have to stay pressed to remain in insert mode which sounds way worse. Personally I have remapped caps to ESC system wide and it’s a pleasure to work with
- visviva 4y agoI appreciate this reminder to re-read one of the funniest things I've ever seen on the internet: "acme vs emacs vs vim": https://imgur.com/WLzeQMj https://imgur.com/WLzeQMj
- kqr 4y agoIt seems nobody has mentioned my hack of choice yet: map tab to escape, and shift-tab to tab. I rarely indent manually anyway, and tab cycles indentation levels in all language modes I work with, so I don't need anything mapped for shift-tab. I do really like the idea of tapping vs. holding caps lock mentioned in another comment here, though. I could probably get used to that instead.
- johnorourke 4y agoThis takes me back... 25 years ago I visited a company called "Zeus" in Cambridge UK, who made a web server that competed with Apache httpd, and was told about their developers' Escape pedals.
- AlbertCory 4y agoFoot pedals! My grandmother used to operate an IronRite ironing machine (you can find them on eBay) which had knee-operated levers, too.
- ytygg775 4y agoI'm surprised that nobody brought up yet that pressing i is rarely the only way to enter insert mode. As a vim power user, I use a, o and c (after different types of selecting some part of existing text) at least as often. That would make the clutch useless in the presented form, so I'm skeptical that this is actually being used. Using the clutch either as a full esc replacement would make more sense (send esc on tap down, send nothing on release). Or inverted, send nothing on tap down but send esc on release, and have the user train that they subconciously tap the foot down upon entering insert mode by any means.
- paraknight 4y agoMy 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!
- _deconstruct 4y agoI honestly can't believe people complain about having to hit the ESC button. Is this for real?
- lcuff 4y agoSexy 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 4y agoNah, 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 4y agoBoth 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 4y ago[deleted]
- TYMorningCoffee 4y agoI did jkj instead.
- tipsytoad 4y agoMap holding caps lock to control and esc on tap, you never use it anyway :)
- hxugufjfjf 4y agoCorrect 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 4y agoFor 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 4y agoOS 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.