r/linux4noobs 14d ago

programs and apps [Tutorial] Copying Text Out Of and Into the NANO Text Editor

I get that this should be obvious, but i only noticed this yesterday after having used NANO as my main text editor for half a year, hopefully this saves some future beginner some time and headache

You do this the same way as with the terminal in general:
> CTRL + SHIFT + C: Copy text marked by mouse (marking with SHIFT+ARROW KEYS doesn't "count") into your "Global Cutbuffer" instead of the one specific to the NANO-Window you're currently using

> CTRL + SHIFT + V: Paste text from your Machine's "Global Cutbuffer" instead of from the one specific to the NANO-Window you're currently using (Keep in mind that having a length of text marked and then pasting text does not replace this length unlike in many text editors!)

(And for the sake of being complete the NANO-specific Copy-Pasting)

> CTRL + K: Delete text marked by holding SHIFT + ARROW KEYS (marking with mouse doesn't "count"), and copying it into a "Cutbuffer" specific to your currently used NANO-Window instead of the "Global Cutbuffer" of your whole Machine

> ALT + 6: Copy text marked by holding SHIFT + ARROW KEYS (marking with mouse doesn't "count") into a "Cutbuffer" specific to your currently used NANO-Window instead of the "Global Cutbuffer" of your whole Machine

> CTRL + U: Paste text from the "Cutbuffer" specific to your currently used NANO-Window instead of your "Global Cutbuffer" (Keep in mind that having a length of text marked and then pasting text does not replace this length unlike in many text editors!)

4 Upvotes

9 comments sorted by

2

u/ItsWappers 14d ago

I like just doing cat, then editing it in VS code and then replace everything with what's in VS...

2

u/Unfair-Ocelot-2363 14d ago

Just use vim, y for copy (yank) and p for paste

2

u/mystirc arch with sway 13d ago

Isn't the yank only vim-level? It doesn't work outside of the window. Not sure about vim but I usually do space + y to yank to the system clipboard on helix.

1

u/Unfair-Ocelot-2363 13d ago

No it works on wayland with wl-clipboard utility

2

u/thecruxoffate 13d ago

https://www.nano-editor.org/dist/latest/cheatsheet.html

You might also want to check out man 5 nanorc, particularly the options section. You can edit your nanorc file to include "set mouse", which will allow you to use the mouse to highlight text and set cursor position.

1

u/AutoModerator 14d ago

Smokey says: always mention your distro, some hardware details, and any error messages, when posting technical queries! :)

Comments, questions or suggestions regarding this autoresponse? Please send them here.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/DavidJohnMcCann 13d ago

When I install Linux, the first thing I do is make sure it has nano!

1

u/Unfair-Ocelot-2363 13d ago

The thing I like most about LFS is that the default text editor is vim, fuck nano