Tmux settings

This commit is contained in:
Henrik Lissner 2014-08-13 01:19:03 -04:00
parent 655327f069
commit 6caabfe345
4 changed files with 54 additions and 33 deletions

View file

@ -26,35 +26,43 @@ set-option -g default-command "reattach-to-user-namespace -l zsh"
set -g prefix C-a
unbind C-b
# Restore go-to-start-of-line shortcut
bind a send-prefix
bind C-a send-prefix
# Go to last active window
bind-key C-a last-window
bind-key a last-window
# reload config without killing server
bind R source-file ~/.tmux.conf \; display-message " Config reloaded..".
# Better splitting keybinds
unbind %
bind H split-window -v
unbind '"'
bind V split-window -h
bind r source-file ~/.tmux.conf \; display-message " Config reloaded..".
# set vi keys
setw -g mode-keys vi
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-pipe "reattach-to-user-namespace pbcopy"
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
## Pane management #####
# Better splitting keybinds
unbind %
unbind '"'
bind H split-window -v
bind V split-window -h
# Navigate between panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"
# after copying to a tmux buffer, hit y again to copy to clipboard
bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
# quick view of processes
@ -65,6 +73,8 @@ bind-key -n C-left prev
## Looks ########################
# make tmux display things in 256 colors
set -g default-terminal "screen-256color"
# default statusbar colors
set-option -g status-bg '#333333'
set-option -g status-fg yellow #yellow
@ -94,5 +104,5 @@ set-window-option -g clock-mode-colour green #green
set-option -g status-justify left
set-option -g status-right-length 60
set-option -g status-left-length 60
set-option -g status-left '#[bg=blue] #[fg=white]#[bold]#S #[default]'
set-option -g status-right '#[bg=#383838] #(whoami)@#H'
set-option -g status-left '#[bg=#252525] #[fg=white]#[bold]#S #[default]'
set-option -g status-right '#[bg=#383838] #(whoami) : #H '

View file

@ -13,6 +13,17 @@ if command_exists 'git'; then
}
fi
# Tmux
if command_exists 'tmux'; then
alias t='tmux new -s x || tmux attach -t x'
alias tl='tmux list-sessions'
alias ts='tmux switch'
function tmux-send {
tmux send-keys -s "x" $1 Enter
}
fi
# OS-specific aliases
if [[ "$OSTYPE" == darwin* ]]; then
alias b='brew'
@ -44,7 +55,7 @@ alias py3='python3'
[ -e /Applications/love.app ] && alias love="/Applications/love.app/Contents/MacOS/love"
# Shell conveniences
alias \\q='exit'
alias q='exit'
alias sha1='openssl sha1'
alias header='curl -I'
@ -53,7 +64,7 @@ alias header='curl -I'
alias wget='wget -c'
# Lets us sudo aliases
alias sudo='sudo '
# alias sudo='sudo '
# Make a directory and change to it
function mkd { mkdir "$@" && cd "$@" }

View file

@ -10,6 +10,6 @@ zle -N edit-command-line
bindkey -v
bindkey '^f' edit-command-line
bindkey '^w' backward-kill-word
bindkey '^a' beginning-of-line
bindkey '^e' end-of-line
bindkey -M viins '^w' backward-kill-word
bindkey -M viins '^a' beginning-of-line
bindkey -M viins '^e' end-of-line

View file

@ -19,19 +19,19 @@ zstyle ':prezto:*:*' color 'yes'
# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
'environment' \
'terminal' \
'editor' \
'opp' \
'history' \
'history-substring-search' \
'directory' \
'spectrum' \
'utility' \
'completion' \
'prompt' \
'git' \
'osx'
'environment' \
'terminal' \
'editor' \
'opp' \
'history' \
'history-substring-search' \
'directory' \
'spectrum' \
'utility' \
'completion' \
'prompt' \
'git' \
'osx'
# Editor