Saturday, March 31, 2012

Re: Still puzzling ove paste

Hi howardb21!

On Fr, 30 Mär 2012, howardb21 wrote:

> Call it aesthetics, but defining a new function and mapping to do
> abbreviations seems like quite a workaround. I have an almost
> `religious belief there should be a simple way to enable/disable paste
> in : command mode, or something similar. In other words: there just
> `must' be a way to `know' in a script wheny you are in and out of :
> mode.

There is no easier way to achieve what you want. You need at least a
function, that checks in what mode you are in. The second function was
there just to make it more easier to enter new abbreviations.

BTW: You can do it manually:
function! Abbreviate(lhs, rhs)
if getcmdtype() =~ '[/?]'
return a:rhs
else
return a:lhs
endif
endfu

cnorea foo <C-\>eAbbreviate('foo', 'foobar')<cr>

You can read about it at :h c_CTRL-\_e

And I don't think this is ugly. It is just the only way to make your
request work.

regards,
Christian
--
Sitzen 2 Rentner auf der Bank.
Erster: "Ja."
Zweiter: "Ja, ja."
Kommt ein dritter dazu.
Erster: "Ja."
Zweiter: "Ja, ja"
Dritter: "Ja, ja, ja."
Darauf der Erste zum Zweiten: "Komm wir gehen der redet mir zu viel."

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: