Discussion:
[Qt-creator] Copy code with line numbers?
Murphy, Sean
2018-04-26 19:08:13 UTC
Permalink
Is there a way in Qt Creator to copy a block of code out of Creator including the line numbers? 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.

Sean



This message has been scanned for malware by Forcepoint. www.forcepoint.com
Andre Poenitz
2018-04-27 08:02:18 UTC
Permalink
Post by Murphy, Sean
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.
Post by Murphy, Sean
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'
Jason H
2018-04-27 08:44:10 UTC
Permalink
Sent: Thursday, April 26, 2018 at 9:08 PM
Subject: [Qt-creator] Copy code with line numbers?
Is there a way in Qt Creator to copy a block of code out of Creator including the line numbers? 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.
Screenshot?
Pastebin?
Murphy, Sean
2018-04-27 13:45:51 UTC
Permalink
Post by Murphy, Sean
Post by Murphy, Sean
Is there a way in Qt Creator to copy a block of code out of Creator including
the line numbers? 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.
Screenshot?
I thought about that, but it would be more useful to the recipient if they could copy/paste
snippets out of the code.
Post by Murphy, Sean
Pastebin?
That might be closer, but the downside is the explanation of the code in my email
and the code itself aren't near each other.

This isn't a big issue, just a curiosity on my part. It arose by my manager asking if we
were sure a certain chunk of code does what we thought it does, so I was pulling
that chunk out of the project, but then providing a little context of what some of the
variables were, where this code is called, etc. since it was just a code snippet, and I
was thinking how much more helpful it would have been if there were line numbers
automatically included.

Sean


This message has been scanned for malware by Forcepoint. www.forcepoint.com
Konstantin Tokarev
2018-04-27 13:57:03 UTC
Permalink
Post by Murphy, Sean
Is there a way in Qt Creator to copy a block of code out of Creator including the line numbers? 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.
/me personally would use "Edit with vi" and copy text block from terminal with mouse.
(I have "set number" in vimrc)
Post by Murphy, Sean
Sean
This message has been scanned for malware by Forcepoint. www.forcepoint.com
_______________________________________________
Qt-creator mailing list
http://lists.qt-project.org/mailman/listinfo/qt-creator
--
Regards,
Konstantin
Loading...