How can I set the shortcut key Ctrl-F to display the Edit->Find... dialog
box, and Ctrl-H to display the Edit->Find and Replace... dialog box? (Ctrl-F
and Ctrl-H are typically the shortcuts for Find and Find & Replace in the
Microsoft Windows world, so it's just what many Windows users are familiar
with.)
I imagine there should be two "imap" or "inoremap" instructions I could put
in the mswin.vim file, but I don't know how to programmatically display the
Find... and Find and Replace... dialog boxes. To illustrate, I'm pretty sure
this should work:
inoremap <C-F> [INSERT COMMAND TO DISPLAY "FIND..." HERE]
inoremap <C-H> [INSERT COMMAND TO DISPLAY "FIND AND REPLACE..." HERE]
I just haven't been able to find what those two commands are. Any ideas?
Thanks,
Alain
find and replace have a dialog accessible via:
:promptrepl
you can use it for finding or for finding and replacing
sc
Amazing ... I vaguely knew this was possible, so had a look and
found the following:
inoremap <C-F> <C-O>:promptfind<CR>
inoremap <C-H> <C-O>:promptrepl<CR>
I used the following to find what the commands were:
:menu Edit
I never use the menus, and would recommend the Vim method of
using the command line which has history and <C-R> to insert
registers and probably other good stuff.
John
Just a caveat that came up on this list recently regarding the
same idea: beware remapping control+H because it's often
interpreted as the same key as backspace. In Normal mode
(nnoremap) this isn't much of a problem because I don't recall
ever using backspace. However in Insert mode (your "inoremap"),
backspace and I are good friends.
-tim
Sooooo close :)
:nnoremap <f3> n
...and soooo boringly simple :)
The catch is that "n" searches in the same direction as the last
search. So if you search backwards, "n" will continue to search
backwards.
-tim
But how do I make it work when I'm in insert mode? I would have thought:
inoremap <F3> <C-O>:n<CR>
would have done the trick, but it doesn't. Any ideas?
Alain
:inoremap <f3> <c-o>n
-tim
:inoremap <f3> <c-o>n
-tim
Works like a charm. Thanks!
Alain