Skip to content

Instantly share code, notes, and snippets.

@srishanbhattarai
Last active February 22, 2018 14:41
Show Gist options
  • Save srishanbhattarai/44bc1ce44ba0cfd11f43cc31b1720d02 to your computer and use it in GitHub Desktop.
Save srishanbhattarai/44bc1ce44ba0cfd11f43cc31b1720d02 to your computer and use it in GitHub Desktop.
Sane copy pasta - tmux 2.5 + neovim + terminal (tested on Alacritty/iTerm2)
# References:
# https://github.com/tmux/tmux/issues/543
# https://github.com/tmux/tmux/issues/543#issuecomment-298193820
#
# PREREQUISITE:
# ❯ brew install reattach-to-user-namespace --wrap-pbcopy-and-pbpaste
# Add the following snippet to your .tmux.conf -
setw -g mode-keys vi
set -g default-shell $SHELL
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
" In your .vimrc, or neovim's init.vim file:
" Add the following line -
set clipboard=unnamed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment