On 2019-03-12, fefe17 wrote:
> I often use vim for source code auditing, where it can excel thanks its syntax
> highlighting, speedy navigation and ctags integration. But when I find a bug, 
> I
> want to copy it into my report. For that I need to copy the file name, and the
> code -- preferably including line numbers.
> 
> With console vim this is no problem. But on Windows, console vim does not
> perform as well as on Linux. So I use gvim there. But in gvim I cannot copy&
> paste from the status line (where the filename is printed after C-G) and copy
> and paste from the code does not include the line numbers (I use :set 
> numbers).
> 
> For many regular use cases that is good, but for code auditing it is very bad.
> Please give me a setting so I can copy&paste include line numbers and file
> name.

Here's an idea.  The :nu command prints lines with their line
numbers and the :redir command redirects printed output to
a register.  You could create a command like this,

    :command -range Copy redir @*|<line1>,<line2>nu|redir END

which will copy the specified range into the * register.  Then, when
you want to copy-and-paste some code, highlight those lines as you
normally would, but then type the command, which will appear on the
command line like this:

    :'<,'>Copy

For the filename, you can execute:

    :let @*=@%

which will copy the filename into the * register.  You could create
a command or mapping for that, too.

HTH,
Gary

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui