tmux: bind b to toggling the scratch session
dblume

dblume commited on 2025-07-19 17:43:32
Showing 1 changed files, with 3 additions and 4 deletions.


Don't need the hardcoded "bc -l" popup anymore.
The one persistent scratch session will be used for all REPLs.
Mnemonic will be "b" for "bash shell", but "b" is just easier to
type than '"'.
... ...
@@ -40,18 +40,17 @@ bind -n M-l select-pane -R
40 40
 # open an app in current directory in a popup
41 41
 # from https://www.youtube.com/watch?v=70cN9swORE8&t=440s
42 42
 #bind o popup -E -d "#{pane_current_path}" -w 90% -h 90% "opencode"
43
-bind b popup -E -w 80% -h 45% "bc -l"
44 43
 
45 44
 # https://www.reddit.com/r/tmux/comments/olgte7/comment/jz4t9rc/
46 45
 # Toggle scratch session.
47 46
 # Create a detached session and disable the status line before attaching to it
48
-bind '"' if -F '#{==:#{session_name},scratch}' { 
47
+bind b if -F '#{==:#{session_name},scratch}' { 
49 48
     detach-client 
50 49
   } { 
51 50
     if "tmux has-session -t scratch" {
52
-      popup -E -w 80% "tmux attach-session -t scratch"
51
+      popup -E -w 90% -h 60% "tmux attach-session -t scratch"
53 52
     } {
54
-      popup -E -w 80% "tmux new-session -d -c '#{pane_current_path}' -s scratch && tmux set-option -t scratch status off && tmux attach-session -t scratch"
53
+      popup -E -w 90% -h 60% "tmux new-session -d -c '#{pane_current_path}' -s scratch && tmux set-option -t scratch status off && tmux attach-session -t scratch"
55 54
     }
56 55
 }
57 56
 
58 57