Git Product home page Git Product logo

vim-clutch's Introduction

Updates:

VIM Clutch by Aleksandr Levchuk

VIM Clutch is a hardware pedal for improved text editing speed for users of the magnificent VIM text editor (1, 2). When the pedal is pressed down, the pedal types "i" causing VIM to go into Insert Mode. When released, it types <Esc> and you are back in Normal Mode.

I just made one and it works great. Here is how I did it.

  1. Purchased 2 USB foot switches (pedals) from China: I used Ankaka.com and payed 20 USD (includes 2 pedals and shipping to California).
    Later I found out the OEM: PC sensor http://www.pcsensor.com/index.php?_a=viewProd&productId=2 $5.50 per pedal
    Also they sell these form Hong Kong:
    http://www.suntekstore.com/goods-10010504-pc_usb_foot_switch_keyboard_pedal.html
    http://www.suntekstore.com/goods-10012491-new_usb_fashion_action_control_keyboard_hid_foot_switch_pedal_.html

  2. The pedal is programmable via a Windows GUI or on Mac/Linux via https://github.com/rgerganov/footswitch CLI. Once programmed you can plug it into any Mac or Linux and it will work.

  3. Unfortunately, only the Pedal Down event is programmable. But we need to be able to press <Esc> as the pedal is release. I emailed PC sensor, reaching out to collaborate but I just got the pedals from the post office today and really wanted it to work. So I stated hacking at it and came up with a solution in a about 1 hour.

  4. I programmed one pedal to send the letter "i" and the other to send the <Esc>

  5. Took both pedals apart





  6. With electrical tape, attached 2 toothpicks to the plastic blade that goes between the Infrared sensors when the pedal is in the down possition.





  7. Placed both sensors boards into one pedal enclosure so that, as the pedal is pressed, first the toothpicks will cross the <Esc> sensor, and after that the plastic blade will enter the "i" sensor. As the pedal is release the toothpicks will cross the <Esc> sensor again.


Acknowledgments

I would like to say Thank You to:

  • Sean Mahoney for suggesting the name Vim Clutch.

  • Anton Polishko for suggesting pressing <Esc> every time right before pressing "i" in order to avoid typing undesired "i"s.

  • Tyler Backman for letting me use a Windows computer.

  • The company PC Sensor for building such a clean and incredibly inexpensive device.

Finally the first VIM Clutch

Has anyone thought of this before?

Perhaps, but I was not able to find any mention of using a pedal for Vi or VIM. I searched for this occasionally for a span of more than 2 years. Nothing like this comes up on Google. I shared my idea with a lot of my friends and no one mentioned that this was already thought of by someone else.

As a result I consider myself the inventor of the VIM Clutch.

Extras

PC Sensor also has a triple version of the pedal. I will order two of those as well. I will program:

  • The left pedal to "I" - insert at the beginning of the line
  • The middle pedal to "i" - regular insert mode
  • The right pedal to "A" - insert at the end of the line

License

Creative Commons License
The VIM Clutch work by Aleksandr Levchuk is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

vim-clutch's People

Contributors

alevchuk avatar alexdisler avatar meonkeys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-clutch's Issues

isn't vim nnoremap solves problem of second pedal?

I also have two pedals for typing, along with my homemade arduino-based keyboard remapper, but I'm using right pedal for shift, and left for esc, but to be able to switch to insert mode back if I jumped to normal before using pedal, you can just write in your .vimrc

noremap <Esc> i

Works great for me)

needs more snide comments about emacs

As a vim user, when I read the README, it is hard to find comments about emacs.

expected result: witty comments about why vi is better.

Most likely a doc issue.

Pedal Alternative

These pedals with three buttons have a pretty great build quality and heft.

Infinity USB Digital Foot Control with Computer plug (IN-USB2)
http://amzn.com/B002MY6I7G

As for the software for button customization:

I can vouch for ControllerMate, and though the full product is not free, the evaluation version gives you enough output configuration options (up to 10) to map all your pedal buttons and then some, for free. You can also map separate keys to the press action and release action, so no need to open up the device, or buy two, or anything.

Every needs a gear shift

Pedal should only input 'esc' and a gear shift should be made to select modes (insert,visual,etc). Otherwise, this is more like vim-sewing-machine.

"Shift" key on 3-pedal version

Rather than A/I/i for the 3-pedal version, why not configure one of the pedals to be shift - that way you get 4 keys from 3 pedals, and you only need to modify 2 of them.

Programming VIM Clutch on all platforms

Hi,

I have implemented a command line utility for programming the foot switch that is used for the VIM Clutch: https://github.com/rgerganov/footswitch. I am using the libusb library which works and all major platforms, so one doesn't need Windows anymore to program the pedals.

I have tested my application on several Linux machines and it works fine. It should work on Mac as well but I don't have one to test. You can put a link in the README if you want :)

Can't you just use a mouse?

Would this work with a secondary mouse on the floor?
Everyone has one laying around.
Sorry for the silly questions and off topic suggestions.

Footswitch doesn't seem to work with OS X.

The footswitch software that is linked in the readme doesn't seem to work with os x.

I have found a work-around using a single foot pedal and the keyboard Keyboard Maestro software.

  1. Connect the pedal to a windows machine and install the bundled software.
  2. Configure the pedal to perform a (ctrl) button press and apply to device.
    1. Make sure the the long press option is selected so that holding down the pedel simulates holding down the key.
  3. Connect the pedal to the OS X machine.
  4. Go to System Preferences -> Keyboard -> Modifier Keys
    1. Select FootswitchV1.1 from the drop-down list at the top.
    2. In the Control key field set it to No Action.
    3. Exit system preferences
  5. Open up the Keyboard Maestro macro editor
    1. Create a new macro.
    2. In the trigger field choose Device Trigger
    3. The device field should be selected and now press down the pedal once. The field should now say something like: FootSwitchV1.1 Left Control
    4. From this point you can set macros to execute when the pedal is pressed, released or Down.
    5. Configure any actions you want your pedal to do...

Thanks an I hope I have helped someone.
Mitchell
elwesties(at)gmail.com

Too many keys for insert mode

In vim Esc key is used to go back from the insert to the command mode. But there are many many ways to get into the insert mode. Do not you use "change word" cw or "change inside tag" cit? Or do you use a two-step operation like:

  1. "delete inside tag" dit
  2. then use your pedal to start the insert mode

BTW: bought the pedal anyway - probably to use a super or ctrl key or as a prefix in tmux

Tesla Model 3 support

It would be nice if I could enter insert mode from a Tesla, so I can use Vim more easily while driving. Obviously, don't drink while doing so.

ESC mapping alternative

You wrote that you mapped an extra ESC keypress to the button pressing action, but if you entered insert mode through something like ciw, and then wanted to escape, a press-and-release of your pedal would send the keys ESC, i, ESC, which would as a side effect move the cursor back one extra character than if you had just pressed ESC.

To avoid unnecessary movement like this, you could use an alternate key to get back to normal mode. The one I know of is ALT+L. So a mapping of ALT+L, i to the press-down action might work best for consistent mode-changing.

Add support for cheap dance USB matts

Another DIY alternative - use gaming steering wheel pedals + GlovePie

Hi! It's a very cool project, it grabbed my attention because back in the day, when I was writing my thesis I was looking for a similar solution. I had a gaming steering wheel with 2 pedals and I wanted to map them to Ctrl+C and Ctrl+V, without needing to solider anything ;)
I did it, it was possible, I just don't remember the exact setup, but I was probably using either GlovePie, Rejoice or JoyToKey (and I lost the configs due to HDD failure). It was far simpler to for lazy person like me ;)

Device Identifiers issue

I got a pair of these pedals, but seems like they are identified as the same one, so Im unable to configure it for vim

It is needed to hack the connectors in order to be recognized like a second pedal ?

Suggested Secondary Use

Nothing to do with Vim, but I was recently looking into buying a trackball, instead of a mouse..... but they don't have a scrollwheel... You have to hold down a button first....

Even with a normal mouse, you could use your clutch for autoscroll in firefox.

Foot down = mouse scrolls the page.

Foot up = normal mouse...

Explore pedals with double shift

I found this pedal model with double shift. Press soft - one key, press harder - another key. And it's also Bluetooth. The idea would try to use soft press as Esc and deeper press as i. I don't know, so that why should be bought and tested, if it's possible to execute the soft press before the deeper press or the circut just interpret as one press of a different key each time.

I've been using VIM with foot pedal for 5 years

Kenesis advantage pro with foot pedal.

My Setup

So you need to update your doc claiming you are the first. Apart from that very cool. However i map my footpad to the shift key as it is my most common meta key a prevents most of the bridging strain I get.

Regards

Brad

Toaster mode support

I think that a toaster control like this, would be a great fit too so you can write code without stop to eat.

Tactile feedback

Really great concept, I think providing a tactile feedback ( even if it's fake) like mechanical keyboard would be more fun for your foot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.