Skip to content

Commit fc0da1d

Browse files
author
Alex Al-Saffar
committed
feat: add psmux configuration files and Windows support
1 parent 8e62c7c commit fc0da1d

9 files changed

Lines changed: 198 additions & 0 deletions

File tree

src/stackops/profile/mapper_dotfiles.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,42 @@ tmux_linux:
558558
os:
559559
- linux
560560
- darwin
561+
psmux_windows:
562+
config:
563+
original: ~/.config/psmux/psmux.conf
564+
self_managed: CONFIG_ROOT/settings/psmux/psmux.conf
565+
os:
566+
- windows
567+
theme:
568+
original: ~/.config/psmux/psmux.theme.conf
569+
self_managed: CONFIG_ROOT/settings/psmux/psmux.theme.conf
570+
os:
571+
- windows
572+
bindings:
573+
original: ~/.config/psmux/psmux.bindings.conf
574+
self_managed: CONFIG_ROOT/settings/psmux/psmux.bindings.conf
575+
os:
576+
- windows
577+
plugins:
578+
original: ~/.config/psmux/psmux.plugins.conf
579+
self_managed: CONFIG_ROOT/settings/psmux/psmux.plugins.conf
580+
os:
581+
- windows
582+
powerline:
583+
original: ~/.config/psmux/psmux.powerline.conf
584+
self_managed: CONFIG_ROOT/settings/psmux/psmux.powerline.conf
585+
os:
586+
- windows
587+
local:
588+
original: ~/.config/psmux/psmux.local.conf
589+
self_managed: CONFIG_ROOT/settings/psmux/psmux.local.conf
590+
os:
591+
- windows
592+
install_ppm:
593+
original: ~/.config/psmux/install-ppm.ps1
594+
self_managed: CONFIG_ROOT/settings/psmux/install-ppm.ps1
595+
os:
596+
- windows
561597
zellij_linux:
562598
config:
563599
original: ~/.config/zellij
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Set-StrictMode -Version Latest
2+
$ErrorActionPreference = "Stop"
3+
4+
$pluginRepository = "https://github.com/psmux/psmux-plugins.git"
5+
$temporaryCheckout = Join-Path ([System.IO.Path]::GetTempPath()) ("psmux-plugins-" + [System.Guid]::NewGuid().ToString())
6+
$pluginRoot = Join-Path $HOME ".psmux\plugins"
7+
$ppmTarget = Join-Path $pluginRoot "ppm"
8+
9+
try {
10+
git clone --depth 1 $pluginRepository $temporaryCheckout
11+
12+
New-Item -ItemType Directory -Path $pluginRoot -Force | Out-Null
13+
14+
if (Test-Path $ppmTarget) {
15+
Remove-Item $ppmTarget -Recurse -Force
16+
}
17+
18+
Copy-Item (Join-Path $temporaryCheckout "ppm") $ppmTarget -Recurse
19+
}
20+
finally {
21+
if (Test-Path $temporaryCheckout) {
22+
Remove-Item $temporaryCheckout -Recurse -Force
23+
}
24+
}
25+
26+
Write-Host "PPM installed to $ppmTarget"
27+
Write-Host "Start psmux and press Prefix + I to install the plugins declared in psmux.plugins.conf."
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
bind r source-file "~/.config/psmux/psmux.conf" \; display-message "psmux config reloaded"
2+
3+
bind C-c new-session -c "#{pane_current_path}"
4+
bind C-f command-prompt -p "switch session" "switch-client -t '%%'"
5+
6+
unbind n
7+
unbind p
8+
bind C-h previous-window
9+
bind C-l next-window
10+
bind Tab last-window
11+
12+
bind c new-window -c "#{pane_current_path}"
13+
bind - split-window -v -c "#{pane_current_path}"
14+
bind _ split-window -h -c "#{pane_current_path}"
15+
bind | split-window -h -c "#{pane_current_path}"
16+
17+
bind -r h select-pane -L
18+
bind -r j select-pane -D
19+
bind -r k select-pane -U
20+
bind -r l select-pane -R
21+
22+
bind -r H resize-pane -L 5
23+
bind -r J resize-pane -D 5
24+
bind -r K resize-pane -U 5
25+
bind -r L resize-pane -R 5
26+
27+
bind < swap-pane -U
28+
bind > swap-pane -D
29+
30+
# Pure psmux approximation of oh-my-tmux's maximize-to-new-window toggle.
31+
bind + if-shell -F '#{@restore_window}' 'join-pane -s "#{pane_id}" -t "#{@restore_window}" \; select-layout -t "#{@restore_window}" "#{@restore_layout}" \; select-window -t "#{@restore_window}" \; select-pane -t "#{pane_id}" \; set -p @restore_window "" \; set -p @restore_layout ""' 'set -p @restore_window "#{session_name}:#{window_index}" \; set -p @restore_layout "#{window_layout}" \; break-pane'
32+
33+
bind m if-shell -F "#{mouse}" 'set -g mouse off \; display-message "mouse off"' 'set -g mouse on \; display-message "mouse on"'
34+
35+
bind Enter copy-mode
36+
bind b list-buffers
37+
bind p paste-buffer
38+
bind P choose-buffer
39+
40+
bind -n C-l send-keys C-l \; clear-history
41+
42+
bind -T copy-mode-vi v send-keys -X begin-selection
43+
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
44+
bind -T copy-mode-vi H send-keys -X start-of-line
45+
bind -T copy-mode-vi L send-keys -X end-of-line
46+
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
47+
bind -T copy-mode-vi Escape send-keys -X cancel
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Install these files into ~/.config/psmux/ to keep the source-file paths valid.
2+
3+
set -g prefix C-b
4+
set -g prefix2 C-a
5+
unbind C-a
6+
bind C-a send-prefix
7+
8+
set -g escape-time 50
9+
set -g repeat-time 500
10+
set -g display-time 2000
11+
set -g history-limit 50000
12+
set -g status-interval 5
13+
set -g status-keys vi
14+
set -g mode-keys vi
15+
set -g base-index 1
16+
set -g pane-base-index 1
17+
set -g renumber-windows on
18+
set -g focus-events on
19+
set -g mouse on
20+
set -g mouse-selection off
21+
set -g scroll-enter-copy-mode on
22+
set -g env-shim on
23+
set -g warm on
24+
set -g prediction-dimming on
25+
set -g allow-predictions on
26+
27+
setw -g automatic-rename on
28+
29+
source-file "~/.config/psmux/psmux.theme.conf"
30+
source-file "~/.config/psmux/psmux.bindings.conf"
31+
source-file "~/.config/psmux/psmux.plugins.conf"
32+
33+
if-shell 'Test-Path "$HOME/.config/psmux/psmux.local.conf"' 'source-file "~/.config/psmux/psmux.local.conf"' ''
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Uncomment the next line if your Windows terminal font supports Powerline or Nerd Font glyphs.
2+
# source-file "~/.config/psmux/psmux.powerline.conf"
3+
4+
# Matching the existing tmux.local preference from this repo.
5+
bind Left previous-window
6+
bind Right next-window
7+
8+
# Useful Windows-specific toggles:
9+
# set -g paste-detection off
10+
# set -g cursor-style bar
11+
# set -g cursor-blink on
12+
# set -g pwsh-mouse-selection on
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Run install-ppm.ps1 once, then use Prefix + I / U / M from inside psmux.
2+
3+
set -g @plugin 'psmux-plugins/ppm'
4+
set -g @plugin 'psmux-plugins/psmux-sensible'
5+
set -g @plugin 'psmux-plugins/psmux-battery'
6+
set -g @plugin 'psmux-plugins/psmux-resurrect'
7+
set -g @plugin 'psmux-plugins/psmux-continuum'
8+
9+
set -g @continuum-save-interval '15'
10+
set -g @continuum-restore 'on'
11+
set -g @resurrect-dir '~/.psmux/resurrect'
12+
set -g @resurrect-processes 'pwsh powershell cmd ssh wsl python python3 uv node npm vim nvim less more tail'
13+
14+
if-shell 'Test-Path "$HOME/.psmux/plugins/ppm/ppm.ps1"' 'run "~/.psmux/plugins/ppm/ppm.ps1"' ''
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Enable this from psmux.local.conf when your terminal font includes Powerline symbols.
2+
3+
set -g status-left "#[fg=#ffff00,bg=#080808]#[fg=#080808,bg=#ffff00,bold] ❐ #S #[fg=#ff00af,bg=#ffff00]#[fg=#e4e4e4,bg=#ff00af] #{b:pane_current_path} #[fg=#5fff00,bg=#ff00af]#[fg=#080808,bg=#5fff00] #{pane_current_command}#[fg=#5fff00,bg=#080808]"
4+
set -g status-right "#[fg=#e4e4e4,bg=#080808]#[fg=#080808,bg=#e4e4e4,bold] %H:%M %d %b | #H #[fg=#d70000,bg=#e4e4e4]#[fg=#e4e4e4,bg=#d70000] #{?@battery_display,#{@battery_display},AC} #[fg=#080808,bg=#d70000]#[fg=#8a8a8a,bg=#080808] #{?client_prefix,⌨ ,}#{?#{>:#{session_attached},1},⚇ ,}#{?pane_synchronized,⚏ ,}#{?window_zoomed_flag,Z ,}#{?pane_in_mode,COPY ,}"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
set -g status-position bottom
2+
3+
set -g status-style "fg=#8a8a8a,bg=#080808"
4+
set -g message-style "fg=#080808,bg=#ffff00,bold"
5+
set -g message-command-style "fg=#ffff00,bg=#080808,bold"
6+
set -g mode-style "fg=#080808,bg=#ffff00,bold"
7+
8+
set -g pane-border-style "fg=#303030"
9+
set -g pane-active-border-style "fg=#00afff"
10+
11+
set -g window-status-style "fg=#8a8a8a,bg=#080808"
12+
set -g window-status-current-style "fg=#080808,bg=#00afff,bold"
13+
set -g window-status-activity-style "fg=default,bg=default,underscore"
14+
set -g window-status-bell-style "fg=#ffff00,bg=default,blink,bold"
15+
set -g window-status-last-style "fg=#00afff,bg=#303030"
16+
17+
set -g window-status-format "#[fg=#8a8a8a,bg=#080808] #I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,} "
18+
set -g window-status-current-format "#[fg=#080808,bg=#00afff,bold] #I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,} "
19+
20+
set -g status-left-length 120
21+
set -g status-right-length 120
22+
23+
set -g status-left "#[fg=#080808,bg=#ffff00,bold] ❐ #S #[fg=#e4e4e4,bg=#ff00af] #{b:pane_current_path} #[fg=#080808,bg=#5fff00] #{pane_current_command} "
24+
set -g status-right "#[fg=#8a8a8a,bg=#080808] #{?client_prefix,⌨ ,}#{?#{>:#{session_attached},1},⚇ ,}#{?pane_synchronized,⚏ ,}#{?window_zoomed_flag,Z ,}#{?pane_in_mode,COPY ,}#[fg=#e4e4e4,bg=#d70000] #{?@battery_display,#{@battery_display},AC} #[fg=#080808,bg=#e4e4e4,bold] %H:%M %d %b | #H "

0 commit comments

Comments
 (0)