Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
315 lines (257 sloc) 9.81 KB
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\ ver 2.1
#
# written by Shotaro Fujimoto (https://github.com/ssh0)
#------------------------------------------------------------------------------
# General settings {{{
#------------------------------------------------------------------------------
# enable utf-8
setw -g utf8 on
# max history limit
set -g history-limit 5000
# escape time
set -s escape-time 0
# Set the time in milliseconds for which the indicators shown by the
# display-pane command appear.
set -g display-panes-time 3000
# count windows stating with 1 instead of 0
set -g base-index 1
set -g pane-base-index 1
# renumber the windows
set -g renumber-windows on
# Automatically set window title
setw -g automatic-rename on
#---------------------------------------------------------------------------}}}
# Keybind Documentation {{{
#------------------------------------------------------------------------------
# I prefered using Alt key instead "Prefix + something".
# And I'm using xmonad, so these key-bindings are similar to xmonad's one.
# My xmonad config is here:
# https://github.com/ssh0/dotfiles/blob/master/.xmonad/ssh0-home/xmonad.hs
#
# Prefix key: ^g
#
# Abbreviation:
# - [key]
# - (key) <- with Alt (or in MacOS, Command key)
#
# Structure in one session:
#
# +----------------+
# | (←,→,h,l) ↓(num) OR click status bar ↓ (Enter)
# window1 <------> window2 window3 window4
# ===============================================================
# pane1 pane1 pane1 pane1
# ↕ (j,k)
# pane2 + - - pane2 - - - -> (pane2)
# | (L)
# (pane3) <- + pane3
# (H) ↓ (c) ↓ (C)
# x x
#
#
# In a window:
#
# +---------------+------------+
# |pane1 |pane3 |
# | | |
# | | |
# +---------------+ |
# |pane2 | |
# | | |
# | | |
# +---------------+------------+
#
# split pane:
# - vertically : (|)
# - horizontally : (-)
# select pane : (j),(k) OR click the pane with mouse
# shift pane : (J),(K)
# kill pane : (c)
# change layout : (Space)
# fullscreen : (f)
# resize pane:
# (a)
# ↑
# (,) ← + → (.)
# ↓ OR drag pane-border with mouse
# (z)
# join to another window : (H),(L)
# join to another window : [Alt+Shift+num]
#---------------------------------------------------------------------------}}}
# Unbind all keys & default key settings {{{
#------------------------------------------------------------------------------
unbind-key -a
# default key-bindings {{{
#======================#
bind-key C-z suspend-client
bind-key ! break-pane
bind-key '#' list-buffers
bind-key '$' command-prompt "rename-session '%%'"
bind-key , command-prompt "rename-window '%%'"
bind-key - delete-buffer
bind-key . command-prompt "move-window -t '%%'"
bind-key : command-prompt
bind-key \; last-pane
bind-key = choose-buffer
bind-key ? list-keys
bind-key D choose-client
bind-key L switch-client -l
bind-key [ copy-mode
bind-key ] paste-buffer
bind-key d detach-client
bind-key f command-prompt "find-window '%%'"
bind-key i display-message
bind-key q display-panes
bind-key s choose-session
bind-key w choose-window
bind-key "~" show-messages
bind-key PPage copy-mode -u
bind-key -r M-1 select-layout even-horizontal
bind-key -r M-2 select-layout even-vertical
bind-key -r M-3 select-layout main-horizontal
bind-key -r M-4 select-layout main-vertical
bind-key -r M-5 select-layout tiled
# }}}
#---------------------------------------------------------------------------}}}
# Keybind (normal mode) {{{
#------------------------------------------------------------------------------
# prefix key ^b -> ^g
set -g prefix C-g
bind-key C-g send-prefix
# vi like key binding
setw -g mode-keys vi
bind-key -t vi-copy v begin-selection
# if session has > 1 windows in current, kill-pane without confirmation.
# But confirm before killing pane when it is the last pane in the window.
bind-key -n M-c if "tmux display -p \"#{window_panes}\" | grep ^1\$" \
"confirm-before -p \"Kill the only pane in the window? It will kill this window too. (y/N)\" kill-pane" \
"kill-pane"
# if session has > 1 windows in current, kill-window without confirmation.
# But confirm before killing window when it is the last window in the session.
bind-key -n M-C if "tmux display -p \"#{session_windows}\" | grep ^1\$"\
"confirm-before -p \"Kill the only window in this session? It will kill the session too. (y/N)\" kill-window" \
"kill-window"
# split window (easily remember)
bind-key -n M-- split-window -v -c "#{pane_current_path}"
bind-key -n M-| split-window -h -c "#{pane_current_path}"
# vim like
bind-key s split-window -v -c "#{pane_current_path}"
bind-key v split-window -h -c "#{pane_current_path}"
# move between panes
bind-key -n M-j select-pane -D
bind-key -n M-k select-pane -U
bind-key -n M-h select-pane -L
bind-key -n M-l select-pane -R
bind-key -n M-Down select-pane -t :.+
bind-key -n M-Up select-pane -t :.-
# select the master pane
bind-key -n M-m select-pane -t :.1
# swap pane
bind-key -n M-J swap-pane -D
bind-key -n M-K swap-pane -U
bind-key -n M-S-Down swap-pane -D
bind-key -n M-S-Up swap-pane -U
# move the pane to the master pane
bind-key -n M-M swap-pane -d -t :.1
# swap pane to Alt+shift+number
bind-key -n M-! join-pane -t :1
bind-key -n M-'"' join-pane -t :2
bind-key -n M-'#' join-pane -t :3
bind-key -n M-'$' join-pane -t :4
bind-key -n M-% join-pane -t :5
bind-key -n M-& join-pane -t :6
bind-key -n M-"'" join-pane -t :7
bind-key -n M-( join-pane -t :8
bind-key -n M-) join-pane -t :9
# resize panes (xmonad like)
bind-key -n M-',' resize-pane -L 1
bind-key -n M-z resize-pane -D 1
bind-key -n M-a resize-pane -U 1
bind-key -n M-'.' resize-pane -R 1
# maximize pane ("f"ull screen)
bind-key -n M-f resize-pane -Z
# display-panes
bind-key -n M-q display-panes
# move between window
bind-key -n M-Right next-window
bind-key -n M-Left previous-window
# swap window
bind-key -n M-S-Right swap-window -t :+
bind-key -n M-S-Left swap-window -t :-
# next layout
bind-key -n M-Space next-layout
# switch windows Alt+number
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
# select-window by name typing
bind-key W command-prompt "select-window -t '%%'"
# create new window
bind-key -n M-Enter new-window -c "#{pane_current_path}"
# choose-tree
bind-key t choose-tree
# Capture pane and open in Vim
bind-key C-c run 'tmux capture-pane -S -10240 -p > /tmp/tmux-capture.txt'\;\
new-window "vim + /tmp/tmux-capture.txt"
# Toggle status bar
bind-key -n F11 set status
# ^b + r => reload config file
bind-key r source-file ~/.tmux.conf \; display "Reloaded!"
#---------------------------------------------------------------------------}}}
# Keybind (copy mode) {{{
#------------------------------------------------------------------------------
# v: select start with v (default Space)
bind-key -t vi-copy v begin-selection
# V: select line
bind-key -t vi-copy V select-line
# C-v: select rectangular
bind-key -t vi-copy C-v rectangle-toggle
# y: yank
bind-key -t vi-copy y copy-selection
# Y: yank line
bind-key -t vi-copy Y copy-line
#---------------------------------------------------------------------------}}}
# Mouse settings {{{
#------------------------------------------------------------------------------
set -g mouse on
#---------------------------------------------------------------------------}}}
# Color {{{
#------------------------------------------------------------------------------
# use 256colors
set -g default-terminal screen-256color
# pane border
set -g pane-active-border-fg colour197
set -g pane-active-border-bg colour234
set -g pane-border-fg colour239
set -g pane-border-bg colour234
# window list
setw -g window-status-fg white
setw -g window-status-bg colour235
setw -g window-status-attr dim
# message line
set -g message-fg white
set -g message-bg colour235
set -g message-attr bright
#---------------------------------------------------------------------------}}}
# WM window title {{{
#------------------------------------------------------------------------------
# enable wm window titles
set -g set-titles on
# wm window title string (uses status bar variables)
set -g set-titles-string "#S - #W [#I/#{session_windows}] (#P/#{window_panes})"
#---------------------------------------------------------------------------}}}
# Status line {{{
#------------------------------------------------------------------------------
# source $HOME/.config/tmux/status_powerline.conf
source $HOME/.config/tmux/status.conf
#---------------------------------------------------------------------------}}}
You can’t perform that action at this time.