How can mouse support be enabled in terminal Emacs?
Solution 1
Hit F10 to open the menu and use the arrow keys to navigate to “Options” → “Customize Emacs” → “All Settings Matching…”. Type mouse
and Enter.
If your Emacs version doesn't have a menu when running in a terminal then run M-x customize
. (This means: press Alt+X, type customize
and press Enter.) Navigate to the search box, type mouse
and press Enter.
Mouse support is called “Xterm Mouse mode”. You can find that in the manual. The manual also gives a way to turn it on (for the current session) — M-x xterm-mouse-mode
.
In the Customize interface, on the setting you want to change, press Enter on “Show Value”. A “Toggle” button appears, press Enter on it. Then press Enter on the “State” box and choose either 0
for “Set for Current Session” or “1” for “Save for Future Sessions”. (You can choose 0
for now and come back there and choose 1
later if you're happy with the setting.)
Solution 2
add (xterm-mouse-mode 1)
to your init.el file
Related videos on Youtube
user
Updated on September 18, 2022Comments
-
user over 1 year
How can mouse support be enabled in an Emacs terminal session started with
emacs -nw
? Is there a keyboard shortcut or a flag to do this? If not how can it be done in terminal emulators? I use Guake.-
terdon over 8 yearsAre you running
emacs
in a GUI terminal emulator? What kind of support do you need? Placing the cursor? Copy/pasting? -
Mark Plotnick over 8 years
-
user over 8 years@terdon I am using guake.
-
terdon over 8 yearsOK, please edit your question and add that information. Also explain exactly what type of mouse support you need.
-
terdon over 8 years@MarkPlotnick that should be an answer. It's probably precisely what the OP needs.
-
user over 8 years@MarkPlotnick sorry I am new to emacs when I hit alt+x it goes in the bottom bar how do I run the command? Enter returns `' is not a valid command name
-
Mark Plotnick over 8 years@user Type ALT-X, then
xterm-mouse-mode
, then return. -
terdon over 8 years@MarkPlotnick IANAL but I really doubt there could be any licencing issue when quoting from an oficial manual!
-
user over 8 years@MarkPlotnick it worked
-
-
Robert Nixon about 3 yearsFor any other emacs noobs who are wondering, that's
~/.emacs.d/init.el
.