Tmux Learning and Configuration

Source: Internet
Author: User
Tags clear screen

First, the main course

Follow the tutorials in the links below to learn

Important: Here are two different configuration scenarios, 1 and 2 are one, the other is 3, the two are not compatible, if configured sequentially, the last 3 will be 1 and 2 newly added configuration top off, please choose your own.

1. Until the "Easy Landscaping" section of the link, where there is a pit for configuration problems with Tmux, we will first configure it as follows:

(1). If no configuration file is created, create a profile: Terminal input:touch ~/.tmux.conf
(2). Terminal Open configuration file (conf file): open-e ~/.tmux.conf
-E [refers to open with a text editor]
OPEN-A application name is opened file address [specify software open file address]
OPEN-T file address [default app open file]

(3). Enter the following and save:

# Send prefixset-option-g prefix c-aunbind-key c-abind-key c-a send-prefix# use alt-arrow keys to switch panesbind-n M-L EFT select-pane-lbind-n m-right select-pane-rbind-n m-up select-pane-ubind-n m-down select-pane-d# Shift arrow to S  Witch windowsbind-n s-left previous-windowbind-n s-right next-window# Mouse modeset-g Mouse on# Set Easier window split Keysbind-key v split-window-hbind-key h split-window-v# Easy config reloadbind-key r source-file ~/.tmux.conf \; Display-message "Tmux.conf Reloaded"

(4). Now return to the Iterm terminal interface to see if there is a session in the background, only after deleting all the old sessions, the configuration will be in effect in the new session.

Tmux Lstmux kill-session-t <session-name>

The first line means: View all the current session
The second line means: delete the specified session

This idea comes from "4" in the following link:

(5). Changes occurring in Tmux

(5.1) The prefix key becomes: Ctrl + A (hereinafter referred to as CA)

(5.2) Several ways to switch the screen:
Ca + Direction key;
ALT + ARROW keys in the upper and lower keys [can only move up and down, not around];
Mouse click to toggle

(5.3) Split-screen mode:
Ca + V Vertical split screen Ca + v horizontal split screen;
CA +% Vertical split screen CA + "Horizontal split screen

(5.4) ALT + arrow key, jump to the end of the word

2. Now let's go back to the mainline tutorial and start learning how to add the configuration in "easy landscaping" to the configuration file:

' Use 1. (2) To open the configuration file, enter the configuration, and save it. `
' Delete the old session in 1 (4), create a new session, and then see the entry into effect. `

3. Another configuration

Open the ' GitHub link ' in the "Advanced Landscaping" section of the mainline tutorial and remember not to install as described in the mainline link, which will fail to install.
I recommend that you configure how the author is installed in GitHub:

Open the terminal and enter the following command (the one that follows):

$ cd$ git clone https://github.com/gpakosz/.tmux.git$ ln-s-F. tmux/.tmux.conf$ CP. Tmux/.tmux.conf.local.

Can be configured successfully, and then after re-cleaning and new session, you will see the effect.
After you install this configuration: The prefix key becomes CTRL + A

Alternatively, you can re-open ~/.tmux.conf and enter the following:

Bind J Split-window-hbind L split-window-vsetw-g window-status-current-fg whitesetw-g window-status-current-bg REDSETW -G window-status-current-attr brightset-g status-justify leftsetw-g monitor-activity on# support Mouse Selection window, adjust window size Set-g mouse on Set-s escape-time # Adjust window size shortcut key, lower left upper right bind-r H resize-pane-l 3bind-r J resize-pane-d 3bind-r K resize-pane-u 3bind-r L Resize-pane-r 3

  


Newly added features:
Vertical split screen shortcut can be changed to: CB + J; Horizontal split screen: CB + L
Support Mouse Selection window, adjust window size.

Two. Summary of common shortcut keys

Tmux

Prefix key: Ctrl + B (hereinafter referred to as CB) Tmux new-s <name> Create a new session while creating the default Windowtmux new-s <name>-n <name1> simultaneously create a name called name1 Windowtmux ls See how many sessions cb + D temporarily leave session, but do not delete sessions Tmux attach (-a)-T <name> return corresponding Sessiontmux a quick connect first reply Tmux Kil L-session-t <name> completely remove the corresponding Sessionwindow (window) operation CB + C when in a window, you can create a new window CB + p automatically switch to the previous window CB + N switch to the next CB +, re-life Name the current window, rename the way under the window CB + W List all Windows pane (split screen) operation CB + (SHIFT (hereinafter referred to as SH) + 5)/[that is%] create vertical split screen CB + "Create split screen CB + Direction key switch each sub-screen CB + 1 Show split screen number exit exit Sub-screen/exit the last split screen, while permanently delete this session CB + x Close the current split screen, the following prompt interface requirements to enter Y, to confirm CB + Q Display Sub-screen number CB + D temporarily exit the session CB + (SH + 7 is &) Exit current all split screen, and close the session CB + Space to the current all pane to re-layout CB + Z to maximize the current pane, and then press once after the recovery CB + S List the current all sessions [one line of code]opt + direction key words between the jump ct + a/e Wardrobe/Line Tail Ctrl + U clear the current line ct + d Delete The word in the position of the cursor ct + h Delete the cursor before a letter ct + W Delete the word before the cursor ct + k Delete the cursor to the end of the line

  

Iterm2

[Split screen]cmd (hereinafter called cm) + D vertical split screen cm + sh + d horizontal split screen (cm + [/]) or (cm + opt + direction key) split screen toggle [Snapshot]cm + sh + s Save current snapshot cm + opt + b playback snapshot [one line]opt + arrow keys around the word jump ct + a/e Wardrobe/Line Tail Ctrl + U clear the current line ct + d Delete the cursor location of the word letter ct + h Delete cursor before a letter ct + W Delete the word before the cursor ct + k delete cursor to end of line [label]CM + t new label Sign CM + W close label cm + digital/numeric key toggle label cm +; View History command cm + sh + H shear version history ct + P previous command cm +. Iterm quickly appear or disappear cm + Enter fullscreen/current screen size toggle cm + F Find cm + E + R; CM + R; CT + L Clear screen mouse double-click, intelligent selection of the whole word [font]preferences-profiles-text-change font-size 14; Horizontal 100%;vertical 100-150% Middle [background translucent]:profiles-window-transparency, blur translucent switch shortcut key: CM + U

  

Other recommended Links:

Tmux Learning and Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.