Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Package:Tmux"

From Funtoo
Jump to navigation Jump to search
Line 36: Line 36:
You can do much more with tmux, but this is the minimum to know if you want to quickly get started.
You can do much more with tmux, but this is the minimum to know if you want to quickly get started.


== Keyboard Shortcuts ==
{|class="table table-striped"
|| Shortcut || Description
|-
|| <code>C-b ?</code> || List all keybindings
|-
|| <code>C-b :</code> || Enter tmux command prompt
|-
|| <code>C-b d</code> || Detach session
|-
|| <code>C-b c</code> || Create window
|-
|| <code>C-b n</code> || Switch to next window
|-
|| <code>C-b p</code> || Switch to previous window
|-
|| <code>C-b l</code> || Switch to last window
|-
|| <code>C-b "</code> || Split current pane into top and bottom
|-
|| <code>C-b %</code> || Split current pane into left and right
|-
|| <code>C-b o</code> || Move to next pane
|-
|| <code>C-b ;</code> || Move to previous pane
|-
|| <code>C-b [</code> || Enter copy/scroll mode
|}
== Configuration ==
=== ~/.tmux.conf ===
<code>~/.tmux.conf</code> gets loaded on tmux startup.
{{file|name=~/.tmux.conf|lang=|desc=tmux configuration|body=
set -g base-index 1
set -g default-terminal "st-256color"
set -g history-limit 4096
set -g status-left ''
set -g status-right "#[bg=brightblack]#[fg=green] #T "
set -g status-style "bg=black"
setw -g pane-base-index 1
setw -g window-status-format "#[bg=magenta]#[fg=black] #I #[bg=brightblack]#[fg=green] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=black] #I #[bg=green]#[fg=black] #W "
bind r source-file ~/.tmux.conf
}}
[[Category:HOWTO]]
{{EbuildFooter}}
{{EbuildFooter}}

Revision as of 14:14, October 4, 2014

Tmux

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.

Tmux is a terminal multiplexer (just as screen, which is generally installed by default on servers). It enables you to run multiple terminals in one. You can arrange them in multiple tabs that you can split into multiple panes as well.

USE flags

Name Default Recommended Description
debug No Adds extra debug codepaths (~description needs to be detailed for this specific ebuild)
selinux No No Enables Security Enhanced Linux support. You must not set this use flag manually or breakage will occur! (See SELinux)
vim-syntax No Provides syntax plugin for Vim in tmux configuration files

Installation

root # emerge -a tmux

Getting Started

To launch Tmux, run tmux in a terminal. This should clear your current terminal and display a status bar on the bottom. In this status bar, you should see something like "[0] 0:bash*". This means you are on session 0 ([0]), window 0 (0:) and you run "bash".

Tmux uses Ctrl+b as default prefix. This means that before issuing any command you will have to hit Ctrl+b to tell tmux you are asking it. For instance, type Ctrl+b and then %. This should split vertically the window to add a new pane. Now issue Ctrl+b ", this will split the new pane horizontally to create a new pane. You can switch against panes with Ctrl+b Left/Up/Right/Down (Left/Up/Right/Down being the arrow keys).

Another cool stuff is windows. Splitting your window into panes is good, but for readability purpose, you can't indefinitely split your window. So you can open a new window (which would behave more like a tab) by issuing Ctrl+b c. Your current window will be replaced by a brand new one. However you will notice that your status bar now looks like this "[0] 0:bash- 1:bash*". The minus symbol (-) means this is the last visited window. The asterisk symbol (*) means this is the current window. You can add panes to this window as well. To go back to the first window, issue Ctrl+b 0. Generally speaking, issue Ctrl+b <window-id> to go to the window <window-id>.

You can do much more with tmux, but this is the minimum to know if you want to quickly get started.

Keyboard Shortcuts

Shortcut Description
C-b ? List all keybindings
C-b : Enter tmux command prompt
C-b d Detach session
C-b c Create window
C-b n Switch to next window
C-b p Switch to previous window
C-b l Switch to last window
C-b " Split current pane into top and bottom
C-b % Split current pane into left and right
C-b o Move to next pane
C-b ; Move to previous pane
C-b [ Enter copy/scroll mode

Configuration

~/.tmux.conf

~/.tmux.conf gets loaded on tmux startup.

   ~/.tmux.conf - tmux configuration
set -g base-index 1
set -g default-terminal "st-256color"
set -g history-limit 4096
set -g status-left ''
set -g status-right "#[bg=brightblack]#[fg=green] #T "
set -g status-style "bg=black"

setw -g pane-base-index 1
setw -g window-status-format "#[bg=magenta]#[fg=black] #I #[bg=brightblack]#[fg=green] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=black] #I #[bg=green]#[fg=black] #W "

bind r source-file ~/.tmux.conf