how to map two commands on one key?

0 views
Skip to first unread message

yixiao...@gmail.com

unread,
Jan 7, 2010, 12:56:49 PM1/7/10
to vim_use
Hi,

I am trying to map two commands on one key such as:

nmap <C-\>g :call add(SrcExpl_markList, [expand("%:p"), line("."),
col(".")]) :cs find s <cword>

The command will push the current position to the SrcExpl_markList and
execute the cscope command cs find s <cword>. However, every time when
I type the key <C-\>g,
the command will be shown on the command line as
:call add(SrcExpl_markList, [expand("%:p"), line("."), col(".")]) :cs
find s <cword>

After I hit the enter, vim will complain E488: Trailing characters and
it will not jumt to the definition of <cword>. It seems the first part
of command call add(SrcExpl_markList, [expand("%:p"), line("."),
col(".")]) was executed correctly.

Does anyone know what I did wrong?

Thanks

Frank

yixiao...@gmail.com

unread,
Jan 7, 2010, 12:59:06 PM1/7/10
to vim_use
sorry that I send this message two times since I am not used the
system.

Frank

On Jan 7, 9:56 am, "yixiaodaf...@gmail.com" <yixiaodaf...@gmail.com>
wrote:

John Little

unread,
Jan 8, 2010, 6:57:47 PM1/8/10
to vim_use
On Jan 8, 6:59 am, "yixiaodaf...@gmail.com" <yixiaodaf...@gmail.com>
wrote:

> > Does anyone know what I did wrong?

You didn't have an Enter after the first command. Either put <cr> at
the end of the first, or, perhaps better, put <bar> between them.
See :help :bar.

Anyway, you'll want a <cr> at the end of your map.

Regards, John

Reply all
Reply to author
Forward
0 new messages