Configure Custom Vimium Key Mappings

Another aspect of Vimium's configurability is customizable key mappings. We can add new mappings and override existing ones. If there is a certain Vimium feature you want to make easier to trigger, adjust the key mapping to suit your needs.

Get Started with Vimium
Lesson 7 of 9

Get Started with Vimium

Share with a coworker

Transcript

[00:00] Let's look at how we can customize keyboard bindings in Vimium. If I go over to the extension and click Options, that's going to open up this tab where we can add custom key mappings right in this text area here. Now to the right, we have a couple examples of how we can map and unmap key bindings, as well as add comments, and then there's a link that shows available commands, which we'll look at in a second. So first I'm going to hit GI to focus this text area, and for my example I want to unmap capital J and capital K from being the ways that I go to the previous and next tabs. And instead, I'd like for the A and F keys to do that.

[00:44] So first I'm going to unmap j and unmap k. Now I want to map a, but what am I going to map it to? Well, let's hit escape, f, and show available commands. Here we see all of the Vimium key bindings, and then annotated next to them are the commands. So if I scroll down, we find the J and K options and we see that the command keywords for these two are previous tab and next tab.

[01:15] So I'm going to click that to copy it, escape out of here, and GI to refocus this text area, and now I can paste in previous tab. And then similarly, I'm going to map F to be next tab. Now, since I'm mapping over what F does, I should probably replace the functionality that F had before. So typically F is going to be the key binding that gives us link hints for navigating links on a page. So I'm gonna have to map something else to that.

[01:53] So let's say Control F, and then what's that command called? Well, I can go over to the command listing again and find link hints doing a search for that by using the forward slash. I've found it. I'm gonna hit V to go to visual mode. I'm gonna highlight the whole thing and Y to copy it.

[02:15] Escape out of here. GI to focus. And now I can paste that. So now Ctrl-F will activate the Link Hints mode. And in the same way, I'm going to go ahead and map C-F to be the pair to activate mode, which if I hit FL again I can scroll down and find link hints next.

[02:41] So here's the other one. Capital F opens the link in a new tab, so I'm going to grab that as well, GI and paste that in. So I've now unmapped J and K, I've mapped ctrl-F and ctrl-F to the link hints functionality, and then I've mapped A and F to be previous and next tabs. So I'm going to escape out of here, hit F because I haven't saved these changes yet, W to save them. So I'm going to hit T to open a new tab and go to GitHub.

[03:15] And now I've got a third tab open and I can hit F to cycle forward, and I can hit A to start cycling back. And then of course I can hit Ctrl-F to turn on the Link Hits feature.