12

OS X user here. I'm currently learning both Vim and Vimium, it's been really fun. A major annoyance with Chrome is that I can press Cmd+L to highlight the address bar, but I can't unselect it without clicking on anywhere on the page (and resume to normal navigation). How do I (using the keyboard only) unselect the address bar in Chrome?

P.S. Sorry if this has been asked already. I just cannot find the combination of search terms in Google as what I'm searching for is a bit descriptive

5 Answers 5

11

I am not a OS X user, but I think this should be the same as in Windows,press the Tab once or more time after selecting the Chrome address bar with Ctrl+L. In Windows pressing F6 once or more times will deselect the omnibox in chrome, but I don't know if this will work also in OS X, it is worth a try.

4
  • 1
    Thanks @Devid. Yup, that works as a workaround. When I try here in SuperUser though, when I press Tab, it selects the next HTML element or something. So when I attempt to scroll using j on Vimium, an error beep occurs. I can press j again, and I end up in the SuperUser search box. From there I can unselect it and navigate using keyboard. I would much rather that I just plain unselect the address bar with no side effects such as selecting HTML elements. Mar 8, 2014 at 20:12
  • In windows there is also F6 and pressing it 3 times deselects the omnibox without side effects. Maybe there is something similar in OS X
    – Devid
    Mar 8, 2014 at 20:25
  • 1
    Best answer!!!!
    – laike9m
    Oct 10, 2015 at 7:39
  • @DaryllSantos If this answer worked for you (it did for me) you can select it as your answer.
    – Spotlight
    May 17, 2016 at 15:33
10

I've had the same issue but I found a simple hack. Just go to your Chrome settings and click manage search engines. Then add a new search engine with 'javascript:' as the url, and whatever word or key you want for the shortcut. I use Vim with jj or kk mapped to esc, so I used those two keys as the shortcut for my Chrome.

http://imgur.com/ipIdKUV

1
  • Two problems: can't set the custom engine as default. Two: how do you map a key-combo to escape? Just map jj <Esc>? Jun 23, 2015 at 8:29
1

Since you are presumably a superuser in addition to using OS X, here is my Karabiner .xml that enables me to exit the omnibox with Command_L + ; (ø on Norw/Danish keyboards). Change to whatever keycombo you need:

<?xml version="1.0"?>
<root>
  <item>

    <appendix>Use ø (;) to exit the satanically moronic omnibox in chrome.</appendix>
    <identifier>private.make_up_for_shitty_chrome_behavior</identifier>
    <only>GOOGLE_CHROME</only>

    <autogen>
      __KeyToKey__
      KeyCode::SEMICOLON, ModifierFlag::COMMAND_L,

      __{ KeyCode::TAB, KeyCode::TAB, KeyCode::ESCAPE, }__
    </autogen>
  </item>
</root>

What it does is execute the key-sequence TAB TAB ESC when you trigger it. This makes the first HTML element selected so it is kind of a hack.

I'd personally just remap ESC to ESC ESC in Karabiner so that ESC drops out of the omnibox, but that might interfere with your usage/lead to uninteded consequences.

(I could not get Wang's answer to work)

Edit: This seems like a more robust way to do it in karabiner:

<?xml version="1.0"?>
<root>
  <item>
    <name>Mouse Warping</name>
    <vkopenurldef>
      <name>KeyCode::VK_OPEN_URL_SHELL_mousetowindowcenter</name>
      <url type="shell">
        <![CDATA[
                 /Applications/Karabiner.app/Contents/Library/utilities/bin/warp-mouse-cursor-position screen 0 bottom 0 right 0
        ]]>
      </url>
    </vkopenurldef>
    <item>
      <identifier>private.f14_mousetowindowcenter</identifier>
      <name>F14 to move the mouse to the center of the current window</name>
      <autogen>
        __SimultaneousKeyPresses__
        KeyCode::A, KeyCode::K,
        KeyCode::VK_OPEN_URL_SHELL_mousetowindowcenter,
        KeyCode::VK_WAIT_100MS,
        PointingButton::LEFT,
        KeyCode::ESCAPE,
      </autogen>
    </item>
  </item>
  </root>

My first answer works for most sites, but for sites with many search boxes you need more than x tab clicks.

The code immediately above moves your cursor to the bottom left (i.e. edge of chrome window) and presses the left mouse-key once, selecting the window without any side-effects. This deselects the omnibox. I use A+K (home row, baby!) simultaneously to do this, but you will probably want to choose your own.

0
If you REALLY don't want to use the trackpad or have no mouse
  • How to leave focus from address bar without mouse or trackpad
    • We can press the trackpad to leave the address bar (when the mouse is at browser area, usually it's)
    • I avoid to use trackpad as possible as I can as my fingers hurt when use trackpad.
    • Luckily, we can add a custom search engine like below at chrome://settings/searchEngines.
    • Then we can type l then enter to go back to the browser area.

Check here for more Chrome tips and tricks

0

There are several Vimium feature requests for this BTW with the intention of enabling that for ESC, but the devs said there is no available API:

So I just use the Tab workaround mentioned at https://superuser.com/a/726451/128124 for now.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .