Tmux makes me sad

This commit is contained in:
Daniel Flanagan 2023-07-18 01:57:44 -05:00
parent fba0b27370
commit 402703e686
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
7 changed files with 50 additions and 43 deletions

5
common/bin/bp Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env sh
printf '\e[?2004h'
printf '\e[?2004l'
echo bp off

4
common/bin/tmux-edit-buffer Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env sh
f="$(tmux-save-buffer)"
tmux new-window "$EDITOR $f"

View file

@ -1,10 +1,9 @@
#!/usr/bin/env sh #!/usr/bin/env sh
sess="$1"; shift
d="$(date +%Y-%m-%d_%H-%M-%S)" d="$(date +%Y-%m-%d_%H-%M-%S)"
f="${USER_LOGS_PATH}/${d}.${sess}.tmux-buffer.log" f="${USER_LOGS_PATH}/${d}.tmux-buffer.log"
mkdir -p "$(dirname "$f")" mkdir -p "$(dirname "$f")"
touch "$f" touch "$f"
chmod 600 "$f" chmod 600 "$f"
tmux capture-pane -pS -1000000000 > "$f" tmux capture-pane -pS -1000000000 > "$f"
echo "Saved pane output to $f" echo "$f"

View file

@ -72,3 +72,7 @@ if not set --query ZELLIJ && set --query FISH_START_ZELLIJ
else if not set --query TMUX && set --query FISH_START_TMUX else if not set --query TMUX && set --query FISH_START_TMUX
tmux att -t default || tmux new -s default tmux att -t default || tmux new -s default
end end
if set --query TMUX
bp
end

View file

@ -205,7 +205,7 @@ function __ssh_agent_start -d "start a new ssh agent"
end end
if set --query KITTY_PID if set --query KITTY_PID
# alias ssh "kitty +kitten ssh" alias kssh "kitty +kitten ssh"
end end
function fish_ssh_agent --description "Start ssh-agent if not started yet, or uses already started ssh-agent." function fish_ssh_agent --description "Start ssh-agent if not started yet, or uses already started ssh-agent."

View file

@ -38,23 +38,23 @@ map shift+insert paste_from_clipboard
map ctrl+shift+v paste_from_selection map ctrl+shift+v paste_from_selection
map ctrl+shift+c copy_to_clipboard map ctrl+shift+c copy_to_clipboard
map ctrl+shift+j launch --location=hsplit --cwd=current
map ctrl+shift+l launch --location=vsplit --cwd=current
# kill pane # kill pane
map ctrl+shift+q close_window map ctrl+shift+q close_window
# kill tab # kill tab
map ctrl+alt+shift+q close_tab map ctrl+alt+shift+q close_tab
map ctrl+alt+shift+k move_window up # map ctrl+shift+j launch --location=hsplit --cwd=current
map ctrl+alt+shift+h move_window left # map ctrl+shift+l launch --location=vsplit --cwd=current
map ctrl+alt+shift+l move_window right #
map ctrl+alt+shift+j move_window down # map ctrl+alt+shift+k move_window up
# map ctrl+alt+shift+h move_window left
map ctrl+h neighboring_window left # map ctrl+alt+shift+l move_window right
map ctrl+l neighboring_window right # map ctrl+alt+shift+j move_window down
map ctrl+k neighboring_window up #
map ctrl+j neighboring_window down # map ctrl+h neighboring_window left
# map ctrl+l neighboring_window right
# map ctrl+k neighboring_window up
# map ctrl+j neighboring_window down
map ctrl+shift+n nth_window -1 map ctrl+shift+n nth_window -1
map ctrl+shift+space>u kitten hints --type=url --program @ map ctrl+shift+space>u kitten hints --type=url --program @

View file

@ -1,38 +1,38 @@
unbind C-b unbind C-b
set -g prefix C-s set -g prefix C-s
bind s send-prefix
bind v split-window -h -c "#{pane_current_path}" set -g update-environment "WAYLAND_DISPLAY DISPLAY"
bind b split-window -c "#{pane_current_path}"
bind T source-file "$HOME/.tmux.conf" \; display-message "Reloaded $HOME/.tmux.conf" bind R source-file "$HOME/.tmux.conf" \; display-message "Reloaded $HOME/.tmux.conf"
bind o display-message "Saved pane output to #(tmux-save-buffer '#S')"
# dump buffer contents to file bind O run "tmux-edit-buffer"
bind O display-message "#(tmux-save-buffer '#S')"
# TODO: dump buffer to file and open in EDITOR?
bind D attach-session -t . -c '#{pane_current_path}' \; display-message "Set session path to #{pane_current_path}" bind D attach-session -t . -c '#{pane_current_path}' \; display-message "Set session path to #{pane_current_path}"
# toggle status bar bind H set -s status # toggle status bar
bind H set -s status
bind v split-window -h -c "#{pane_current_path}"
bind b split-window -c "#{pane_current_path}"
bind h split-window -c "#{pane_current_path}"
# pane navigation
bind -n C-l select-pane -R bind -n C-l select-pane -R
bind -n C-k select-pane -U bind -n C-k select-pane -U
bind -n C-j select-pane -D bind -n C-j select-pane -D
# enabling a ^J hotkey causes breakage when pasting anything that start with a newline, since it triggers the hotkey and some weird interaction with bracketed paste causes the pane to enter a broken state
bind -n C-h select-pane -L bind -n C-h select-pane -L
bind -n C-M-l split-window -h -c "#{pane_current_path}"
bind -n C-M-j split-window -v -c "#{pane_current_path}"
# tab creation # tab creation
bind -n C-t new-window bind -n C-t new-window
bind Tab next-window
# tab nav is the default p and n binds # tab nav is the default p and n binds
# window switcher is the default w bind # window switcher is the default w bind
# session switcher bind s run "tmux split-window -l 12 'tmuxswitcher'" # session switcher
bind s run "tmux split-window -l 12 'tmuxswitcher'"
set -g update-environment "WAYLAND_DISPLAY DISPLAY"
set -g mouse on set -g mouse on
set -g escape-time 0 set -g escape-time 0
@ -44,11 +44,10 @@ set -g activity-action none
set -g mode-keys vi set -g mode-keys vi
set -g history-limit 1000000 set -g history-limit 1000000
set -g status on set -g status on
set -g status-position bottom set -g status-position bottom
set -g status-style "fg=colour8 bg=default" set -g status-style "fg=colour8 bg=default"
# set -g status-bg default
# set -g status-fg colour8
set -g status-interval 5 set -g status-interval 5
set -g status-left-length 50 set -g status-left-length 50
set -g window-status-style "fg=colour8 bg=default" set -g window-status-style "fg=colour8 bg=default"
@ -59,12 +58,8 @@ set -g window-status-bell-style "fg=colour1 bg=default"
set -g window-status-current-style "fg=colour4 bg=default" set -g window-status-current-style "fg=colour4 bg=default"
set -g window-status-current-format " #W " set -g window-status-current-format " #W "
set -g status-left "#h:#S " set -g status-left "#h:#S "
set -g status-right "" set -g status-right "#(kubeline && printf ' ')"
# set -ag status-right "#(pwd | $XDG_CONFIG_HOME/lytedev-dotfiles/common/bin/glancepath) "
set -ag status-right "#(kubeline && printf ' ')"
set -g status-left-length 1000 set -g status-left-length 1000
# set -g status-right-length 280
# set -ag status-right "#{pane_current_command}"
set -g message-style "fg=colour7 bg=default" set -g message-style "fg=colour7 bg=default"
set -g pane-active-border-style fg=blue set -g pane-active-border-style fg=blue
@ -81,8 +76,8 @@ set -g window-status-current-format "#W"
# save-buffer /tmp/tmux-buffer \;\ # save-buffer /tmp/tmux-buffer \;\
# split-window -l 10 "urlscan /tmp/tmux-buffer" # split-window -l 10 "urlscan /tmp/tmux-buffer"
bind -T copy-mode-vi "y" send-keys -X copy-pipe-no-clear 'wl-copy' \; display-message 'Copied to clipboard!' bind -T copy-mode-vi "y" send-keys -X copy-pipe-no-clear 'clip' \; display-message 'Copied to clipboard!'
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear 'wl-copy' \; display-message 'Copied to clipboard!' bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear 'clip' \; display-message 'Copied to clipboard!'
bind K kill-pane bind K kill-pane
bind C-S-k kill-window bind C-S-k kill-window