Compare commits
2 Commits
002c2ba9b8
...
742a1622b9
Author | SHA1 | Date | |
---|---|---|---|
742a1622b9 | |||
219239fcdc |
26
session.sh
Executable file
26
session.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
sessions=()
|
||||
|
||||
# Get list of predefined session layouts
|
||||
for item in $HOME/.local/share/tmux/layouts/session-*; do
|
||||
sessions+=(${item#$HOME/.local/share/tmux/layouts/session-})
|
||||
done
|
||||
|
||||
# Get list of existing sessions
|
||||
sessions+=($(tmux list-sessions | awk -F: '{print $1}'))
|
||||
|
||||
# Pick the session with fzf (remove duplicates)
|
||||
session=$(
|
||||
echo "${sessions[@]}" | tr ' ' '\n' | sort -u |
|
||||
fzf --layout=reverse --info=hidden --border=rounded --cycle
|
||||
)
|
||||
|
||||
# Create the session if it doesn't alreayd exist
|
||||
tmux list-sessions | grep "^$session:" &> /dev/null || \
|
||||
tmux new-session -Ads $session -c $HOME
|
||||
|
||||
# Switch to the session
|
||||
tmux switch-client -t $session
|
33
theme.tmux
Normal file
33
theme.tmux
Normal file
@ -0,0 +1,33 @@
|
||||
# Left status style
|
||||
if -b '[ "$WSL_DISTRO_NAME" != "" ]' \
|
||||
'setw -g status-left " #(hostname)|#{WSL_DISTRO_NAME}|#{session_name}"' \
|
||||
'setw -g status-left " #(hostname -s)|#{session_name}"'
|
||||
setw -g status-left-style fg=colour240,bg=colour233
|
||||
setw -g status-left-length 32
|
||||
|
||||
# Centre status style
|
||||
setw -g status-style fg=colour240,bg=colour233
|
||||
|
||||
# Right status style shows system info, date, and time.
|
||||
setw -g status-right "#[fg=colour240]#(cat ~/.cache/tmux/system-info)#[fg=white] %a %d-%m-%y %H:%M "
|
||||
setw -g status-right-style fg=white,bg=colour233
|
||||
if -b '[ "`uname`" != "Darwin" ]' \
|
||||
'run "tmux setw -g status-right-length $((`nproc --all` + 48))"'
|
||||
|
||||
# Active window status style
|
||||
setw -g window-status-current-format " #{window_index}: #{window_name}"
|
||||
setw -g window-status-current-style fg=white,bg=colour233
|
||||
|
||||
# Inactive window status style
|
||||
setw -g window-status-format " #{window_index}: #{window_name}"
|
||||
setw -g window-status-style fg=colour240,bg=colour233
|
||||
|
||||
# Pane border style
|
||||
set -g pane-border-style fg=colour233,bg=colour233
|
||||
set -g pane-active-border-style fg=colour235,bg=colour235
|
||||
|
||||
# Command line window list selection
|
||||
set-window-option -g mode-style fg=white,bg=colour237
|
||||
set-option -g message-style fg=white,bg=colour237
|
||||
|
||||
# vim: ft=tmux
|
34
tmux.conf
34
tmux.conf
@ -64,6 +64,8 @@ if -b '[ "`uname`" = "Darwin" ]' \
|
||||
|
||||
# Open a popup with running the default shell
|
||||
bind C-t display-popup -d '#{pane_current_path}' -E '$SHELL'
|
||||
# Open a popup with session creator/switcher
|
||||
bind C-s display-popup -T 'Session' -B -E '~/.config/tmux/session.sh'
|
||||
|
||||
# Restore old next/previous window bindings
|
||||
bind C-n next-window
|
||||
@ -145,34 +147,4 @@ if -b '[ "$WSLENV" = "" ]' \
|
||||
'bind -T copy-mode-vi y send-keys -X copy-pipe "xsel -i --clipboard"' \
|
||||
'bind -T copy-mode-vi y send-keys -X copy-pipe "win32yank.exe -i -crlf"'
|
||||
|
||||
# Left status style
|
||||
if -b '[ "$WSL_DISTRO_NAME" != "" ]' \
|
||||
'setw -g status-left " #(hostname)|#{WSL_DISTRO_NAME}|#{session_name}"' \
|
||||
'setw -g status-left " #(hostname -s)|#{session_name}"'
|
||||
setw -g status-left-style fg=colour240,bg=colour233
|
||||
setw -g status-left-length 32
|
||||
|
||||
# Centre status style
|
||||
setw -g status-style fg=colour240,bg=colour233
|
||||
|
||||
# Right status style shows system info, date, and time.
|
||||
setw -g status-right "#[fg=colour240]#(cat ~/.cache/tmux/system-info)#[fg=white] %a %d-%m-%y %H:%M "
|
||||
setw -g status-right-style fg=white,bg=colour233
|
||||
if -b '[ "`uname`" != "Darwin" ]' \
|
||||
'run "tmux setw -g status-right-length $((`nproc --all` + 48))"'
|
||||
|
||||
# Active window status style
|
||||
setw -g window-status-current-format " #{window_index}: #{window_name}"
|
||||
setw -g window-status-current-style fg=white,bg=colour233
|
||||
|
||||
# Inactive window status style
|
||||
setw -g window-status-format " #{window_index}: #{window_name}"
|
||||
setw -g window-status-style fg=colour240,bg=colour233
|
||||
|
||||
# Pane border style
|
||||
set -g pane-border-style fg=colour233,bg=colour233
|
||||
set -g pane-active-border-style fg=colour235,bg=colour235
|
||||
|
||||
# Command line window list selection
|
||||
set-window-option -g mode-style fg=white,bg=colour237
|
||||
set-option -g message-style fg=white,bg=colour237
|
||||
source-file ~/.config/tmux/theme.tmux
|
||||
|
Loading…
x
Reference in New Issue
Block a user