On Tue, July 17, 2012 09:12, Gautam wrote: > Hi All, > > Sometimes I prefer to yank a line that I know is at a particular line > number without actually moving the cursor to that line. > e.g. if I was at line # 100 in the buffer, and wanted to yank line # 5; I > would use: > :5,5y > > This would yank line # 5 into the default register. > Is there a better/alternative way to do this? > > > Also is it possible to "remotely" yank a line into a specific register? > I tried: > :5,5"ay > > but it didn't change the contents of register 'a'.
The Ex command :yank takes an optional argument of the register, so use :5y a to yank line 5 into register a. You can even do: :5y a 10 to copy the following 10 lines (e.g. lines 5-14) into register a regards, Christian -- 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
