mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-05-06 14:58:31 +00:00
Merge pull request #794 from wzsk/master
[tmux/en] Improve style & content
This commit is contained in:
commit
dd935d8d89
@ -2,7 +2,8 @@
|
|||||||
category: tool
|
category: tool
|
||||||
tool: tmux
|
tool: tmux
|
||||||
contributors:
|
contributors:
|
||||||
- ["kaernyk", "http://github.com/kaernyk"]
|
- ["kaernyk", "https://github.com/kaernyk"]
|
||||||
|
- ["jmaud", "https://github.com/jmaud"]
|
||||||
filename: LearnTmux.txt
|
filename: LearnTmux.txt
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -15,9 +16,9 @@ then later reattached.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
tmux [command] # Run a command
|
tmux [command] # Run a command
|
||||||
# 'tmux' with no commands will create a new
|
# 'tmux' with no commands will create a new session
|
||||||
session
|
|
||||||
|
|
||||||
new # Create a new session
|
new # Create a new session
|
||||||
-s "Session" # Create named session
|
-s "Session" # Create named session
|
||||||
@ -104,6 +105,7 @@ then later reattached.
|
|||||||
M-Up, M-Down # Resize the current pane in steps of five cells
|
M-Up, M-Down # Resize the current pane in steps of five cells
|
||||||
M-Left, M-Right
|
M-Left, M-Right
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Configuring ~/.tmux.conf
|
### Configuring ~/.tmux.conf
|
||||||
@ -111,54 +113,80 @@ then later reattached.
|
|||||||
tmux.conf can be used to set options automatically on start up, much
|
tmux.conf can be used to set options automatically on start up, much
|
||||||
like how .vimrc or init.el are used.
|
like how .vimrc or init.el are used.
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
# Example tmux.conf
|
# Example tmux.conf
|
||||||
# 2014.9
|
# 2014.10
|
||||||
|
|
||||||
|
|
||||||
### Keybinds
|
### General
|
||||||
######################################################################
|
###########################################################################
|
||||||
|
|
||||||
# Unbind C-b as the default prefix
|
# Enable UTF-8
|
||||||
unbind-key C-befix C-a
|
setw -g utf8 on
|
||||||
|
set-option -g status-utf8 on
|
||||||
|
|
||||||
# Return to previous window when prefix is pressed twice
|
# Scrollback/History limit
|
||||||
bind-key C-a last-window
|
set -g history-limit 2048
|
||||||
bind-key ` last-window
|
|
||||||
|
|
||||||
# Allow swapping C-a and ` using F11/F12
|
|
||||||
bind-key F11 set-option -g prefix C-a
|
|
||||||
bind-key F12 set-option -g prefix `
|
|
||||||
|
|
||||||
# Activate inner-most session (when nesting tmux)
|
|
||||||
# to send commands
|
|
||||||
bind-key a send-prefix
|
|
||||||
|
|
||||||
# Index Start
|
# Index Start
|
||||||
set -g base-index 1
|
set -g base-index 1
|
||||||
|
|
||||||
|
# Mouse
|
||||||
|
set-option -g mouse-select-pane on
|
||||||
|
|
||||||
|
# Force reload of config file
|
||||||
|
unbind r
|
||||||
|
bind r source-file ~/.tmux.conf
|
||||||
|
|
||||||
|
|
||||||
|
### Keybinds
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
# Unbind C-b as the default prefix
|
||||||
|
unbind C-b
|
||||||
|
|
||||||
|
# Set new default prefix
|
||||||
|
set-option -g prefix `
|
||||||
|
|
||||||
|
# Return to previous window when prefix is pressed twice
|
||||||
|
bind C-a last-window
|
||||||
|
bind ` last-window
|
||||||
|
|
||||||
|
# Allow swapping C-a and ` using F11/F12
|
||||||
|
bind F11 set-option -g prefix C-a
|
||||||
|
bind F12 set-option -g prefix `
|
||||||
|
|
||||||
|
# Keybind preference
|
||||||
|
setw -g mode-keys vi
|
||||||
|
set-option -g status-keys vi
|
||||||
|
|
||||||
|
# Moving between panes with vim movement keys
|
||||||
|
bind h select-pane -L
|
||||||
|
bind j select-pane -D
|
||||||
|
bind k select-pane -U
|
||||||
|
bind l select-pane -R
|
||||||
|
|
||||||
# Window Cycle/Swap
|
# Window Cycle/Swap
|
||||||
bind e previous-window
|
bind e previous-window
|
||||||
bind f next-window
|
bind f next-window
|
||||||
bind E swap-window -t -1
|
bind E swap-window -t -1
|
||||||
bind F swap-window -t +1
|
bind F swap-window -t +1
|
||||||
|
|
||||||
# easy-to-remember split pane commands
|
# Easy split pane commands
|
||||||
bind | split-window -h
|
bind = split-window -h
|
||||||
bind - split-window -v
|
bind - split-window -v
|
||||||
unbind '"'
|
unbind '"'
|
||||||
unbind %
|
unbind %
|
||||||
|
|
||||||
# moving between panes with vim movement keys
|
# Activate inner-most session (when nesting tmux) to send commands
|
||||||
bind h select-pane -L
|
bind a send-prefix
|
||||||
bind j select-pane -D
|
|
||||||
bind k select-pane -U
|
|
||||||
bind l select-pane -R
|
|
||||||
|
|
||||||
|
|
||||||
### Theme
|
### Theme
|
||||||
#####################################################################
|
###########################################################################
|
||||||
|
|
||||||
# Statusbar Color Palette
|
# Statusbar Color Palatte
|
||||||
set-option -g status-justify left
|
set-option -g status-justify left
|
||||||
set-option -g status-bg black
|
set-option -g status-bg black
|
||||||
set-option -g status-fg white
|
set-option -g status-fg white
|
||||||
@ -187,14 +215,7 @@ setw -g window-status-activity-fg yellow
|
|||||||
|
|
||||||
|
|
||||||
### UI
|
### UI
|
||||||
######################################################################
|
###########################################################################
|
||||||
|
|
||||||
# Statusbar
|
|
||||||
set-option -g status-utf8 on
|
|
||||||
|
|
||||||
# Keybind preference
|
|
||||||
setw -g mode-keys vi
|
|
||||||
set-option -g status-keys vi
|
|
||||||
|
|
||||||
# Notification
|
# Notification
|
||||||
setw -g monitor-activity on
|
setw -g monitor-activity on
|
||||||
@ -202,41 +223,20 @@ set -g visual-activity on
|
|||||||
set-option -g bell-action any
|
set-option -g bell-action any
|
||||||
set-option -g visual-bell off
|
set-option -g visual-bell off
|
||||||
|
|
||||||
# Mouse
|
|
||||||
setw -g mode-mouse on
|
|
||||||
set-option -g mouse-select-pane on
|
|
||||||
set -g mouse-resize-pane on
|
|
||||||
set -g mouse-select-window on
|
|
||||||
|
|
||||||
# Automatically set window titles
|
# Automatically set window titles
|
||||||
set-option -g set-titles on
|
set-option -g set-titles on
|
||||||
|
set-option -g set-titles-string '#H:#S.#I.#P #W #T' # window number,program name,active (or not)
|
||||||
# window number,program name,active (or not)
|
|
||||||
set-option -g set-titles-string '#H:#S.#I.#P #W #T'
|
|
||||||
|
|
||||||
# Statusbar Adjustments
|
# Statusbar Adjustments
|
||||||
set -g status-left '#[fg=red]#H#[fg=green]:#[fg=white]#S #[fg=green]][#[default]'
|
set -g status-left "#[fg=red] #H#[fg=green]:#[fg=white]#S#[fg=green] |#[default]"
|
||||||
set -g status-interval 3
|
|
||||||
|
|
||||||
# Statusbar with right-aligned Date / Time
|
|
||||||
#set -g status-right '#[fg=green]][#[fg=white] #T #[fg=green]][ #[fg=blue]%Y-%m-%d #[fg=white]%H:%M#[default]'
|
|
||||||
|
|
||||||
# Show performance counters in statusbar
|
# Show performance counters in statusbar
|
||||||
# Requires https://github.com/thewtex/tmux-mem-cpu-load/
|
# Requires https://github.com/thewtex/tmux-mem-cpu-load/
|
||||||
#set -g status-right '#[fg=green]][#[fg=white] #(tmux-mem-cpu-load 5 4) #[fg=green]][ #[fg=yellow]%H:%M#[default]'
|
set -g status-interval 4
|
||||||
|
set -g status-right "#[fg=green] | #[fg=white]#(tmux-mem-cpu-load)#[fg=green] | #[fg=cyan]%H:%M #[default]"
|
||||||
|
|
||||||
|
|
||||||
### Misc
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
# Scrollback/History limit
|
|
||||||
set -g history-limit 4096
|
|
||||||
|
|
||||||
bind r source-file ~/.tmux.conf
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### External Resources
|
|
||||||
|
|
||||||
<a href="http://tmux.sourceforge.net/">Tmux | Home</a><br>
|
<a href="http://tmux.sourceforge.net/">Tmux | Home</a><br>
|
||||||
<a href="http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/tmux.1?query=tmux">Tmux Manual page</a><br>
|
<a href="http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/tmux.1?query=tmux">Tmux Manual page</a><br>
|
||||||
<a href="http://wiki.gentoo.org/wiki/Tmux">Archlinux Wiki</a><br>
|
<a href="http://wiki.gentoo.org/wiki/Tmux">Archlinux Wiki</a><br>
|
||||||
|
Loading…
Reference in New Issue
Block a user