Skip to content

Instantly share code, notes, and snippets.

@algesten
Created May 14, 2017 08:30
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save algesten/0ba2d7c19763db6a7396126e8526b65b to your computer and use it in GitHub Desktop.
Save algesten/0ba2d7c19763db6a7396126e8526b65b to your computer and use it in GitHub Desktop.
A tmux.conf with pbcopy
# propagate titles to the window
set -g set-titles on
# Minimalist window title "0:bash"
set -g set-titles-string "#I:#W"
# show colors
set -g default-terminal "screen-256color"
# rename window to current process
set-window-option -g automatic-rename on
# this enables mouse selections and scroll wheel
set -g mouse on
# Update all bindings to integrate copy-buffer with macOS.
# brew install reattach-to-user-namespace
unbind-key -T copy-mode M-w
bind-key -T copy-mode C-w send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X stop-selection
# I keep dragging when just selecting the window.
unbind-key -T root MouseDrag1Pane
# Double clicking selects the word also when not in copy-mode.
bind-key -T root DoubleClick1Pane select-pane \; copy-mode \; send-keys -X select-word
# Start new window on Ctrl-n. Mapped to Command-n in .alacritty.yml
# This matches the behaviour of the Terminal app for starting new windows.
bind-key -T root C-n new-window
# C-o both cleans the screen and history. Mapped to Command-k in .alacritty.yml
# This matches the behaviour of Terminal app to quickly clear all.
bind-key -T root C-o send-keys C-l \; run-shell "sleep .3s" \; clear-history
# Ctrl-Left/Right to cycle the windows
bind-key -T root C-Left previous-window
bind-key -T root C-Right next-window
@revolutionnaire
Copy link

revolutionnaire commented Jun 13, 2023

Is there really a space between -T and copy-mode? I'm asking because I'm using this: bind-key -Tcopy-mode-vi 'y' send -X copy-selection and it doesn't copy the highlighted texts. I haven't coded in a long time and I'm just relearning again how to use tmux.

@algesten
Copy link
Author

There is no general rule for whether a CLI program needs a space after an argument. It's all up to the program in question. Sounds like bind-key doesn't care. This is not surprising at all, it's quite common.

@revolutionnaire
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment