On Dec 4, 1:42 pm, Christian Brabandt <[email protected]> wrote:
> Hi rameo!
>
> On Sa, 04 Dez 2010, rameo wrote:
>
> > Thank you very much.
>
> > Would it be also possible to search first and then copy the text to
> > clipboard?
> > This avoids to insert the whole line s/whatever/\=Appclip(submatch(0))/
> > g in command
>
> I don't understand.
Now I have to insert every time the command:
s/whatever/\=Appclip(submatch(0))/
It would be nice to do a search
/whatever/
and click on a button to copy all search matches to clipboard.
>
> > another question, do you know how to use the same function for two
> > different things p.e.
>
> > function! search()
> > exe "%s/whatever/\=Appclip(submatch(0))/g"
> > endfunction
>
> > function! search()
> > exe "'<,'>s/whatever/\=Appclip(submatch(0))/g"
> > endfunction
>
> > Can I give value to the function to tell that the "%" has to be
> > "'<,'>"?
>
> :h a:firstline
> :h function-range-example
>
> regards,
> Christian
I tried this.
I called my function with this command:
:call <SID>CopySearch(sel) --> search only in selection
:call <SID>CopySearch() --> search in whole file
Then I do a check in the function CopySearch if argument exist:
function! s:CopySearch()
....
let s = a:sel
if s != ""
let h = '<,'>
else
let h = %
endif
...
endfun
exe h."s/whatever/\\=s:CopyMatchesWords(submatch(0))/g"
but this doesn't work.
E121 : undefined variable
--
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