To swap with a specific pane, press Ctrl + b
followed by Ctrl + o
(to rotate panes) or Ctrl + b
followed by swap-pane.
Key takeaways:
Tmux is a terminal multiplexer that enables users to manage multiple terminal sessions in a single window by splitting the terminal into panes.
While Tmux users commonly navigate panes using keyboard shortcuts, mouse support can be enabled to switch between panes with ease.
We can activate mouse control with the command
tmux set -g mouse on
, allowing you to interact with panes using the mouse (e.g., clicking to switch between panes).The command
tmux splitw
splits the terminal into multiple panes. By default, it splits horizontally, but you can also usetmux splitw -v
for vertical splits.
Tmux is a powerful terminal multiplexer that allows users to manage multiple terminal sessions within a single window. One of its most valuable features is its ability to split the terminal into multiple panes. While most users rely on keyboard shortcuts to navigate and switch between panes, Tmux also offers mouse support, making it easier to manage panes with a few clicks.
In this Answer, we’ll show how to switch panes using the mouse in Tmux.
To enable mouse control for switching between panes in Tmux, use the following command:
tmux set -g mouse on
This command enables global mouse support in Tmux. With the mouse mode turned on, you can now interact with the panes using your mouse. You can click on a pane to activate it, allowing you to switch between panes effortlessly.
Once mouse support is enabled, you can create and manage multiple panes within a single Tmux session. To split the current terminal window into two panes, use the following command:
tmux splitw
This command splits the window horizontally by default, allowing you to work on multiple tasks simultaneously. You can also use tmux splitw -v
to split the window vertically.
Tmux will launch automatically in the terminal below. To test this functionality, use the command above to split the window into multiple panes.
We are now able to split our terminal and seamlessly switch between the split panes. This enables more flexible usage of tmux and expands our range of work. For example, we can switch to another pane while another is blocked by a process or scroll through a document in one while editing in another.
With just two commands—tmux set -g mouse on
to enable mouse support and tmux splitw
to split panes—you can seamlessly switch between panes using your mouse in Tmux. This feature simplifies navigation and enhances productivity, especially when managing multiple panes in your terminal environment.
Haven’t found what you were looking for? Contact Us
Free Resources