tmux basic usage Feb 19 2018

After editing your config file (probably ~/.tmux.conf) you don't need to kill your tmux server and reload it, you can just go to tmux command mode and source your configfile:

1
<C-b>:source-file ~/.tmux

When you open use vim on tmux you might lose your colours that is because the term that tmux uses is screen and you might be using xterm, you can fix that by:

Adding to your alias(on your .bashrc .bash_profile or where every your alias are located):

1
alias tmux="TERM=screen-256color-bce tmux"

And change your tmux configuration to add (~/.tmux):

1
set -g default-terminal "xterm"

Fors some users that didn't work try:

1
set -g default-terminal "screen-256color"

reload your configuration file in tmux:

1
<C-b>: source ~/.tmux

And run tmux again, you'll see the changes

For copy and paste to work:

1
set -g set-clipboard on

If you want to have predefined layouts for tmux use teamocil

A nice feature is to use the predefined layouts you there are 5:

    1. even-horizontal
    2. even-vertical
    3. main-horizontal
    4. main-vertical
    5. tiled
        You access these layouts using:

1
<C-b>+ESC [layout number: 1 to 5]

Or cycle through the five by :

1
<C-b> Space

I sometimes use this option when I forget which number is which layout, just cycle through. Try it out it is very useful.

Copy send to clipboard:

1
2
3
4
5
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"

** If you want to check what else I'm currently doing, be sure to follow me on twitter @rderik or subscribe to the newsletter. If you want to send me a direct message, you can send it to derik@rderik.com.