pico/nano in Iterm2/Terminal Copy & Paste

Joined
Feb 7, 2021
Messages
104
Reaction score
4
Points
18
Hi folks.

I am in pico editing a file. I can't find any proper working instructions for pico, and the version information for my pico is actually GNU nano version 2.0.6. So I ask here.

I'm wanting to duplicate a line. That would mean highlighting a line, copying it into the cutbuffer, then pasting it. Ya it's more than using the mouse, but it's interesting at a minimum. I'm looking at ^K and ^U, for selecting and cutting/pasting a line. I can accomplish this by cut, then paste back, then go to the destination and paste again. Seems odd.

⌃6 allows me to highlight text using the arrow keys.

M-^ (M is Meta, read below) but I don't know what the Meta key is. Escape, Control, Option, and Command don't do anything with ^.

I'm expecting this to have a duplicate command, and perhaps a move-line command, but it seems no luck.

Anyway, if anybody knows how to do this, I'd love to see the reference. Cheers


Get Help:

Code:
Main nano help text

 The nano editor is designed to emulate the functionality and ease-of-use of the UW Pico text editor.  There are four main sections of the editor.  The top line
 shows the program version, the current filename being edited, and whether or not the file has been modified.  Next is the main editor window showing the file
 being edited.  The status line is the third line from the bottom and shows important messages.  The bottom two lines show the most commonly used shortcuts in
 the editor.

 The notation for shortcuts is as follows: Control-key sequences are notated with a caret (^) symbol and can be entered either by using the Control (Ctrl) key
 or pressing the Escape (Esc) key twice.  Escape-key sequences are notated with the Meta (M-) symbol and can be entered using either the Esc, Alt, or Meta key
 depending on your keyboard setup.  Also, pressing Esc twice and then typing a three-digit decimal number from 000 to 255 will enter the character with the
 corresponding value.  The following keystrokes are available in the main editor window.  Alternative keys are shown in parentheses:

^G      (F1)            Display this help text
^X      (F2)            Close the current file buffer / Exit from nano
^O      (F3)            Write the current file to disk
^J      (F4)            Justify the current paragraph

^R      (F5)            Insert another file into the current one
^W      (F6)            Search for a string or a regular expression
^Y      (F7)            Move to the previous screen
^V      (F8)            Move to the next screen

^K      (F9)            Cut the current line and store it in the cutbuffer
^U      (F10)           Uncut from the cutbuffer into the current line
^C      (F11)           Display the position of the cursor
^T      (F12)           Invoke the spell checker, if available

^_      (F13)   (M-G)   Go to line and column number
^\      (F14)   (M-R)   Replace a string or a regular expression
^^      (F15)   (M-A)   Mark text at the cursor position
        (F16)   (M-W)   Repeat last search

M-^             (M-6)   Copy the current line and store it in the cutbuffer
M-}                     Indent the current line
M-{                     Unindent the current line

^F                      Move forward one character
^B                      Move back one character
^Space                  Move forward one word
M-Space                 Move back one word
^P                      Move to the previous line
^N                      Move to the next line

^A                      Move to the beginning of the current line
^E                      Move to the end of the current line
M-(             (M-9)   Move to the beginning of the current paragraph
M-)             (M-0)   Move to the end of the current paragraph
M-\             (M-|)   Move to the first line of the file
M-/             (M-?)   Move to the last line of the file

M-]                     Move to the matching bracket
M--             (M-_)   Scroll up one line without scrolling the cursor
M-+             (M-=)   Scroll down one line without scrolling the cursor

M-<             (M-,)   Switch to the previous file buffer
M->             (M-.)   Switch to the next file buffer

M-V                     Insert the next keystroke verbatim
^I                      Insert a tab at the cursor position
^M                      Insert a newline at the cursor position
^D                      Delete the character under the cursor
^H                      Delete the character to the left of the cursor
M-T                     Cut from the cursor position to the end of the file

M-J                     Justify the entire file
M-D                     Count the number of words, lines, and characters
^L                      Refresh (redraw) the current screen

M-X                     Help mode enable/disable
M-C                     Constant cursor position display enable/disable
M-O                     Use of one more line for editing enable/disable
M-S                     Smooth scrolling enable/disable
M-P                     Whitespace display enable/disable
M-Y                     Color syntax highlighting enable/disable

M-H                     Smart home key enable/disable
M-I                     Auto indent enable/disable
M-K                     Cut to end enable/disable
M-L                     Long line wrapping enable/disable
M-Q                     Conversion of typed tabs to spaces enable/disable

M-B                     Backup files enable/disable
M-F                     Multiple file buffers enable/disable
M-M                     Mouse support enable/disable
M-N                     No conversion from DOS/Mac format enable/disable
M-Z                     Suspension enable/disable
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
16,032
Reaction score
2,437
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
Why would you willingly want to use either of those editors in this day and age. If you ABSOLUTELY have to edit on the command line, just use VI.
 
OP
daBee
Joined
Feb 7, 2021
Messages
104
Reaction score
4
Points
18
Why would you willingly want to use either of those editors in this day and age. If you ABSOLUTELY have to edit on the command line, just use VI.

Why would I want to learn VI when these two tools are installed on most distros, and are dirt easy? Like I need another thing to learn.
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
16,032
Reaction score
2,437
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
Hit CTRL+6 and you should see "Mark Set" at the bottom, now use your arrows to select any characters/lines you want. Now CTRL+k to cut the lines, move to the new area and CTRL+u uncut it.

There isn't a copy it seems, so you have to cut, then uncut once to paste the original text back and uncut again to duplicate it.

In VI, you would just go to the line and hit 'yy' to yank a single line or '5'+'yy' to yank 5 lines and then move to a new line and hit 'p' to paste how many ever lines you yanked.

Vi is so much more powerful as a full time editor on the command line. But hey, you do you.
 
OP
daBee
Joined
Feb 7, 2021
Messages
104
Reaction score
4
Points
18
Ya that's what I thought.

Ya I got buddies that love VI, but I just didn't take to it. I needed something quick on Linux. Maybe one day.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top