On Friday, October 26, 2012 1:15:04 PM UTC-5, David Wang wrote:
> Hi,
> 
> I have a (not so long) list of existing ascii files in a vim buffer, and I'd 
> like to open a particular file from the list in a split window. I know I 
> could copy the file name using mouse (in a terminal on a mac), go to the 
> command mode, and paste the file name after :sp. However, I'm keen on knowing 
> any simple mouse-free solutions.
> 
> The vim buffer looks like the following:
> 
> aaa.F
> bbb.F
> ccc.F
> ddd.F
> eee.F

Ok, so first, the fastest way to do exactly what task you asked about 
(splitting a window with a filename already in your buffer) is to put the 
cursor on the file name, and type CTRL-W followed by f. See :help CTRL-W_f, 
there are also variants for opening at a certain line number, in a new tab, 
etc. See also :help gf, :help :find, :help :sfind, :help :tabfind.

Next, to copy text in your buffer, and get it on the command line, there is no 
reason to use the mouse. Copy the text with yy, then open a command line with 
:, then type CTRL-R, then type 0 to use the last yank register. You can also 
use any of the other Vim registers in this way. See :help registers.

Finally, to get the text under the cursor into the command-line without copying 
it at all, place the cursor on the word you desire, open a command-line with :, 
and type CTRL-R followed by CTRL-W or CTRL-A. CTRL-W will get the "word" under 
the cursor, CTRL-A will get the "WORD" under the cursor. See :help 
c_CTRL-R_CTRL-W and :help c_CTRL-R_CTRL-A. Actually, it looks like there is a 
CTRL-R CTRL-F and CTRL-P that I was unaware of, which are even closer to what 
you want.

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

Reply via email to