I'm using Firefox with Vimperator Vim emulator plugin, but instead of using its / key for searching, I prefer to use regular built-it Find bar, invoked by Ctrl-F.

The problem is, if Vimperator is enabled, when I hit Esc from within Find bar after I'm done searching, Find bar doesn't disappear (as it would, had Vimperator been disabled) because Vimperator intercepts Esc mapping.

So my question is, how can I make Find bar disappear as it normally would, when I hit Esc key?

| improve this question | | | | |

With vimperator enabled, typing i+CTRL+f will bring up the find bar. And it's also easy to close it.

Try this command:

:js document.getElementById("FindToolbar").close();

Or create a map: (Add the bellow lines to '~/.vimperatorrc')

noremap <c-s-f> :js document.getElementById("FindToolbar").close();<cr>

inoremap <c-s-f> <esc>:js document.getElementById("FindToolbar").close();<cr>

Thus typing CTRF+SHIFT+f works like charm!

An extra note:

CTRL+f in command mode will bring up the find bar. Whilst CTRL-b will bring up bookmark sidebar. That's the reason I encounter this problem. So some other mappings might be helpful:

cnoremap <c-f> <right>

cnoremap <c-b> <left>

Starting from Gecko 1.9(Firefox 25), use this command instead:
:js getBrowser().getFindBar().close()

| improve this answer | | | | |

Add the following mapping to your ~/.vimperatorrc Vimperator configuration file:

inoremap <Esc> <S-Esc><Esc><S-Esc>

And be sure to restart Firefox to pick up the changes.

Under the covers, it does the following: disables Vimperator key interception, propagates Esc key to Firefox (which closes Find bar), enables Vimperator key interception back, in that order. Note that this mapping is not specific to Find bar only, it applies to all insert mode forms (any text area where you can type in some input), but that's likely what you want anyway.

| improve this answer | | | | |
  • Unfortunatelly it doesn't work on sites like quora.com =| – MaikoID Apr 6 '15 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.