posting code (by copy & paste) with line numbers
-
@Lycan-Thrope said:
I just checked by duplicating that copy/paste and it appears it defaults to the D language color coding
What are you pasting into?
For this testing I simply created a new tab by pressing Ctrl+n and pasting into that.
The default new document type is “Normal” language. -
@Alan-Kilborn said in posting code (by copy & paste) with line numbers:
What are you pasting into?
After clicking the new file button, it opens a ‘new1’ document and I paste into that, and it appears at least for me, to pick the
D
Language. Not sure why, but I’ve noticed that I don’t default toNone
since I’ve been working on my different versions of dBASE UDL’s, and have had them listed in the UDL menu. I now seem to have to specifically chooseNone
if I want to make a document display that way that I haven’t already saved with a .txt file extension. -
@Lycan-Thrope said:
After clicking the new file button, it opens a ‘new1’ document and I paste into that, and it appears at least for me, to pick the D Language
This sounds wrong to me. If it is going to pick
D
for new document creation, it should do so as soon as File > New (equivalent to Ctrl+n) is executed, not when you paste content. Doing so at paste time would require N++ to be examining your content and making a guess based on it, which I doubt that it does as that would not be easy. -
If it’s automatically picking the
D
language, have you looked at Settings > Preferences > New Document > Default Language – does it sayD
instead ofNone (Normal Text)
? If so, change that preference back, and it will go back to defaulting to normal text. (That setting cannot be affected by UDL, so I don’t see how your dBASE UDLs could be doing anything to influence it…) -
<OK_boomer_jest_mode>
TRIGGER WARNING: Non-Notepad++ solution here; forum purists should ignore this post!
</OK_boomer_jest_mode>@gooly If your code snippet is in a file, say, snip.txt, then an AWK one-liner will easily handle this task (I use GAWK):
gawk "{print(FNR,$0)}" snip.txt > nsnip.txt
Given this snip.txt file:
This is a simple bit of text. It is not much of an example, but it will do.
the resulting nsnip.txt file will be:
1 This is a simple bit 2 of text. It is not 3 much of an example, 4 but it will do.
Anyone who writes code would be well-served by at least a cursory familiarity with some version of AWK.
-
Reminder: A decision by the owner of this forum: https://community.notepad-plus-plus.org/topic/26795
-
Hi, @alan-kilborn,
Sorry, Alan, I did NOT notice this specific post from @donho, in order to place all alternate solutions, not related with N++ !
So, as an
admin
user, I was able to move my post totopic ID :
26795.BR
guy038
-
@Alan-Kilborn If I only knew how to reply while moving the reply to another category.
-
@Jim-Dailey said in posting code (by copy & paste) with line numbers:
If I only knew how to reply while moving the reply to another category.
Unfortunately, Reply ▼ > Reply as Topic doesn’t allow you to reply in an existing topic.
So you have to use a workaround: When you click to Quote a reply, it will give you the @-mention and the link to the post you are replying to; you can then copy that and Discard the original reply. Then go to the other Topic, click the top-level Reply (so it’s not attached to a specific post), and paste the preamble into the other Topic – it will keep the @-mention, the link to the previous Topic, and any quoted text, and you can use that as the basis for your forked conversation, no admin/moderator powers required. HTH.
-
@PeterJones Thanks for the info.
I think it will be much easier for me to simply lurk and keep quiet about anything unrelated to Notepad++, which is, without a doubt, one of the best text editors around, free or otherwise.
-
@PeterJones said in posting code (by copy & paste) with line numbers:
If it’s automatically picking the
D
language, have you looked at Settings > Preferences > New Document > Default Language – does it sayD
instead ofNone (Normal Text)
? If so, change that preference back, and it will go back to defaulting to normal text. (That setting cannot be affected by UDL, so I don’t see how your dBASE UDLs could be doing anything to influence it…)@PeterJones ,
Thanks, this was the cause.
Now that I think back, I think I was doing a help in the forum and used that to show the language setting and take screenshots…and forgot to put it back. DOH!!
Back to normal…thanks for curing my forgetfulness. :-)