mapping error.

16 views
Skip to first unread message

sinbad

unread,
Nov 30, 2017, 2:06:19 AM11/30/17
to vim_use
Hi,

I'm trying to map <space>x in normal mode to do send a command to a pane in tmux.

sudo tmux send-keys -t "1" C-z "test"

I tried the following. wrote the above command in a test.sh file and made a mapping as below.

:nnoremap <Space>x 'silent :!./test.sh<C-m>'

I'm getting the following error.

E20: Mark not set

i think it's due to the following mapping.

n ' & :call Showmarks() <CR>

Isn't nnoremap disable recursive mapping ?


thanks

Florian Rehnisch

unread,
Nov 30, 2017, 2:32:25 AM11/30/17
to vim...@googlegroups.com
AFAICS recursive mapping /is/ disabled head. You're getting the error message
because Vim tries to jump to a mark s when hitting the first tick (') in the
right-hand side of your mapping. Furthermore, silent is AFAIK a command line
command, so your colon is misplaced. Untested:

:nnoremap <space>x :silent\ !./test.sh<c-m>

The backslash is for escaping the space.

Gruß,
fm-r

Florian Rehnisch

unread,
Nov 30, 2017, 2:39:02 AM11/30/17
to vim...@googlegroups.com
On Thu, Nov 30, 2017 at 08:32:17AM +0100, Florian Rehnisch wrote:
> On Wed, Nov 29, 2017 at 11:06:19PM -0800, sinbad wrote:
> > I'm trying to map <space>x in normal mode to do send a command to a pane in tmux.
> >
> > sudo tmux send-keys -t "1" C-z "test"
> >
> > I tried the following. wrote the above command in a test.sh file and made a mapping as below.
> >
> > :nnoremap <Space>x 'silent :!./test.sh<C-m>'
> >
> > I'm getting the following error.
> >
> > E20: Mark not set
> >
> > i think it's due to the following mapping.
> >
> > n ' & :call Showmarks() <CR>
> >
> > Isn't nnoremap disable recursive mapping ?
>
here..
> AFAICS recursive mapping /is/ disabled head. You're getting the error message
> because Vim tries to jump to a mark s when hitting the first tick (') in the
> right-hand side of your mapping. Furthermore, silent is AFAIK a command line
> command, so your colon is misplaced. Untested:
>
> :nnoremap <space>x :silent\ !./test.sh<c-m>
>
> The backslash is for escaping the space.

Ah, the backslash gives another error (E10).

:nnoremap <space>x :silent !./test.sh<c-m>

Should do the trick.

Gruß,
fm-r

sinbad

unread,
Nov 30, 2017, 3:18:26 AM11/30/17
to vim_use
Thanks Florian. It worked.
Reply all
Reply to author
Forward
0 new messages