Copy Code with Line Numbers


#1

Hello there!

I am a newbie at atom.io and feel wonderful that there is a greate text editor like this available for free.
By the way, after checked this for a while, I have some problem that I am not sure there is any way I can copy both code and the line numbers together like the ‘Copy With Line Numbers’ package for Sublime.

I have found a package with the name like that but could not install.
Ref: https://atom.io/packages/copy-with-line-numbers

If there is another package or any way to copy lines and its code, please let me know. It would be a big move to atom.io.
Thank you in advance.


#2

What stopped you?


#3

In other terms, how did you try to install the package? Did you had errors? Which ones? Could you install other packages? What is your platform? etc.


#4

Thank you for your reply. Sorry that I didn’t tell you some details.
I have been using atom.io on mac. I can install other packages accept the one named ‘copy-with-line-numbers’ created by yassh (https://atom.io/packages/copy-with-line-numbers).

I am facing an error told that it’s unable to download the package as below image. Please advise.


#5

I ask for this package because I would like to copy source code with its line numbers for referencing in my work.
If there is any alternative way to do things like this, please advise.


#6

The error is because the repository doesn’t exist anymore. It was deleted before the package was deregistered. (@leedohm, would you mind deleting it?)

I suppose a command like that would take the current selection, run selection.getBufferRange(), then selection.getText(), text.split("\n"), run a for loop to iterate through the lines and attach the number and a \t at the front, then clipboard.write() the whole thing with new newlines.


#7

Not at all :grinning: Deleted.