Tuesday, February 23, 2010

Re: Open Hightlighted Text in Vim

williey wrote:
> How can I open a highlighted text string in Vim?

I'm not sure what you mean by "open":

open = "I have a filename/path selected in another application,
and I want to open that file in vim"
================================================================
Copy the filename to the system clipboard, open an empty vim and type

:e ^R+

where ^R is control-R. If you're on an X system instead of win32
or Mac, you can use the select buffer instead of the clipboard by
using "*" instead of "+"

:help c_CTRL-R
:help "+
:help "*


open = "I have some text visually selected in vim and I want to
'open' it in a way similar to one of the other definitions of
'open' for which I already have a solution"
================================================================
most of my other solutions use a register. You can yank to the
scratch register (by default) and the use double-quote to name it

^R"

in insert or command-line mode. Or you can yank your
visual-selection to a named register and paste that.


open = "I have some text highlighted in some other application
and I want to copy/paste it into vim"
================================================================
you can use the same trick since +/* are just registers, so you
can do the normal register "put"ting

"+p

or, while in insert mode, you can use ^R+ like in command-line mode

:help i_CTRL-R
:help p

open = "search for selected text"

> Can I set an option in my .vimrc file to do this?

It's not so much an option as using the tools vim provides.

-tim


--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: