Skip to content

Commit 8fab5d3

Browse files
committed
add tmux aliases to zshrc & add confirm-before usage to shortcuts in tmux.conf
1 parent 15aab50 commit 8fab5d3

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

tmux/tmux.conf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ bind-key C-a send-prefix
4040
bind c new-window -c "~" -n "" \; display-message "Consider using C-t to create a new window"
4141
bind -n C-t new-window -c "~" -n ""
4242

43-
# close a window with C-w
44-
bind -n C-w kill-window
43+
# close a window with C-w (with confirm-before)
44+
bind -n C-w confirm-before -y -p "Close window? (Y/n)" "kill-window"
4545

4646
# split panes using | and -; new pane defaults to current directory
4747
bind | split-window -h -c "#{pane_current_path}"
4848
bind - split-window -v -c "#{pane_current_path}"
4949

50-
# reload config file
51-
bind r source-file ~/.tmux.conf \; display-message "Reloaded .tmux.conf"
50+
# reload config file (with confirm-before)
51+
bind r confirm-before -y -p "Reload `~/.tmux.conf`? (Y/n)" "source-file ~/.tmux.conf ; display-message \"Reloaded .tmux.conf\""
5252

5353
# Enable mouse mode (tmux 2.1 and above).
5454
set -g mouse on
@@ -106,6 +106,8 @@ set -g @plugin 'tmux-plugins/tpm'
106106
# github.com/tmux-plugins/tmux-resurrect
107107
# C-a + C-s - save current session
108108
# C-a + C-r - restore saved session
109+
# TODO consider contributing to this project by implementing optional
110+
# `confirm-before` usage for these shortcuts.
109111
set -g @plugin 'tmux-plugins/tmux-resurrect'
110112

111113
# https://github.com/seebi/tmux-colors-solarized

zsh/zshrc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ source $ZSH/oh-my-zsh.sh
2929
#
3030
# This configuration should apply to all synchronized machines that make use of
3131
# https://github.com/izzygomez/dotfiles or
32-
# https://github.com/izzygomez/new-laptop-setup
32+
# https://github.com/izzygomez/mac-setup-scripts
3333
################################################################################
3434

3535
if is_command_available emacs; then
@@ -50,6 +50,23 @@ else
5050
echo "~/.zshrc: git is not available, can't set settings."
5151
fi
5252

53+
if is_command_available tmux; then
54+
# Some useful & opinionated tmux aliases
55+
alias t='tmux'
56+
57+
alias tl='tmux ls'
58+
59+
# Create a new tmux session with a blank window in "~"
60+
alias tmuxnew='tmux new -n "" -c "~" -s'
61+
alias tn='tmuxnew'
62+
63+
# Attach to a tmux session while detaching any other clients
64+
alias tmuxattach='tmux attach -dt'
65+
alias ta='tmuxattach'
66+
else
67+
echo "~/.zshrc: tmux is not available, can't set settings."
68+
fi
69+
5370
# Shortcut for having a browsable history, with date & time stamps
5471
alias hl='history -f | less'
5572

0 commit comments

Comments
 (0)