I know use '|' and combine two command, but I don't know how to do
the combination when the first command is a external shell command
(prefixed by a '!').
For example, I want to define <F5> to run a shell command which
updates my cscope database and then run ':cs reset', I tried
nmap <F5> :!./recs-sh | :cs reset<CR>
but it failed.
Anyone can be kindly help?
-
narke
The :execute command can help here.
nmap <F5> :exe '!./recs-sh' | cs reset<CR>
Note that the colon is needed only at the start of the command line,
not in front of each command.
See
:help :exe
Regards,
Gary
> On 2008-12-09, Steven Woody wrote:
>> nmap <F5> :!./recs-sh | :cs reset<CR>
>>
>> but it failed.
> The :execute command can help here.
>
> nmap <F5> :exe '!./recs-sh' | cs reset<CR>
>
> Note that the colon is needed only at the start of the command line,
> not in front of each command.
it's also possible to put <CR> between the commands. Then the colon is
needed with the second command:
nmap <F5> :!./recs-sh<CR>:cs reset<CR>
Thank you! It is a rescue.
Normally, the | character terminates the ":map" command. To use it in a
{rhs}, use <Bar> instead.
Best regards,
Tony.
--
In case of injury notify your superior immediately. He'll kiss it and
make it better.