Monday, January 31, 2011

properly yanking word/selection

What is the proper way to yank a word or a selection from a vim script? Right now I'm using
if !bSelection
normal! yaw
else
normal! gvy
endif

but I have some gripes:

1/ yaw (yank a word) yanks the space before the word (some times it doesn't); I don't want the space.
2/ bSelection is needed to tell a function that it was invoked from visual mode; is there a better way?

TIA

--
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