https://github.com/abicky/swap-pane
Swap tmux panes easily
https://github.com/abicky/swap-pane
Last synced: about 1 year ago
JSON representation
Swap tmux panes easily
- Host: GitHub
- URL: https://github.com/abicky/swap-pane
- Owner: abicky
- Created: 2014-05-05T07:46:14.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2017-03-22T17:24:35.000Z (over 9 years ago)
- Last Synced: 2025-03-23T18:11:16.158Z (over 1 year ago)
- Language: Shell
- Size: 1.45 MB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Swap tmux panes easily

## Installation
### 1. Clone this repository and put swap-pane in your PATH
```
% git clone https://github.com/abicky/swap-pane.git
% cp swap-pane/swap-pane /path/to/your/bin/
```
### 2. Install peco
swap-pane depends on [peco](https://github.com/peco/peco), so you must install it.
### 3. Add the following lines in your .zshrc and .tmux.conf
#### .zshrc
```
autoload -U add-zsh-hook
if [ "$TMUX" ]; then
function _set-pane-name() {
local max_cmd_length=20
local cmd="$1"
if [ $#cmd -gt $max_cmd_length ]; then
cmd="${cmd:0:$max_cmd_length}..."
fi
printf "\033]2;${PWD/$HOME/~}: $cmd\033\\"
}
add-zsh-hook preexec _set-pane-name
add-zsh-hook precmd _set-pane-name
fi
```
#### .tmux.conf
```
bind-key b new-window -nswap-pane 'swap-pane -t'
bind-key B run-shell 'swap-pane -n'
```
## Usage
Execute `swap-pane` command or type ` b` to swap the current pane.
```
% swap-pane
```
` b` opens a temporary window to select an existing pane, so you can swap the current pane even if its process is not finished yet.
You can also execute `swap-pane -n` or type ` B` to swap the current pane with a new pane.
```
% swap-pane -n
```
## Author
Takeshi Arabiki (abicky)
## Copyright and License
Copyright (c) 2014-2017 Takeshi Arabiki licensed under the [MIT license](http://opensource.org/licenses/MIT).