[vox-tech] vim question: restoring search term after a mapping
Henry House
hajhouse at houseag.com
Mon Jul 19 15:36:48 PDT 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have some mappings in my ~/.vimrc:
nmap =0 :.s/^\(.\+\)$/\\chapter{\1}/<CR>:noh<CR>
nmap =1 :.s/^\(.\+\)$/\\section{\1}/<CR>:noh<CR>
nmap =2 :.s/^\(.\+\)$/\\subsection{\1}/<CR>:noh<CR>
nmap =3 :.s/^\(.\+\)$/\\subsubsection{\1}/<CR>:noh<CR>
which work great, but with one annoying aspect: they replace the current
search term. It is a bother to have to re-enter my search term (i.e., what I
last entered into the / command) after every use of my handy mappings. Does
anyone know a way to grab the current contents of the search-term register,
save it somewhere, then restore it? Note that I do not actually want to run
a search again, just get back the saved search term so that the n command
will work as expected the next time that I run it after using one of my
handy mappings.
- --
Henry House
Please don't send me HTML mail! My mail system will reject it.
The unintelligible text that may follow is a digital signature.
See <http://hajhouse.org/pgp> to find out how to use it.
My OpenPGP key: <http://hajhouse.org/hajhouse.asc>.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFA/E0Ai3lu92AVGcIRAoa4AKCOBzNnMH6jbV4ykoj+sQDpyEU1WQCeKvFG
VO8V0yCj6DQorKL5gg6/NM4=
=Y6hy
-----END PGP SIGNATURE-----
More information about the vox-tech
mailing list