An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Swap tmux panes easily

![](/img/demo.gif)

## 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).