If it is not too much effort to you I would like to know these
"bad hacks" -- just to learn a little more about "hacking vim"
and not necessaryly (ough, this world looks also very
"hackish"...german English....) to make them the base of all
my later VIMy programming.
Generally I think one can learn a lot about using technique in
ways, no one else has thought about before..... ;O)
Generally, folks would get fired for writing stunts like the
following, so read with caution...
Archived here:
http://permalink.gmane.org/gmane.editors.vim/38930
you'll find these two lines from my post:
nnoremap / :exec('cnoremap <'.'cr> <'.'cr>:exec("cunmap
<"."cr>")<'.'cr>:call HighlightCurrentSearch()<'.'cr>')<cr>/
nnoremap ? :exec('cnoremap <'.'cr> <'.'cr>:exec("cunmap
<"."cr>")<'.'cr>:call HighlightCurrentSearch()<'.'cr>')<cr>?
They are hideous monstrosities, that don't quite do all that I
described in my previous post. The basic gist is that you want to
remap the "/" and "?" keys so that when you press them, you
create a cnoremap mapping that maps the <cr> (and, unimplemented
in this example, also <esc> and <c-c>) to perform the action
"cunmap the <cr> mapping, and then do my custom action".
In this case, the custom action was to call the
HighlightCurrentSearch() function defined in the post, as desired
by the OP. In your case, you'd want to tweak it to do a "zz"
instead.
Caveat Vimtor...if it breaks, you get to keep both pieces. If it
kicks your dog, drinks your beer, steals your girlfriend, wrecks
your pickup-truck, or any other tragedy found in country-music, I
take no responsibility...it's an ugly hack. YMMV.
-tim