Created
November 10, 2017 15:41
-
-
Save juandazapata/842adc835d384e7b1f36060c2e504f82 to your computer and use it in GitHub Desktop.
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
# Remap prefix from 'C-b' to 'C-t' | |
unbind C-b | |
set -g prefix C-t | |
bind-key -r C-t send-prefix | |
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded." | |
# Split panes using / and - | |
bind / split-window -h -c "#{pane_current_path}" | |
bind - split-window -v -c "#{pane_current_path}" | |
bind c new-window -c "#{pane_current_path}" | |
bind b break-pane -d | |
unbind '"' | |
unbind % | |
# Switch panes using Alt-arrow without prefix | |
bind -n S-Left resize-pane -L 5 | |
bind -n S-Right resize-pane -R 5 | |
bind -n S-Up resize-pane -U 2 | |
bind -n S-Down resize-pane -D 2 | |
# # keybindings to make navigation easier | |
bind -n C-h select-pane -L | |
bind -n C-j select-pane -D | |
bind -n C-k select-pane -U | |
bind -n C-l select-pane -R | |
# Don't rename windows automatically | |
set -g allow-rename off | |
set -g default-terminal "screen-256color" | |
# Status bar | |
set -g status-keys "emacs" | |
set -g status-bg default | |
set -g status-fg "#cc241d" | |
set -g status-left-length 50 | |
set -g status-justify left | |
set -g status-attr default | |
set -g status-right " #(battery -t) | #(date '+%a, %b %d - %I:%M') " | |
set-window-option -g window-status-fg "#666666" | |
set-window-option -g window-status-bg default | |
set-window-option -g window-status-attr default | |
set-window-option -g window-status-current-fg red | |
set-window-option -g window-status-current-bg default | |
set-window-option -g window-status-current-attr default | |
set-option -g message-fg white | |
set-option -g message-bg black | |
set-option -g message-attr bright | |
# Window numbering starts with 1 | |
set -g base-index 1 | |
set-window-option -g pane-base-index 1 | |
set -g renumber-windows on | |
set -g default-shell $SHELL | |
set -g default-command "reattach-to-user-namespace ${SHELL} --login" | |
# Use vim keybindings in copy mode | |
setw -g mode-keys vi | |
# Setup 'v' to begin selection as in Vim | |
bind -t vi-copy v begin-selection | |
bind -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" | |
# Update default binding of `Enter` to also use copy-pipe | |
unbind -t vi-copy Enter | |
bind -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" | |
bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t" | |
# Prompted join-pane | |
bind j command-prompt -p "join pane from: " "join-pane -h -s '%%'" | |
# Easily swap a pane (targeted by pane number) with the current pane | |
bind-key s display-panes\; command-prompt -p "pane #: " "swap-pane -t '%%'" | |
bind-key K run-shell 'tmux switch-client -n \; kill-session -t "$(tmux display-message -p "#S")" || tmux kill-session' | |
# Smart pane switching with awareness of Vim splits. | |
# See: https://github.com/christoomey/vim-tmux-navigator | |
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | |
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" | |
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" | |
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" | |
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" | |
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" | |
set -g history-limit 30000 | |
set -g mouse on | |
setw -g mouse on | |
# Set ability to capture on start and restore on exit window data when running an application | |
setw -g alternate-screen on | |
set -s escape-time 50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment