Hi there, tech enthusiasts! If you’re a Tmux user like me, you know the power of this tool lies in its flexibility and customization potential. But, did you know you can control whether to use your mouse within a Tmux session? Yes, indeed! I was just as thrilled when I discovered this handy feature. So, in this blog post, I’ll walk you through how to enable or disable the mouse in Tmux. Fasten your seat belts and let’s dive in!
New to Tmux? No problem, the Tmux fundamentals have got you covered. If you’re already on board, let’s set sail!
To enable mouse on Tmux
Enabling mouse gives you options to ‘Select’ inside the tmux window or pane. Let’s look at how to enable copy-paste and select behaviour on tmux.
You can either run a command to activate it temporarily for that session by running the following keyword shortcuts-
Prefix
:set -g mouse on
By default the prefix is Ctrl-B
Ctrl-B
:set -g mouse on
You can also make this a default behaviour of tmux, by adding the setting in ~/.tmux.conf
–
set -g mouse on
After adding the above line to the configuration file, you can reload tmux conf–
tmux source-file ~/.tmux.conf
To disable mouse on Tmux
Disabling mouse gives you options to prevent the ‘Select’ option inside the tmux window or pane.
You can either run a command to activate it temporarily for that session by running
Prefix
:set -g mouse off
By default the prefix is Ctrl-B
Ctrl-B
:set -g mouse off
You can also make this a default behaviour of tmux, by adding the setting in ~/.tmux.conf
–
set -g mouse off
After adding the above line to the configuration file, you can reload tmux conf–
tmux source-file ~/.tmux.conf
If you are a vi
or vim
enthusiast, then you can enable vi-like copy paste behaviour on tmux as well.
Well, there we have it! You’ve now mastered the art of toggling the mouse functionality in Tmux. It’s these little tricks that make a big difference in our efficiency, isn’t it? I hope this blog has been enlightening and helpful. Do experiment with this feature and see how it fits into your workflow. Remember, the aim is to make your Tmux sessions as comfortable as possible. Stay curious and keep exploring!
You can also check out the complete tmux cheatsheet of keyboard shortcuts and mouse shortcuts.