[Qt-creator] Copy code with line numbers?

Andre Poenitz Andre.Poenitz at qt.io
Fri Apr 27 10:02:18 CEST 2018


Murphy, Sean wrote:
> Is there a way in Qt Creator to copy a block of code out of Creator
>  including the line numbers? 

Nothing direct that I am aware of.

> I *sometimes* find it handy to do that 
> when emailing with a co-worker explaining how a certain segment 
> of code works, where I can just refer back to line numbers in my 
> explanation which is above or below the actual code.

If you are using FakeVim (or enable it temporary using Alt-v Alt-v) on 
a *nix-ish sytem you can

  :%!cat -n 

to replace your editor content with content-with-extra-line-numbers,
cut & paste from there and then

   u

to undo (and Alt-v Alt-v to switch off FakeVim if so desired)

Andre'



More information about the Qt-creator mailing list