18

I am writing a text file through the terminal using nano; everytime I need to select a position of a certain line of my text I can't help but scrolling all the lines moving the blinking cursor using the keyboard arrows; is there a way to avoid this and just use the mouse to directly select where I want the cursor to be?

1
  • Reminder: if I want to use gedit I need to type: ssh -X -l root name@ip Dec 13, 2014 at 0:57

4 Answers 4

23

You can start nano with the -m (--mouse) option. From man nano

   -m (--mouse)
          Enable  mouse  support,  if  available  for  your system.  When
          enabled, mouse clicks can be used to place the cursor, set  the
          mark  (with  a double click), and execute shortcuts.  The mouse
          will work in the X Window System, and on the console  when  gpm
          is running.
2
  • 1
    That's what I was looking for! thank you very much!!! Dec 13, 2014 at 2:15
  • 4
    Ok I just wasted 15 years hitting the arrows to navigate. This the most useful "hidden" feature ever. It should be by default. May 4, 2019 at 21:10
13

Add this to your ~/.nanorc file

set mouse

This will cause the mouse to work every time you open nano

(source The GNU nanorc documentation)

9

See The GNU nano text editor - Feature Toggles:

[...] the Meta key (Alt or Cmd, shown as M-) [...]

[...]

Mouse Support

    M-M toggles the -m (--mouse) command-line option.

Esc+M (always after releasing both) might work, too.

Esc, M (after each other) might work, too.

0
2

I think I understand that you want to go to a specific line and a specific character in that line, yes? Without moving the cursor manually through the entire file.

In nano:

If you hit Ctrl+_ (that's Control Shift -, on my keyboard), it will prompt you to enter a line and column number.

2
  • 2
    That's good to know but in the question i was wandering if i can do what you just said with the mouse Dec 13, 2014 at 0:48
  • This works but, dude, it is cumbersome to get the line and column to edit.
    – Francisco
    Nov 1, 2016 at 14:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .