by chrisamiller · 2y ago · 0 comments
Since I work with big biological data, most of my work takes place on our university cluster, which means my laptop is just a dumb terminal and all of the action takes place on the server. IME, tmux is especially powerful with coupled with mosh, which gives a persistent SSH connection. That means I can be in the middle of a project, close my laptop lid, go home, then later that evening, open my lid and everything is reconnected and just right there. Same if I reboot my laptop - one command to reconnect my terminal with mosh, and I'm back in the middle of my complicated multi-window project.
bind -n S-PPage copy-mode -u
bind -T copy-mode S-PPage send -X page-up
bind -T copy-mode S-NPage send -X page-down
The first line is a top-level binding to enter copy-mode and immediately scroll up one page. The other two add bindings within copy-mode so you can continue to scroll up or down with those keys.I also have a small hack in my .zshrc to start scrolling up with `M-v` (like in Emacs) while at a shell prompt:
tmuxup(){tmux copy-mode -u}
zle -N tmuxup
bindkey '^[v' tmuxupThis is something tmux inherited from screen, but it from a quick test it looks like they didn't copy the whole thing? You use [ to enter this mode (it's actually for copying text, not just scrolling) and in screen use ] to exit without copying anything. Looks like tmux doesn't have ], at least by default?