I'm trying to get a mapping to work irrespective of the number of
characters in the document. The following is a simplified example
which does the rather strange task of copying the current word, then
pasting it and appending a question mark:
:nmap <buffer> <F3> yiw pa?<Esc>
Note this is only for demo purposes, in my application I pass the
yanked text to a function that does something useful. The above map
works, *but* never does anything when the buffer is completely empty
or only has one character in it.
For example, if I press F3 on an empty buffer, I'd expect the buffer
to have a question-mark added. If I press F3 on a buffer containing
only "g", I'd expect to end up with "gg?". But in both cases, nothing
happens.
Yet if I press F3 on a buffer containing "ug" I get "ugug?" as
expected.
Is there some alternative I can use, so that I can act on a string
even if it has zero or one characters?
Thanks
Dan
(vim 7.3 on ubuntu 11.10)
--
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:
Post a Comment