ctrl-w r 'switch windows
[[ 'top of page
Enter 'Simulate user pressing enter
dd 'delete line
qa 'create macro
q 'stop macro
.
.
.
and so forth
i get E492: Not an editor command
thanks
The commands in script files must be ex commands. The commands you've
shown are normal-mode commands. See
:help vim-modes
for a description of the various modes. You can use the :normal
command,
:help :normal
to execute normal-mode commands in a script. Some of the commands you
are using also have ex-mode equivalents, such as :wincmd for Ctrl-W
commands and :.d for deleting the current line.
Alternatively, you can source a file of normal-mode commands using the
:source! command. Note the exclamation point. See
:help :source
but I don't have any experience doing that.
--
Gary Johnson
thanks for the quick reply.. I'm still having 2 issues:
from my script:
1)i am trying to insert the contents of a buffer and search the file.
ie :/"\<CTRL-R>"c where c is the name of the buffer.
I get a E486 Patter not found..
2) I am having a problem also calling a macro from the script file.
thanks
> thanks for the quick reply.. I'm still having 2 issues:
>
> from my script:
>
> 1)i am trying to insert the contents of a buffer and search the file.
>
> ie :/"\<CTRL-R>"c where c is the name of the buffer.
>
> I get a E486 Patter not found..
I know that "buffer" is the generic term for such a thing, but Vim uses
"buffer" to refer to the thing that holds the contents of a file and
which you edit and uses "register" to refer to a thing you yank text
into. So in the case above, c is the name of a register, not a buffer,
and strictly speaking, the thing you're searching is a buffer, not a
file. Not a big deal, but knowing the terms Vim uses makes it easier to
find information in the :help system.
It can be a little tricky to expand commands such as those beginning
with Ctrl-R in other commands. The :execute command is usually used to
for this. For example, you could expand Ctrl-R " in your search command
like this:
execute "normal /\<C-R>\"\<CR>"
or interpolate the value of the " register like this:
execute "normal /" . eval('@"') . "\<CR>"
You _could_ insert Ctrl-R and Return literally into the normal command
by preceding each by Ctrl-V, typed like this,
normal /^V^R"^V^M
where ^V, ^R and ^M mean the single characters Ctrl-V, Ctrl-R and
Ctrl-M, respectively, but embedding control characters into your scripts
can make them difficult to maintain and to share with others. It's one
of those things that's good to know but generally not a good idea to
use.
You could also use the search() function instead, like this:
call search(@")
One feature of using the search() function is that it does not affect
the value of the search register.
> 2) I am having a problem also calling a macro from the script file.
If you record a macro into the q register, for example, you can play it
back like this:
normal @q
Or by "macro" did you mean something else?
--
Gary Johnson