Message from discussion
cnoremap <C-\>e maps within the expression register
Received: by 10.180.91.231 with SMTP id ch7mr4226280wib.1.1349300733996;
Wed, 03 Oct 2012 14:45:33 -0700 (PDT)
X-BeenThere: vim_dev@googlegroups.com
Received: by 10.181.12.12 with SMTP id em12ls5570344wid.2.gmail; Wed, 03 Oct
2012 14:45:23 -0700 (PDT)
Received: by 10.180.84.74 with SMTP id w10mr4041346wiy.4.1349300723154;
Wed, 03 Oct 2012 14:45:23 -0700 (PDT)
Received: by 10.180.84.74 with SMTP id w10mr4041345wiy.4.1349300723141;
Wed, 03 Oct 2012 14:45:23 -0700 (PDT)
Return-Path: <b...@moolenaar.net>
Received: from fep28.mx.upcmail.net (fep28.mx.upcmail.net. [62.179.121.48])
by gmr-mx.google.com with ESMTP id e5si1521985wiw.0.2012.10.03.14.45.22;
Wed, 03 Oct 2012 14:45:23 -0700 (PDT)
Received-SPF: neutral (google.com: 62.179.121.48 is neither permitted nor denied by best guess record for domain of b...@moolenaar.net) client-ip=62.179.121.48;
Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 62.179.121.48 is neither permitted nor denied by best guess record for domain of b...@moolenaar.net) smtp.mail=b...@moolenaar.net
Received: from edge03.upcmail.net ([192.168.13.238])
by viefep19-int.chello.at
(InterMail vM.8.01.05.05 201-2260-151-110-20120111) with ESMTP
id <20121003214458.BBXP26940.viefep19-int.chello...@edge03.upcmail.net>;
Wed, 3 Oct 2012 23:44:58 +0200
Received: from moolenaar.net ([84.75.9.99])
by edge03.upcmail.net with edge
id 6lkw1k00V28CNeC03lkyAr; Wed, 03 Oct 2012 23:44:58 +0200
X-SourceIP: 84.75.9.99
X-Authenticated-Sender: b...@hispeed.ch
Received: from masaka.moolenaar.net (localhost.localdomain [127.0.0.1])
by moolenaar.net (8.14.4/8.14.4/Debian-2ubuntu2) with ESMTP id q93LiuRD002393;
Wed, 3 Oct 2012 23:44:56 +0200
Received: from masaka.moolenaar.net (B...@Moolenaar.net)
by masaka.moolenaar.net (8.14.4/8.14.4/Submit) with ESMTP id q93LiuDh002389;
Wed, 3 Oct 2012 23:44:56 +0200
Message-Id: <201210032144.q93LiuDh002389@masaka.moolenaar.net>
To: Christian Brabandt <cbli...@256bit.org>
Cc: vim_dev@googlegroups.com
Subject: Re: cnoremap <C-\>e maps within the expression register
In-Reply-To: <20121003195521.GD31...@256bit.org>
From: Bram Moolenaar <B...@Moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Date: Wed, 03 Oct 2012 23:44:56 +0200
Sender: B...@Moolenaar.net
Christian Brabandt wrote:
> > > On Mi, 03 Okt 2012, Bram Moolenaar wrote:
> > >
> > > >
> > > > Christian Brabandt wrote:
> > > >
> > > > > On Mon, October 1, 2012 13:16, Marcin Szamotulski wrote:
> > > > > > On 09:20 Sun 23 Sep , Marcin Szamotulski wrote:
> > > > > >> Hello
> > > > > >>
> > > > > >> The c_CTRL-\_e (<C-\>e) maps inside expression register are not working.
> > > > > >> There is a very nice emacscommandline
> > > > > >> (http://www.vim.org/scripts/script.php?script_id=3554)
> > > > > >> plugin which defines lots of nice maps in this way, but then when one
> > > > > >> tries to write to expression register one gets errors. The minimal setup
> > > > > >> to reproduce this is:
> > > > > >>
> > > > > >> fun X()
> > > > > >> return 'echo "X"'
> > > > > >> endfun
> > > > > >> cnoremap X <C-\>eX()<CR>
> > > > > >>
> > > > > >> Now please try in insert mode:
> > > > > >> <c-r>=X
> > > > > >> and after pressing X I get the following error:
> > > > > >> E15: invalid expression: ^eX()
> > > > > >> E15: invalid expression: ^eX()
> > > > > >>
> > > > > >> I got it twice. I think it would be nice to have the <C-\>e maps
> > > > > >> working inside expression register (and in this case it would be nice of
> > > > > >> vim script knew it, for example through including the '=' into to
> > > > > >> getcmdline()) or to disable the <C-\>e maps inside the expression
> > > > > >> register.
> > > > > >>
> > > > > >> Best regards,
> > > > > >> Marcin
> > > > > >
> > > > > > In case somebody will stumble across this post, the solution that
> > > > > > I found for this is to define another map:
> > > > > > cnoremap <C-b> <C-R>
> > > > > > etc ... . It will not trigger the emacscommand line maps. One just has
> > > > > > to remember to not to use <C-W> while entering things into the
> > > > > > expression register (which is used rarely, so there is not much
> > > > > > opportunity to learn it, and lots of chances to forget it ;)
> > > > > >
> > > > > > But this is far from perfect.
> > > > >
> > > > > Would it be enough to simply disallow mappings in expression evalution mode?
> > > >
> > > > Would this not stop other mappings from working, e.g.:
> > > >
> > > > cnoremap <C-Y> yank()
> > >
> > > Yes, in Expression evaluation mode (i.e. when doing <c-r>=)
> >
> > Well, that's not nice, users should be able to type the expression with
> > their favorite mappings.
>
> Okay, this seems to fix it:
Thanks. Thus this fixes the reported problem without side effects?
--
Beer & pretzels can't be served at the same time in any bar or restaurant.
[real standing law in North Dakota, United States of America]
/// Bram Moolenaar -- B...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///