Browse Source

add pre-configured session and keyboard shortcut to tmux conf

main
Charles Reid 6 years ago
parent
commit
b361106254
  1. 51
      .tmux.conf
  2. 5
      .tmux.session1

51
.tmux.conf

@ -5,14 +5,20 @@ @@ -5,14 +5,20 @@
# https://github.com/mathiasbynens/dotfiles/blob/master/.tmux.conf
# https://github.com/samoshkin/tmux-config/blob/master/tmux/tmux.conf
# https://github.com/tony/tmux-config/blob/master/scripts/resize-adaptable.sh
# https://stackoverflow.com/a/40009032
#
# Basic layout:
# - .tmux.conf contains tmux configuration variables
# - .tmux.sessionX contains tmux session setup (keyboard shortcut)
# - scripts/devtmux contains tmux session setup (named sessions)
set -g default-terminal "screen-256color"
set-option -g default-terminal screen-256color
# Use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
unbind C-a
bind C-a send-prefix
# Set parent terminal title to reflect current window in tmux session
set -g set-titles on
@ -24,18 +30,17 @@ setw -g pane-base-index 1 @@ -24,18 +30,17 @@ setw -g pane-base-index 1
# Easy config reload
unbind r
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
bind R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
# vi is good
setw -g mode-keys vi
bind-key : command-prompt
bind-key r refresh-client
#bind-key L clear-history
bind : command-prompt
bind r refresh-client
bind-key space next-window
bind-key bspace previous-window
bind-key enter next-layout
bind space next-window
bind bspace previous-window
bind enter next-layout
# use vim-like keys for splits and windows
#
@ -48,14 +53,14 @@ bind-key enter next-layout @@ -48,14 +53,14 @@ bind-key enter next-layout
# k = pick up pane
# l = pick right pane
#
bind-key v split-window -h -c "#{pane_current_path}"
bind-key s 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
bind-key C-h select-pane -L
bind-key C-l select-pane -R
bind v split-window -h -c "#{pane_current_path}"
bind s split-window -v -c "#{pane_current_path}"
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind C-h select-pane -L
bind C-l select-pane -R
# smart pane switching with awareness of vim splits
#
@ -77,21 +82,21 @@ bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE @@ -77,21 +82,21 @@ bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE
bind C-l send-keys 'C-l'
# Control-A then Control-O swaps out windows in their respective positions
bind-key C-o rotate-window
bind C-o rotate-window
# Control-A plus + makes existing windows have horizontal layout
bind-key + select-layout main-horizontal
bind + select-layout main-horizontal
# Control-A plus = makes existing windows have vertical layout
bind-key = select-layout main-vertical
bind = select-layout main-vertical
## (no idea what this does)
#set-window-option -g other-pane-height 25
#set-window-option -g other-pane-width 80
# Control-A plus [ or ] moves into copy mode or paste mode
bind-key [ copy-mode
bind-key ] paste-buffer
bind [ copy-mode
bind ] paste-buffer
# (no idea)
set-window-option -g display-panes-time 1500
@ -116,3 +121,5 @@ set -g visual-activity on @@ -116,3 +121,5 @@ set -g visual-activity on
# Allow the arrow key to be used immediately after changing windows
set-option -g repeat-time 0
# Set up easy go-to sessions with shortcuts
bind s source-file ~/.tmux.session1

5
.tmux.session1

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
# https://stackoverflow.com/a/5753059
new-session -A -s dev -n dev
send-keys 'vim' C-m
split-window -v -p 20
select-pane -t 1
Loading…
Cancel
Save