> When 'noremap' is set, remapping is turned off globally, all keys in
> the macro get their builtin meaning, your mappings are ignored.

It took me a while to digest exactly what was being implied here, but
I think I understand now. You were spot-on Andy. It turns out that the
'remap' option was the issue. If you or anyone is interested, I've
attached exactly what happened below. It's a non-technical issue;
nothing to do with Vim. It stemmed from the fact that I didn't
understand exactly how 'remap' worked. As you quickly picked up, I
thought the 'remap' option extended only to my key mappings. It just
took me a while to realize...

Anyway, thanks for your time Andy; I appreciate it.
   Joel

Explanation:
I needed to convince myself firstly that it was possible to get
remappings in macros to work in my version of Vim, so I shell'd:
$ vim -u NONE --noplugin -i NONE -S ./macro-test.vim
to run a test script I'd prepared. When this ran fine, it meant that
there must definitely be something wrong with either a plugin, or
my .vimrc file.

It occurred to me after I sent my last email that actually I had
played with the remap setting, back when I first started learning Vim.
You see, I discovered the 'remap' before the '(n|i|v|c)noremap'
mapping options. Early on I was frustrated that I couldn't simply
remap any key to any other key, and setting the remap option seemed to
fix that. I didn't realize that the impact of this extended beyond
just key mappings.

Some time after (when I had forgotten about the remap setting) I
realized the above macro problem. I looked around the Vim
documentation and the web, but couldn't find anything to fix this.
Frustrated, I wrote my own macro plugin script, so that running macros
would work correctly with my mappings. Not an elegant solution
necessarily, but it meant I could reliably use macros again.

Some time later again I found the '(n|i|v|c)noremap' options, and
started converting all my maps to noremaps. Having done this I
realized that I no longer needed the 'set noremap' option in my .vimrc
file, so I promptly deleted it.

That was a while ago. Only recently, when I found some fundamental
problems with my macro plugin script did I post here.

As you've no doubt picked up now, that's why running 'set remap?' here
turned out 'remap', as it's on by default. The fact that I was using
my macro plugin script explains why I didn't notice that macros
started working again after I had deleted the 'set noremap' line. It
all seems like a bit of bad luck and bad timing to me.

Was this a bit of bad luck, or is there something fundamentally wrong
in my debugging approach in Vim? Obviously we're all the wiser in
hindsight, but in general does anyone have any pearls of wisdom on how
to avoid these sort of situations in the future? It's been my general
approach to Vim that whenever I can't find the feature I want, I
quickly check the Vim docs and the Web, guessing keywords I think my
problem might come under, and if that turns out nothing, I typically
write a script to fix it. Perhaps part of the problem is that Vim
makes it so wonderfully easy to write script files :).

-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to