Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

4.9 KiB

Tmux Configuration

Tmux configuration. Pretty boring in most ways.

  # Setup vi mode by default
  set-window-option -g mode-keys vi
  set-window-option -g aggressive-resize on

  # Force zsh to be a login shell
  set-option -g default-command 'zsh -l'
  set-option -g default-terminal 'xterm-256color'

  # Status line options, mainly coloring
  set-window-option -g window-status-bg colour6
  set-window-option -g window-status-fg black
  set-window-option -g window-status-current-bg white

  # Status line options
  set-option -g status-bg black
  set-option -g status-fg colour7
  set-option -g status-left-length 24
  set-option -g status-left ''
  set-option -g status-right-length 13
  set-option -g status-right "%a %H:%M:%S"
  set-option -g status-interval 7

  # Pane border options, mimics the status line coloring
  set-option -g pane-border-bg colour15
  set-option -g pane-border-fg colour82
  set-option -g pane-active-border-bg colour15
  set-option -g pane-active-border-fg colour2

  # Alert related things
  set-option -g visual-activity on
  set-option -g visual-bell on
  set-option -g message-bg colour7
  set-option -g message-fg black

  # Pass through the window title and display it automatically on changes.
  set-option -g set-titles on
  set-option -g set-titles-string '#T'
  set-window-option -g automatic-rename on

  # Key rebinding to make things more au naturalle
  bind-key R \
    source-file ~/.tmux.conf \;\
    display 'reloaded tmux config'

  # Log pane output to a file, save with an iso8601 datestamp
  bind-key o \
    pipe-pane -o "cat >> $HOME/tmux-`iso8601`.log" \;\
    set-window-option window-status-current-fg green \;

  bind-key O \
    pipe-pane \;\
    set-window-option window-status-current-fg default \;

  bind-key N new-session -t default

  # Using s for synchronizing panes, means that s for choosing sessions
  # is now e
  unbind-key s # interactive select sessions
  bind-key e choose-tree

  # (un)synchronize panes with prefix-s
  bind-key s \
    if-shell \
      "tmux show-window-options | grep 'synchronize-panes on'" \
        "set-window-option window-status-current-bg colour7; \
        set-window-option pane-active-border-fg colour2; \
        set-window-option pane-active-border-bg colour15; \
        set-window-option synchronize-panes off; \
        display 'synchronization off'" \
        "set-window-option window-status-current-bg red; \
        set-window-option pane-active-border-fg red; \
        set-window-option pane-active-border-bg colour15; \
        set-window-option synchronize-panes on; \
        display 'synchronizing'"

  # same thing as ^ so it sets up things if we were started with
  # something else that set synchronization.
  if-shell \
    "tmux show-window-options | grep 'synchronize-panes on' || /bin/true" \
    "set-window-option window-status-current-bg red; \
    set-window-option pane-active-border-fg yellow; \
    set-window-option pane-active-border-bg red"

  # Setup splits to be less annoying
  bind-key \ split-window -h
  bind-key - split-window -v

  # vi keybindings for pane navigation
  bind-key k select-pane -U
  bind-key j select-pane -D
  bind-key h select-pane -L
  bind-key l select-pane -R

  # Make it so that I can detach/etc while holding control down,
  # PURE LAZY
  bind-key C-d detach
  bind-key C-n next-window
  bind-key C-p previous-window

  bind-key C-k select-pane -U
  bind-key C-j select-pane -D
  bind-key C-h select-pane -L
  bind-key C-l select-pane -R

  # Non confirming kill pane plskthxbai
  bind-key x kill-pane

  # In case something I run exits straight away, i'd like to know about it.
  set-option -g set-remain-on-exit on

  # Lets change the prefix key so we don't clobber emacs back one char key
  unbind-key C-b

  # hacky, but C-\ isn't used by anything overly important in emacs
  set-option -g prefix 'C-\'

  # two C-\'s == C-\, if i need it, likely not
  bind 'C-\' send-prefix

  # Delay in sending things is dumb
  set-option -s escape-time 1

  # so we can scroll the mouse, select panes, etc...
  set -g mouse on
  bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
  bind-key m \
    if-shell \
      "tmux show-options -g | grep 'mouse on'" \
        "set -g mouse off; \
         display 'Mouse modes off'" \
        "set -g mouse on; \
        display 'Mouse modes on'"

Only set xclip for x setup.

  bind C-p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
  bind C-y run "tmux save-buffer - | xclip -i"