Last active
June 27, 2020 03:58
-
-
Save garbray/a6e07d53ff76361b43f5292fda2d82d7 to your computer and use it in GitHub Desktop.
tmux base config
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
# 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' | |
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' | |
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ | |
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" | |
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ | |
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" | |
bind-key -T copy-mode-vi 'C-h' select-pane -L | |
bind-key -T copy-mode-vi 'C-j' select-pane -D | |
bind-key -T copy-mode-vi 'C-k' select-pane -U | |
bind-key -T copy-mode-vi 'C-l' select-pane -R | |
bind-key -T copy-mode-vi 'C-\' select-pane -l |
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
#!/bin/sh | |
session=$1 | |
# set up tmux | |
tmux start-server | |
# create a new tmux session | |
tmux new-session -d -s $session | |
# Split pane 1 horizontal by 75%, | |
tmux splitw -h -p 10 | |
# start server | |
# tmux send-keys $2 C-m | |
# Select pane 2 | |
tmux selectp -t 2 | |
# Split pane 2 vertiacally by 50% | |
tmux splitw -v -p 50 | |
# select pane 3, set to api root | |
tmux selectp -t 3 | |
# tmux send-keys "api" C-m | |
# Select pane 1 | |
tmux selectp -t 1 | |
# Finished setup, attach to the tmux session! | |
tmux attach-session -t $session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment