4 ms·
Yes! I have a shell function that automatically attaches to an existing tmux session or creates a new tmux session if none exists already, after logging into th
by susam 4y ago
Yes! I have a shell function that automatically attaches to an existing tmux session or creates a new tmux session if none exists already, after logging into the remote system via SSH:
ssht() {
ssh -t $1 'tmux a || tmux'
}
- skhm 4y agoDon't you find it painful having your tmux session rooted in your homedir (e.g. for all new windows)? I nearly always need to have it anchored some project working directory.
- mathstuf 4y agoI have tmux anchored to ~ because I hated new shells inheriting random cwd states. Instead I have a function to cd to "bookmarks" with an easy way to add to it and completion.
- susam 4y agoI have the following in my ~/.tmux.conf so that whenever I split pane or create a new tmux window, it sets the current working directory of the new pane or window to the same directory in which I was before: # Open new pane or window with the current directory bind '"' split-window -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}" bind c new-window -c "#{pane_current_path}" So although the tmux session is run in my home directory, I only need to change the current working directory to my project directory once and then when I create new panes and windows, they have the project directory as the current working directory.