Skip to content

Instantly share code, notes, and snippets.

@nhoffman
Last active April 3, 2017 17:16
Show Gist options
  • Save nhoffman/99b5ecbefc29cf1be7f188cc9ce3cd70 to your computer and use it in GitHub Desktop.
Save nhoffman/99b5ecbefc29cf1be7f188cc9ce3cd70 to your computer and use it in GitHub Desktop.
My tmux notes

tmux notes

sessions

Create a new session then rename it:

C-b :new
C-b $

Create a new named session:

C-b :new -s <name> 

Alias to move the current window to a different session:

tmux-send-window () {
        session=$1
        if [[ -z $session ]]
        then
                echo "usage: $0 <session-name>"
                return 1
        fi
        if [[ $session = $(tmux display-message -p '#S') ]]
        then
                echo "error: can't send window to current session"
                return 1
        fi
        local dst=$(($(tmux list-windows -t $session | cut -f1 -d: | tail -n-1) + 1))
        local src=$(tmux display-message -p '#I')
        echo tmux move-window -d -s $src -t ${session}:$dst
        TERM=xterm tmux move-window -d -s $src -t ${session}:$dst
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment