Saturday, February 26, 2011

Re: inputdialog default string

> I use inputdialog in the following way:
>
> let findstring = inputdialog('Search string under source\ and include\
> ',expand('<cword>'))
> execute 'vimgrep ' '/'.findstring.'/' '..\include\*.h *.[cs] '
>
> The default string will be the word under cursor.
>
> Is there any way to set the default string to be the content I just yanked.

In an expression @ is used as a prefix for registers. So you can use @"
(or @@ if you prefer) for the last yank/delete, or just @0 for the last
yank. E.g.

let findstring = inputdialog('Search string under source\ and include\
',@")

:help @r

Ben.

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