Probably not the right place to ask this question, but I couldn't find the answer anywhere. As the title says, is there a way to enable mouse wheel scrolling in the nano editor? (specifically ubuntu 14.04)
2 Answers
Nano doesn't support using the mouse wheel to scroll. You can enable nano's (limited) mouse support with alt-M or with --mouse
when starting nano (another invocation returns to whatever mouse support your terminal has), but that's it:
−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. Text can still be selected through dragging by holding down the Shift key.
(https://www.nano-editor.org/dist/v2.6/nano.1.html)
By default, mouse services are provided by the terminal window. The mouse works almost the same as in a GUI editor. You can highlight text, right-click to copy and paste, and use the middle mouse button for pasting text from the buffer. However, when you use the middle mouse button to paste text, the text is pasted at the current cursor location, not at the mouse pointer location. Other limitations exist. For example, you cannot use the mouse to cut or delete text, nor can you use the mouse to scroll through the file.
Nano has its own built-in mouse services, but they are limited. They provide only the ability to move the cursor to the point where you click, and to mark the beginning and end of a section of text. Use the Alt-M key combination to toggle between using the terminal's mouse services and nano's built-in mouse services.

- 859
- 16
- 25
-
Thank you for the information. Do you know of any other terminal editors that may have this functionality that is similar to nano and not as much like vim? – jj172 Jun 23 '16 at 00:21
-
1terminal editor + good mouse support is tough, esp. scroll wheel. A quick glance at https://en.wikipedia.org/wiki/List_of_text_editors#Others ... I guess I'd try mcedit or suplemon, with the caveat that I haven't tried them, and recommending an editor that isn't one of The Big Ones feels weird. I think this is the point at which you should embrace sublime/atom or vim/emacs :) – meatspace Jun 23 '16 at 01:25
-
-
I second meatspace's recommendation of atom. It's package system and innate hackability give it 'big one' like flexability in an IDE environment. – lilHar Sep 18 '19 at 21:10
To scroll by mouse: toggle mouse support OFF: Alt + m
, or Esc
m
. The caveat is, it will also reposition the cursor.
Of course once mouse support is disabled, using the mouse to position the cursor will no longer be possible. The simple workaround is to toggle mouse on/off as needed.
The reason this works is because, with mouse support disabled in nano, it falls back on the terminal to handle the mouse. It does this by printing to the screen whatever input it receives from the mouse as a stream of escape sequences. Since these escape sequences are standard, nano knows exactly what to do with them and positions the cursor accordingly.

- 150
- 2
- 5