TMUX: useful key-bindings

http://yalneb.blogspot.com/2017/05/tmux-useful-key-bindings.html

Continuing my TMUX series, this post will show you some useful keybindings which will make you much more productive, not only when working with TMUX, but also while configuring it to your liking.


Configuration


Edit the tmux.conf file, save it, and finally tell TMUX to reload it.
    $ gedit ~/.tmux.conf
    $ tmux -f ~/.tmux.conf


Key-bindings



Reload your configuration file from within TMUX

This is very handy to work with TMUX and configure it simultaneously. Now when you edit your TMUX configuration file, you can simply go to your TMUX terminal, press your prefix key (in my case I have to press 'CTRL' and 'b' simultaneously), and when the command prompt appears, simply press 'r'.

    # Reload configuration file from within TMUX
    unbind r
    bind-key r source-file ~/.tmux.conf \; display-message "Reload source-file: done"


Kill your window or session the fast (bust safe) way

Tired of closing panes individually? And what about when you have 5 windows open at the same time? It can get tiresome indeed.

    # Kill command for fast exit with confirmation prompt
    bind k confirm kill-window
    bind K confirm kill-server

Now you press your prefix key ('CTRL'+'b' by default) and you can use either 'k' to close the current window, or 'K' ('SHIFT'+'k') to kill your entire session. But do not worry, before doing so you will be prompted for confirmation.


Better page scrolling

If you are like me and scroll a lot with the PageUp and PageDown key on your keyboard, this will make your life much more pleasant. You will be able to scroll without having to press any weird key combination.

    # Better page scrolling
    bind -n PageUp copy-mode -eu


Switch panes using your keyboard's arrow keys

You should already have your mouse enabled in TMUX. But if you are on a simple terminal with no mouse support whatsoever, use this key-bindings to navigate your panes. As long as you hold the 'ALT' key down, your arrow keys will let you choose a pane. Also, if you have a highlighting window theme, you will be perfectly able to tell where your focus is.

    # Switch panes using Alt-arrow without prefix
    bind -n M-Left select-pane -L
    bind -n M-Right select-pane -R
    bind -n M-Up select-pane -U
    bind -n M-Down select-pane -D


No comments :

Post a Comment