Skip to content

tmux.conf: use brackets for if-shell commands #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions etc/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ bind-key j join-pane -s !
bind-key J join-pane

### Move current window to session named "bg" (and create session if it does not exist)
bind-key B if-shell "! tmux has-session -t bg" "new-session -d -s bg" \; move-window -t bg
bind-key B if-shell '! tmux has-session -t bg' {
new-session -d -s bg
move-window -t bg
}

### Reload Config
if-shell "! (env | grep -q TMUX=/tmp/tmate)" \
"bind-key R source-file ~/.tmux.conf \\; source-file -q ~/.tmux.conf.local \\; display-message '~/.tmux.conf[.local] reloaded'"
### Reload User Configs
if-shell '! (env | grep -q TMUX=/tmp/tmate)' {
bind-key R source-file ~/.tmux.conf
source-file -q ~/.tmux.conf.local
display-message "~/.tmux.conf[.local] reloaded"
}

###rebind keys
bind-key h next-layout
Expand Down Expand Up @@ -62,7 +68,11 @@ set -g status-left "#[fg=white]@#h#[fg=red]:#S#[fg=white] |"
#set -g status-right-length 16
#set -g status-right '#[fg=yellow]%Y-%m-%d %H:%M'
### status-right: IPs and Date and Time
if-shell "command -v hostname && hostname --help | grep -q -- -I" { set -g status-right "#[fg=green](net: #(hostname -I | sed -e 's/ [^ ]*:.*$//;s/ / | /g;s/ | $//')) #[fg=yellow]%Y-%m-%d %H:%M" } { set -g status-right '#[fg=yellow]%Y-%m-%d %H:%M' }
if-shell 'command -v hostname && hostname --help | grep -q -- -I' {
set -g status-right "#[fg=green](net: #(hostname -I | sed -e 's/ [^ ]*:.*$//;s/ / | /g;s/ | $//')) #[fg=yellow]%Y-%m-%d %H:%M"
} {
set -g status-right '#[fg=yellow]%Y-%m-%d %H:%M'
}
### status-right: Time
#set -g status-right-length 6
#set -g status-right "#[fg=yellow]%H:%M"
Expand All @@ -71,5 +81,6 @@ set-window-option -g window-status-style fg=blue,bg=black
set-window-option -g window-status-current-style bold

### source user-specific local configuration file
if-shell "! (env | grep -q TMUX=/tmp/tmate)" \
"source-file -q ~/.tmux.conf.local"
if-shell '! (env | grep -q TMUX=/tmp/tmate)' {
source-file -q ~/.tmux.conf.local
}