ini Tmux版本验证(适用于v1.8到v2.1)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini Tmux版本验证(适用于v1.8到v2.1)相关的知识,希望对你有一定的参考价值。

# User key bindings
    # ^C - create new window
    # c - create new window (default key)
    # \ | % - vsplit
    # - _ " - split
    unbind ^C
    bind ^C new-window;
    bind \ split-window -h
    bind | split-window -h
    bind - split-window -v
    bind _ split-window -v

# Mouse mode is off by default
    # <prefix> M : to turn it off
    # <prefix> m : to turn it on
    unbind m
    bind m set -g mode-mouse on \; set -g mouse-resize-pane on \; set -g mouse-select-pane on \; set -g mouse-select-window on \; display "Mouse ON"
    bind M set -g mode-mouse off \; set -g mouse-resize-pane off \; set -g mouse-select-pane off \; set -g mouse-select-window off \; display "Mouse OFF"
# User key bindings
    # ^C - create new window
    # c - create new window (default key)
    # \ | % - vsplit
    # - _ " - split
    unbind c
    bind c new-window -c "#{pane_current_path}"
    bind ^C new-window -c "#{pane_current_path}"
    bind \ split-window -h -c "#{pane_current_path}"
    bind | split-window -h -c "#{pane_current_path}"
    bind - split-window -v -c "#{pane_current_path}"
    bind _ split-window -v -c "#{pane_current_path}"

# Mouse mode is off by default
    # <prefix> M : to turn it off
    # <prefix> m : to turn it on
    set -g mouse-utf8 on
    unbind m
    bind m set -g mouse on \; display "Mouse ON"
    bind M set -g mouse off \; display "Mouse OFF"

# pass on focus events to vim inside of tmux
    set -g focus-events on

# List of plugins
    set -g @plugin 'tmux-plugins/tpm'
    # Restore tmux environment
    set -g @plugin 'tmux-plugins/tmux-resurrect'
    # Automatic restore
    set -g @plugin 'tmux-plugins/tmux-continuum'

# Plugin settings
    set -g @continuum-restore 'on'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
    run '~/.tmux/plugins/tpm/tpm'
# User key bindings
    # ^C - create new window
    # c - create new window (default key)
    # \ | % - vsplit
    # - _ " - split
    unbind ^C
    bind ^C new-window;
    bind \ split-window -h
    bind | split-window -h
    bind - split-window -v
    bind _ split-window -v

# Mouse mode is off by default
    # <prefix> M : to turn it off
    # <prefix> m : to turn it on
    unbind m
    bind m set -g mode-mouse on \; set -g mouse-resize-pane on \; set -g mouse-select-pane on \; set -g mouse-select-window on \; display "Mouse ON"
    bind M set -g mode-mouse off \; set -g mouse-resize-pane off \; set -g mouse-select-pane off \; set -g mouse-select-window off \; display "Mouse OFF"

# pass on focus events to vim inside of tmux
    set -g focus-events on
#!/bin/bash

verify_tmux_version () {
    tmux_home=~/.tmux
    tmux_version="$(tmux -V | cut -c 6-)"
    
    if [[ $(echo "$tmux_version >= 2.1" | bc) -eq 1 ]] ; then
        tmux source-file "$tmux_home/tmux_2.1_up.conf"
        exit
    elif [[ $(echo "$tmux_version >= 1.9" | bc) -eq 1 ]] ; then
        tmux source-file "$tmux_home/tmux_1.9_to_2.1.conf"
        exit
    else
        tmux source-file "$tmux_home/tmux_1.9_down.conf"
        exit
    fi
}

verify_tmux_version
# Overwrite configs depending on version
    run-shell "bash ~/.tmux/verify_tmux_version.sh"

以上是关于ini Tmux版本验证(适用于v1.8到v2.1)的主要内容,如果未能解决你的问题,请参考以下文章

ini 来自http://media.pragprog.com/titles/bhtmux/code/config/tmux.conf的tmux.conf的Pragprog版本

sh 适用于VIM和Tmux的MacOS剪贴板

ini .tmux.ini

ini .tmux.conf

ini .tmux.conf

ini .tmux.conf