loading...
Cover image for How to never touch your mouse again 🐭

How to never touch your mouse again 🐭

oguimbal profile image Olivier Guimbal ・3 min read

VIM ? Well... no thanks.

You may already have met one of those extremists which have explained to you how productive VIM is compared to newbie editors like vscode or other modern useless shit.

To me, this always have sounded like some sort of hell-yea-i-am-a-real-geek nonsense. In perticular, they often hightlight the fact that VIM is highlly customizable. Weeeelll, yes. That's right. Or at least that was right: vscode (or other modern alternatives), is also highly customizable, in a way more user friendly fashion.

However, if like me you have been writing code for decade(s), you might have noticed (or not?) that one of the things that break your flow is to constantly switch between keyboard, arrow keys, and/or your mouse. When you have a burst, you may feel like hell-yea-my-hands-are-flying, but in the end, you spend a lot of time not typing actual code. That is one of the arguments of VIM-extremists, and I must say, this is the one that seduced me the most.

What if I dont wanna spend 32752 hours learning/configuring VIM ?

I'll share with you the two ways I achieved that.

Configuring vscode alone

Vscode shortcuts customization is awesome. You can do almost anything with it.

shortcuts

Here is a link to my key bindings, so you can pick what's best for you (⚠ my keyboard is AZERTY).

A config like this one allows you to navigate your code without moving your hands even slightly:

  • use ALT+I/J/K/L/U/O/Y/H/M/ΓΉ to move around
  • same shortcuts with SHIFT pressed to select code
  • use ALT+Q/S/D/Z to switch between panes
  • use ALT+SHIFT+Q/S/D/Z to move code panes around
  • use ALT+,/; to switch between tabs
  • ... it also contains some other useful stuff check it out.

It takes several hours to get used to not touching your mouse, but there is no going back: It really worthes it.

However, when you configure this kind of shortcuts, it can feel a bit frustrating to edit text elsewhere "the old way" (notepad, word, or even in your browser).

That is the why of this next section:

System-wide configuration using AuthoHotKey (Windows only, sorry)

If you dont know autohotkey, it is a small software that allows you to write scripts that you can bind to keyboard shortcuts. It has a quite ugly syntax, but it makes it really easy to remap keys and interact with windows.

This autohotkey script will allow you to have almost the same experience moving around text as briefly described in the previous section, but system-wide.

(nb: It also contains a remapping of the F1 key that hides/shows Windows Terminal)

Other utilities

Jumpy

Moving around code using keyboard is nice, but you may feel like it is frustrating not to jump directly at a precise location visible on your screen (you'll want to click on this location).

jumpy

For this, I highly recomend the jumpy vscode extension, which does just that using your keybard.

Switcheroo (Windows only)

ALT+Tab is quite frustrating... try switcheroo: Press ALT+Enter, then just type the window name you want to jump to πŸŽ‰

switcheroo

For those who want VIM bindings:

There are several extensions that will turn your vscode experience in something like VIM. Read this article to know more about it.

[edit] Vimium

If you want to control your browser mouseless, give a try to Vimium (or here for Firefox).

It has plenty of shortcuts allowing you to browse pages, navigate bookmarks, open tabs or click links using your keyboard

Alt Text

Discussion

pic
Editor guide
 

TL;DR I think the advantages of using the keyboard peak at one point (i.e. basic editing + a couple of commands you use often in your IDE) and everything beyond is more trouble than it worths.

I was one of those "geeks" obsessed with Vim. Here's what I think 10 years later:

  1. There are lots of other things easier to learn with greater impact on my productivity than the way I edit/navigate code.

  2. Never touching the mouse is overrated. With all the options we have now, from multi cursors support to trackpads, using the "mouse" + a couple of keyboard shortcuts might be faster than forcing yourself to the keyboard alone.

  3. Finally (and this might be either crazy, either just me, or both πŸ˜… because I never heard anybody complaining about it), I found that many of the keyboard only solutions out there are engaging my "conscious" part of the brain. For example, Jumpy, when you choose the letter combination to jump to: search, read the combination on screen, press the combination on keyboard. For a split second there, it breaks my line of thought, whereas using the trackpad doesn't. It's as if my hands are autonomous, but picking/reading that combination is not.

 

I agree, there are things that have greater impact on your productivity to learn.
But my experience was that at one point, when I started to really master most of the technology I use, not breaking my flow started to matter, and mouse was harming that.
Moreover, its not only about productivity, its about comfort. And sometimes, both are related.

As @leob mentioned, when I write "never touch", I dont really mean "never", but rather "almost never when writing code". We're not dealing with a lot of shortcuts to learn there, its only kind of arrow keys that you would place in the middle of your keyboard, plus a handful of other really useful stuff I do quite often (launching unit tests, ...). It's quite fast to learn, and it really changed the way I write code.

But again, I agree, there is an invisible line somewhere not to be crossed between "enough shortcuts" and "too many shortcuts", and I believe there is no one good answer for where it lies. I guess it depends on your feeling and your experience.

 

I found that many of the keyboard only solutions out there are engaging my "conscious" part of the brain

Interesting! For me it's the other way around - because normally I keep both hands on the keyboard, using most of my usual shortcuts is very mechanical. When I want to use a mouse though, I need to move my hand away from the keyboard, put it on a mouse, and then find the mouse cursor on my screen - and I believe it's the last part that distracts my train of thought, because I need to actively look around the screen to notice it.

 

Ah, but that's not what I meant. I was not talking about the regular, run-of-the-mill, shortcuts that definitely live in the subconscious (after you practice enough), but of the few solution out there that make you dynamically pick keys to complete a task (have a look at how Jumpy works for reference). Also, long combination of keys (usually in Vim) can't live in my subconscious either. It's like, I always visualized the sequence before tapping it.

Oh, I get it now, thanks for clarification!

 

Cool post, but "How to never touch your mouse again" is a bit exaggerated - "How to touch your mouse less" would be more realistic :-)

P.S. case in point, interesting exercise - can you browse dev.to, and do anything you need, without ever touching your mouse? I guess you can, but I predict that doing so would take 2 or 3 times longer because there aren't good/quick keyboard commands for every conceivable action ...

 

I plead guilty. We're in a world of clickbait titles (which I despise) like "the 5 things you should know"... I guess I must have been influenced somehow :)

I must confess: I use vimium to navigate, but only use it moderately. I still use my mouse most of the time when not writing. But I switch between keyboard & mouse less often.

 

j, k, d, u all day

x, o and H also :)

 

Haha it's okay, yeah the title was a bit on the click-bait-y side but nothing too bad ... I guess it is possible (theoretically, and even practically) to work mouse-free, but I tend to stick to a middle ground, I'm a reasonably proficient keyboard user but I do reach for the mouse from time to time.

 

So you are telling us, instead of memorizing the shortcuts for the well known and widespread used vim key bindings, just come up with with your own set of keybindings to move around in the file by keyboard?

Moreover you suggest a bunch of other tools, which come with their own set of key bindings to memorize.

In the end you come back to vimium for navigating the browser, so you have to memorize vim key bindings anyway.

I use vim plugins for vscode (and whereever available), vimium for navigating the web, wasavi for editing input field in the browser (like writing this comment).

For everywhere else I bought the ultimate hacking keyboard, which only have letters and the number row. In return it has a modifier key, which allows for remapping keys to arrows, page-up, alt-tab, or even makros.

 

No, I am not telling you to use my shortcuts, I am showing you how I built mines. The difference being that you can use this article to craft yours if like me you dont like vim shortcuts.

Moreover, I specifically mentioned that for those who like vim shortcuts, there are vscode extensions that replicate them out of the box.

 

Sorry, I misread your intend then.

I am advocate of the vim bindings myself. One advantage of using these bindings is the wide spread of them. I don't need to memorize other bindings when I'm using vim, vscode, sublime text, the browser, or whatever.

That's why I stick to these and don't come up with a set of my own.

But everybody to his liking.

 

Good post lots of useful info. If my Apple Mouse was still my main driver I would try to use it as less as possible because its just not that comfortable. However this new MX Master 3 is so ergonomic 😁

 

For me, the ergonomics of staying on the keyboard is a matter of health. My wrists and forearm (especially on my dominant arm) are prone to what might be described as repetitive strain injury. I find using a keyboard is less severe than a mouse.

Vimium is great. I've used a Vim plugin with IntelliJ for years and I just started using a Vim extension for VSCode. For development, I don't know if there's anything better than Vim shortcuts in a proper IDE.

Sometimes, it's a balance. I'll often use applications that are better suited to mouse interactions because there's no better alternative. A good example is git: I cannot stand looking at the green and red spaghetti of git diffs in a command line so I prefer to make the sacrifice and use the GitHub Desktop client instead.

 

Just to mention a git GUI I like: Fork :)

 

I was making the same argument about Vim and tried few interesting alternatives in VSCode, e.g. WASDMap (basically Alt + WASD for navigation). The problem I had was that I'm working on 2 machines with both VSCode and IntelliJ. It became too burdensome to synchronize all my ideas across both two machines and two editors.

Eventually I realized that Vim is such a neat standard. It's so popular that it's available almost everywhere. Plus Normal/Insert mode idea is quite appealing once you remap CapsLock to Escape.

At the beginning, I was actually quite fond of using mouse and arrow keys in the editor, but it suddenly changed when I started to enjoy working on a laptop from my balcony chair. Selecting text with a touch-pad seems completely wrong.

 

I use Listary listary.com/ and I am very happy of the free version.
It is like Switcheroo and on stable release.

 

Its more like a launcher, isnt it ? (Switcheroo is only a task switcher)
Seems interesting though.

 

With Listary you press Ctrl+Ctrl and you have a bar in front of you (like Switcheroo). With this bar you have access everywhere in the computer.

If you find the file you want and you press right arrow (β†’) it appears the right-click menu. It is really useful, I think that Microsoft has to implement a similar solution in Windows 10

 

Oh my god, I love this post! ❀

Thank you so much for sharing!

 

To add to what you said, if your on Linux I would recommend a tilling window manager such as i3wm, dwm, or xmonad. Those really helped me get to an almost mouse free work flow.

 

In fact, an autohotkey-like is available on Linux.
Don't know about macOs.

I'll try Jumpy, it seems to be the one I needed to finaly get rid of the mouse, thx πŸ––

EDITED.

 

Really ? Where ? I'm interrested... I only found broken equivalents.

 

I use autokey-gtk available on Ubuntu's package manager , it has same features as autohotkey and some more.

 

Switcheroo looks great! Thanks for the share

 

Great article.
I always thought that Chrome should have a "switch to prev used tab" function such VS code and others editors do pressing CTRL + TAB. Do you know any extension capable to do this?

 

Oh yea, I do... I use it everyday, I dont know how I missed it when writing this article. See my edit !

And thanks :)

 

Switcheroo is amazing! I wish I'd found it sooner. Thanks!

 

I'm not really the one to thank, but you're welcome :)

 

Great articles! thank yoU!