Skip to content

Instantly share code, notes, and snippets.

@AnatomicJC
Last active Sep 24, 2020
Embed
What would you like to do?
tmux powerline / mouse / cheat sheet

Powerline

# apt install powerline
$ cat ~/.tmux.conf 
source "/usr/share/powerline/bindings/tmux/powerline.conf"
set -g default-terminal "screen-256color"
set -g mouse on
set -g history-limit 500000

bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"

# https://blog.jpalardy.com/posts/tmux-synchronized-panes/
bind C-x setw synchronize-panes

# Memos
# tmux list-keys | grep selection
# tmux show -wg mode-keys (must return vi, not emacs)

# For binding 'y' to copy and exiting selection mode
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i'

Cheat sheet

https://tmuxcheatsheet.com

Buffer, copy/paste, ...

Tmux copy-paste - the defaults

  1. Enter ‘copy mode’ by pressing ctrl+b then [
  2. Use the arrow keys to go to the position from where you want to start copying. Press ctrl+space to start copying.
  3. Use arrow keys to go to the end of text you want to copy. Press alt+w or ctrl+w to copy into Tmux buffer.
  4. Press ctrl+b then ] to paste in a possibly different Tmux pane/window.

Copy-paste with mouse

  1. Select with mouse what you want to copy
  2. Before release your left button, press Ctrl+b
  3. Press ctrl+w or alt+w to copy into Tmux buffer
  4. Press ctrl+b then ] to paste in another Tmux pane/window

Copy-paste with mouse to clipboard

$EDITOR must exists and be set to vim

In your ~/.bashrc, ~/.zshrc, ~/.otherrc:

export EDITOR="vim"

Install xclip:

$ sudo apt install xclip

Add this to your ~/.tmux.conf:

# For binding 'y' to copy and exiting selection mode
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i'

Then to copy/paste:

  1. Select with mouse what you want to copy
  2. Before release your left button, press Ctrl+b
  3. Press the y button
  4. press ctrl+v in any other application

Memos

tmux list-keys | grep selection
tmux show -wg mode-keys # must return vi, not emacs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment