2018-09-10 20:51:14 +02:00
|
|
|
################################################################################
|
|
|
|
# Dev Loop
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# Re-source tmux. Useful while working in this file
|
|
|
|
bind-key R source-file ~/.tmux.conf \; \
|
|
|
|
display-message "source-file done"
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Tmux Plugins
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
set -g @plugin 'dalejung/tmux-select-pane-no-wrap'
|
|
|
|
|
|
|
|
set -g @plugin 'tmux-plugins/tmux-copycat'
|
|
|
|
set -g @copycat_next 'p'
|
|
|
|
set -g @copycat_prev 'n'
|
2019-03-21 15:56:53 +01:00
|
|
|
set -g @plugin 'odedlaz/tmux-onedark-theme'
|
2018-09-10 20:51:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Context Helpers
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# Convenience defn for creating vim-specific kbd behavior
|
|
|
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
|
|
|
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
|
|
|
|
|
|
|
is_vim_or_emacs="ps -o state= -o comm= -t '#{pane_tty}' \
|
|
|
|
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?|emacs)(diff)?$'"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Tmux Leader
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# change tmux leader
|
|
|
|
unbind C-b
|
Drop OSX support; support desktop, laptop, cloudtop
Dropping support for OSX. Moving forward these dotfiles will depend on Linux
systems. Furthermore, since I'm support a ~/bin, the machines that consume these
dotfiles depend on i386 architectures. Linux and i386 are two dependencies that
I'm okay with since the leverage this assumption provides, makes their existence
tolerable.
There is some Google leakage herein, which includes aliases, functions, and
mentions of cloudtop. For now, this is okay. I may break the Google specific
code into its own repository, but for now, this is less maintenance.
This also introduces a ~/.profile instead of erroneously defining environment
variables in my zshrc file, which was unadvised.
This is a large commit and also introduces new aliases, variables, functions
that I accumulated over the past week or so while migrating away from OSX and
onto my new setup. Hopefully in the future I'll be more precise with my commits.
2019-03-18 15:14:26 +01:00
|
|
|
set -g prefix C-y
|
|
|
|
bind C-y send-prefix
|
2018-09-10 20:51:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Colors
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# COLORS!
|
Drop OSX support; support desktop, laptop, cloudtop
Dropping support for OSX. Moving forward these dotfiles will depend on Linux
systems. Furthermore, since I'm support a ~/bin, the machines that consume these
dotfiles depend on i386 architectures. Linux and i386 are two dependencies that
I'm okay with since the leverage this assumption provides, makes their existence
tolerable.
There is some Google leakage herein, which includes aliases, functions, and
mentions of cloudtop. For now, this is okay. I may break the Google specific
code into its own repository, but for now, this is less maintenance.
This also introduces a ~/.profile instead of erroneously defining environment
variables in my zshrc file, which was unadvised.
This is a large commit and also introduces new aliases, variables, functions
that I accumulated over the past week or so while migrating away from OSX and
onto my new setup. Hopefully in the future I'll be more precise with my commits.
2019-03-18 15:14:26 +01:00
|
|
|
set -g default-terminal "tmux"
|
|
|
|
set-option -sa terminal-overrides ",*256col*:Tc"
|
2018-09-10 20:51:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Copy Paste
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# copy text like it's Vim
|
|
|
|
bind -n Escape if-shell "${is_vim_or_emacs}" "send-keys Escape" copy-mode
|
|
|
|
|
|
|
|
# Use vim keybindings in copy mode
|
|
|
|
setw -g mode-keys vi
|
|
|
|
|
|
|
|
# Setup 'v' to begin selection as in Vim
|
|
|
|
bind -Tcopy-mode-vi v send -X begin-selection
|
Drop OSX support; support desktop, laptop, cloudtop
Dropping support for OSX. Moving forward these dotfiles will depend on Linux
systems. Furthermore, since I'm support a ~/bin, the machines that consume these
dotfiles depend on i386 architectures. Linux and i386 are two dependencies that
I'm okay with since the leverage this assumption provides, makes their existence
tolerable.
There is some Google leakage herein, which includes aliases, functions, and
mentions of cloudtop. For now, this is okay. I may break the Google specific
code into its own repository, but for now, this is less maintenance.
This also introduces a ~/.profile instead of erroneously defining environment
variables in my zshrc file, which was unadvised.
This is a large commit and also introduces new aliases, variables, functions
that I accumulated over the past week or so while migrating away from OSX and
onto my new setup. Hopefully in the future I'll be more precise with my commits.
2019-03-18 15:14:26 +01:00
|
|
|
bind -Tcopy-mode-vi y send -X copy-pipe-and-cancel "xclip -selection clipboard -i"
|
2018-09-10 20:51:14 +02:00
|
|
|
bind -Tcopy-mode-vi Escape send -X cancel
|
|
|
|
bind -Tcopy-mode-vi V send -X rectangle-toggle
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Windows
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# Transpose window layouts
|
|
|
|
bind-key -n M-r rotate-window -D
|
|
|
|
|
|
|
|
# start window indicies at 1
|
|
|
|
set -g base-index 1
|
|
|
|
|
|
|
|
# window naming nonsense
|
|
|
|
set-window-option -g automatic-rename on
|
|
|
|
set-window-option -g allow-rename off
|
|
|
|
|
|
|
|
# Easier window swaps
|
|
|
|
bind -n C-left swap-window -t -1
|
|
|
|
bind -n C-right swap-window -t +1
|
|
|
|
|
|
|
|
# Easier window moves
|
|
|
|
bind -n m-left previous-window
|
|
|
|
bind -n m-right next-window
|
|
|
|
|
|
|
|
# Option/Meta + number to jump to window
|
|
|
|
bind -n m-0 select-window -t 0
|
|
|
|
bind -n m-1 select-window -t 1
|
|
|
|
bind -n m-2 select-window -t 2
|
|
|
|
bind -n m-3 select-window -t 3
|
|
|
|
bind -n m-4 select-window -t 4
|
|
|
|
bind -n m-5 select-window -t 5
|
|
|
|
bind -n m-6 select-window -t 6
|
|
|
|
bind -n m-7 select-window -t 7
|
|
|
|
bind -n m-8 select-window -t 8
|
|
|
|
bind -n m-9 select-window -t 9
|
|
|
|
|
|
|
|
# split window shortcuts, maintaing the working directory
|
|
|
|
bind-key -n M-\ split-window -h -c '#{pane_current_path}'
|
|
|
|
bind-key -n M-- split-window -v -c '#{pane_current_path}'
|
|
|
|
|
|
|
|
# new window
|
|
|
|
bind-key -n M-c new-window -c "#{pane_current_path}"
|
|
|
|
|
|
|
|
# rename window
|
|
|
|
bind-key -n M-, command-prompt -p "Rename window: " "rename-window '%%'"
|
|
|
|
|
|
|
|
# maintain working directory for default tmux splits/new window
|
|
|
|
bind '"' split-window -c "#{pane_current_path}"
|
|
|
|
bind % split-window -h -c "#{pane_current_path}"
|
|
|
|
bind c new-window -c "#{pane_current_path}"
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Panes
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# Maximize current pane
|
|
|
|
bind-key -n M-z resize-pane -Z
|
|
|
|
|
|
|
|
# Pane resizing
|
|
|
|
bind -n M-H resize-pane -L 5
|
|
|
|
bind -n M-J resize-pane -D 5
|
|
|
|
bind -n M-K resize-pane -U 5
|
|
|
|
bind -n M-L resize-pane -R 5
|
|
|
|
|
|
|
|
# Delete pane (without confirmation)
|
|
|
|
bind-key -n M-q if-shell "${is_vim_or_emacs}" "send-keys M-q" kill-pane
|
|
|
|
|
|
|
|
# Pane movement: Bindings from "christoomey/vim-tmux-navigator"
|
|
|
|
bind-key -n M-h if-shell "${is_vim_or_emacs}" "send-keys M-h" "select-pane -L"
|
|
|
|
bind-key -n M-j if-shell "${is_vim_or_emacs}" "send-keys M-j" "select-pane -D"
|
|
|
|
bind-key -n M-k if-shell "${is_vim_or_emacs}" "send-keys M-k" "select-pane -U"
|
|
|
|
bind-key -n M-l if-shell "${is_vim_or_emacs}" "send-keys M-l" "select-pane -R"
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Sessions
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# Toggle last session
|
|
|
|
bind -n m-L switch-client -l
|
|
|
|
|
|
|
|
# Traverse sessions by index
|
|
|
|
bind -n m-p switch-client -p
|
|
|
|
bind -n m-n switch-client -n
|
|
|
|
|
|
|
|
# Select from current sessions
|
|
|
|
bind -n m-s choose-session
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Misc
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# fix for slow ESC issues
|
|
|
|
set -s escape-time 0
|
|
|
|
|
|
|
|
# Make tmux work like vi
|
|
|
|
set-window-option -g mode-keys vi
|
|
|
|
|
|
|
|
# Click to select and resize panse.
|
|
|
|
# NOTE: you must now hold option to select text with the mouse!
|
|
|
|
set -g mouse on
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Tmux Plugin Manager (TPM)
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# ensures tpm is present and plugins are installed
|
|
|
|
# recommended here: https://github.com/tmux-plugins/tpm/blob/c5c997bdde5d6a46d4b852e0a8164a30ca1dd0a4/docs/automatic_tpm_installation.md
|
|
|
|
if "test ! -d ~/.tmux/plugins/tpm" \
|
|
|
|
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
|
|
|
|
|
|
|
|
# bootstrap plugins
|
|
|
|
run '~/.tmux/plugins/tpm/tpm'
|
|
|
|
|
|
|
|
# run install script
|
|
|
|
# TPM tells you to do this by hand via prefix + I, which is nonsense.
|
|
|
|
# This way starting up tmux installs missing plugins.
|
|
|
|
# For some reason this still fails to start all of them, prefix + I within tmux fixes it for now.
|
|
|
|
run '~/.tmux/plugins/tpm/scripts/install_plugins.sh'
|