-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbcd6f4
commit e627846
Showing
2 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
# Set window and pane indexes to start at 1 instead of 0 | ||
set -g base-index 1 | ||
setw -g pane-base-index 1 | ||
|
||
# Use C-a as prefix, since it's on the home row and easier to hit than C-b | ||
set-option -g prefix C-a | ||
unbind-key C-a | ||
# C-a passthrough by sending C-a 2 times | ||
bind-key C-a send-prefix | ||
|
||
# Vi mode instead of emacs (default) | ||
setw -g mode-keys vi | ||
set -g status-keys vi | ||
|
||
set -g history-limit 100000 | ||
|
||
# Allow the arrow key to be used immediately after changing windows | ||
set-option -g repeat-time 0 | ||
|
||
# No delay for escape key press | ||
set -sg escape-time 0 | ||
|
||
|
||
############################### | ||
# KEY-BINDINGS | ||
############################### | ||
|
||
# mouse behavior | ||
set -g mouse on | ||
|
||
# Easy config reload with prefix-R | ||
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded." | ||
|
||
bind-key : command-prompt | ||
bind-key r refresh-client -S \; display-message "client reloaded." | ||
bind-key L clear-history | ||
|
||
bind-key | split-window -h -c "#{pane_current_path}" | ||
bind-key v split-window -h -c "#{pane_current_path}" | ||
bind-key s split-window -v -c "#{pane_current_path}" | ||
bind-key - split-window -v -c "#{pane_current_path}" | ||
|
||
bind-key h select-pane -L | ||
bind-key j select-pane -D | ||
bind-key k select-pane -U | ||
bind-key l select-pane -R | ||
|
||
# Use Ctrl-vim keys without prefix key to resize panes | ||
unbind-key C-h | ||
unbind-key C-j | ||
unbind-key C-k | ||
unbind-key C-l | ||
#bind-key -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux resize-pane -L 10" | ||
#bind-key -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux resize-pane -D 5" | ||
#bind-key -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux resize-pane -U 5" | ||
#bind-key -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux resize-pane -R 10" | ||
|
||
# Use Ctrl-arrow keys without prefix key to switch panes (tmux + vim) | ||
unbind C-Left | ||
unbind C-Down | ||
unbind C-Up | ||
unbind C-Right | ||
bind-key -n C-Left run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-Left) || tmux select-pane -L" | ||
bind-key -n C-Down run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-Down) || tmux select-pane -D" | ||
bind-key -n C-Up run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-Up) || tmux select-pane -U" | ||
bind-key -n C-Right run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-Right) || tmux select-pane -R" | ||
bind-key -n 'C-\' run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys 'C-\\') || tmux select-pane -l" | ||
|
||
# Shift arrow to switch windows | ||
bind-key -n S-Left previous-window | ||
bind-key -n S-Right next-window | ||
|
||
bind-key C-o rotate-window | ||
bind-key enter next-layout | ||
bind-key + select-layout main-horizontal | ||
bind-key = select-layout main-vertical | ||
set-window-option -g other-pane-height 25 | ||
set-window-option -g other-pane-width 80 | ||
|
||
bind-key '\' last-pane | ||
bind-key q display-panes | ||
bind-key c new-window | ||
bind-key t next-window | ||
bind-key T previous-window | ||
|
||
bind-key [ copy-mode | ||
bind-key ] paste-buffer | ||
|
||
# Setup 'v' to begin selection as in Vim | ||
# v2.1: | ||
#bind-key -t vi-copy v begin-selection | ||
#bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" | ||
# v2.6: | ||
bind-key -T copy-mode-vi v send -X begin-selection | ||
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" | ||
|
||
# Update default binding of `Enter` to also use copy-pipe | ||
# v2.1:# | ||
#unbind-key -t vi-copy Enter | ||
#bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" | ||
# v2.6: | ||
unbind-key -T copy-mode-vi Enter | ||
bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" | ||
|
||
############################### | ||
# WINDOW AND PANE | ||
############################### | ||
|
||
set -g default-terminal "screen-256color" | ||
|
||
# Active window title colors | ||
#setw -g window-status-current-fg magenta # black | ||
#setw -g window-status-current-bg white # default | ||
#setw -g window-status-current-attr bright # bold | ||
|
||
# Pane number display | ||
#set -g display-panes-active-colour colour1 | ||
#set -g display-panes-colour colour166 | ||
set-window-option -g display-panes-time 1500 | ||
|
||
# Set pane colors - highlight the active pane | ||
#set -g status-bg black | ||
#set -g status-fg yellow | ||
set -g pane-border-style fg=colour3 | ||
set -g pane-active-border-style bg=colour3,fg=colour3 | ||
|
||
# Colorize messages in the command line | ||
set -g message-style fg=black,bg=yellow,bold | ||
|
||
# Set window notifications | ||
setw -g monitor-activity on | ||
set -g visual-activity on | ||
|
||
# Automatically set window title | ||
set-window-option -g automatic-rename on | ||
set-option -g set-titles on | ||
|
||
# Set window notifications | ||
setw -g monitor-activity on | ||
set -g visual-activity on | ||
|
||
|
||
############################### | ||
# STATUS BAR | ||
############################### | ||
|
||
# Powerline status bar (pip3 install powerline-status) | ||
run-shell "powerline-daemon -q" | ||
source $HOME/.local/lib/python3.8/site-packages/powerline/bindings/tmux/powerline.conf | ||
|
||
############################### | ||
# MAC AND iTERM COMPATIBILITY | ||
############################### | ||
|
||
# Enable native Mac OS X copy/paste | ||
#set-option -g default-command "/bin/bash -c 'which reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace $SHELL -l || exec $SHELL -l'" | ||
set-option -g default-command "/bin/bash -c 'which reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace /usr/bin/fish -l || exec /usr/bin/fish -l'" | ||
|
||
# Fix to allow mousewheel/trackpad scrolling in tmux 2.1 | ||
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M" | ||
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M" | ||
|
||
# Disable assume-paste-time, so that iTerm2's "Send Hex Codes" feature works | ||
# with tmux 2.1. This is backwards-compatible with earlier versions of tmux, | ||
# AFAICT. | ||
set-option -g assume-paste-time 0 | ||
|
||
# This needs to be the last line, as it will load local config (e.g., TPM plugins). | ||
#source-file ~/.tmux.conf.local |