From 15ae51150051e46e54daa5cf3bfc95907abf7ab3 Mon Sep 17 00:00:00 2001 From: Noah Masur Date: Sun, 7 Jun 2020 18:16:24 -0600 Subject: [PATCH] Basic tmux setup --- scripts/bootstrap | 9 +++++++++ tmux/tmux.conf.symlink | 45 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tmux/tmux.conf.symlink diff --git a/scripts/bootstrap b/scripts/bootstrap index 3cbe084..9431b72 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -66,6 +66,14 @@ install_brews() { echo "brews installed ✓" } +setup_tmux() { + if [[ ! -d ~/.tmux/plugins/tpm ]]; then + git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm + fi + + echo "tmux ✓" +} + install_spacemacs() { emacsdir=~/.emacs.d if ! (git -C "$emacsdir" pull > /dev/null 2>&1) @@ -82,6 +90,7 @@ check_for_ohmyzsh install_xcode install_homebrew install_brews +setup_tmux install_spacemacs ("$DOTS/scripts/setup_symlinks") diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink new file mode 100644 index 0000000..49fd330 --- /dev/null +++ b/tmux/tmux.conf.symlink @@ -0,0 +1,45 @@ +# Plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-yank' + +# Remap prefix to Control + space +set -g prefix C-space +bind C-space send-prefix + +# Keep plenty of history for scrollback +set -g history-limit 10000 + +# Upgrade colors +set -g default-terminal "screen-256color" + +# Remove delay for entering copy mode +set-option -sg escape-time 0 + +# Horizontal and vertical splits +bind \\ split-window -h -c '#{pane_current_path}' +bind - split-window -v -c '#{pane_current_path}' + +# Smart pane switching with awareness of vim splits +bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" +bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" +bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" +bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" +bind -n C-\\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l" + +# Status bar +set -g status-interval 2 +set -g status-right-length 59 +set -g renumber-windows on +set-option -g base-index 1 +set-window-option -g pane-base-index 1 + +set-option -g status-position bottom + + +# Copy mode works as Vim +bind Escape copy-mode +bind C-[ copy-mode +bind p paste-buffer + +# Enable mouse mode +set -g mouse on