All Projects ā†’ tmux-plugins ā†’ Tmux Yank

tmux-plugins / Tmux Yank

Licence: mit
Tmux plugin for copying to system clipboard. Works on OSX, Linux and Cygwin.

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Tmux Yank

.tmux
šŸ‡«šŸ‡· Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ā¤ļø
Stars: āœ­ 15,594 (+703.4%)
Mutual labels:  tmux, wsl, tpm
Extrakto
tmux - quickly select, copy/insert/complete text without a mouse
Stars: āœ­ 320 (-83.51%)
Mutual labels:  tmux, clipboard
tmux-conf
šŸ“ TMUX Configuration for nerds with tpm
Stars: āœ­ 31 (-98.4%)
Mutual labels:  tmux, tpm
portabledevops
A portable devops tool set on windows, easy customization of cmder/console+msys2/cygwin/wsl
Stars: āœ­ 53 (-97.27%)
Mutual labels:  wsl, cygwin
win-gpg-agent
[DEPRECATED] Windows helpers for GnuPG tools suite
Stars: āœ­ 214 (-88.97%)
Mutual labels:  wsl, cygwin
runx
Provide X server on MS Windows with cookie authentication.
Stars: āœ­ 67 (-96.55%)
Mutual labels:  wsl, cygwin
Wsl Ssh Agent
Helper to interface with Windows ssh-agent.exe service from Windows Subsystem for Linux (WSL)
Stars: āœ­ 298 (-84.65%)
Mutual labels:  wsl, clipboard
Isomorphic Copy
Cross platform clipboard | networkless! remote copy
Stars: āœ­ 86 (-95.57%)
Mutual labels:  tmux, clipboard
Docker Dev
Container images for portable development environments
Stars: āœ­ 128 (-93.41%)
Mutual labels:  tmux
Xwsl
Simple method to install Ubuntu 20.04 with XFCE4 desktop in WSL. Does not require hypervisor, container, or X11 server.
Stars: āœ­ 137 (-92.94%)
Mutual labels:  wsl
Newznab Tmux
Laravel based usenet indexer
Stars: āœ­ 127 (-93.46%)
Mutual labels:  tmux
Setup
Setup a new machine without sudo!
Stars: āœ­ 130 (-93.3%)
Mutual labels:  tmux
Dotfiles
āš”ļø Awesome configurations for the development environments
Stars: āœ­ 137 (-92.94%)
Mutual labels:  tmux
Dotfiles
My dotfiles
Stars: āœ­ 127 (-93.46%)
Mutual labels:  tmux
Tmux
šŸ§›šŸ»ā€ā™‚ļø Dark theme for tmux
Stars: āœ­ 138 (-92.89%)
Mutual labels:  tmux
3mux
Terminal multiplexer inspired by i3
Stars: āœ­ 1,687 (-13.09%)
Mutual labels:  tmux
Nnn
nĀ³ The unorthodox terminal file manager
Stars: āœ­ 13,138 (+576.87%)
Mutual labels:  wsl
Xkbswitch Macosx
Console keyboard layout switcher for MacOS
Stars: āœ­ 144 (-92.58%)
Mutual labels:  tmux
Wslgit
šŸ¬ Use Git installed in WSL(Windows Subsystem for Linux) from Windows and Visual Studio Code
Stars: āœ­ 141 (-92.74%)
Mutual labels:  wsl
Wsl Proxy
WSL proxy files for editor/linux interop
Stars: āœ­ 134 (-93.1%)
Mutual labels:  wsl

Build Status GitHub release GitHub issues

tmux-yank

Copy to the system clipboard in tmux.

Supports:

  • Linux
  • macOS
  • Cygwin
  • Windows Subsystem for Linux (WSL)

Installing

Via TPM (recommended)

The easiest way to install tmux-yank is via the Tmux Plugin Manager.

  1. Add plugin to the list of TPM plugins in .tmux.conf:

    set -g @plugin 'tmux-plugins/tmux-yank'
  2. Use prefixā€“I install tmux-yank. You should now be able to tmux-yank immediately.

  3. When you want to update tmux-yank use prefixā€“U.

Manual Installation

  1. Clone the repository

    $ git clone https://github.com/tmux-plugins/tmux-yank ~/clone/path
  2. Add this line to the bottom of .tmux.conf

    run-shell ~/clone/path/yank.tmux
  3. Reload the tmux environment

    # type this inside tmux
    $ tmux source-file ~/.tmux.conf

You should now be able to use tmux-yank immediately.

Requirements

In order for tmux-yank to work, there must be a program that store data in the system clipboard.

macOS

Note: Some versions of macOS (aka OS X) have been reported to work without reattach-to-user-namespace. It doesn't hurt to have it installed.

  • OS X 10.8: Mountain Lion ā€“ required
  • OS X 10.9: Mavericks ā€“ required
  • OS X 10.10: Yosemite ā€“ not required
  • OS X 10.11: El Capitan ā€“ not required
  • macOS 10.12: Sierra ā€“ required
  • macOS 10.14: Mojave - required
  • macOS 10.15: Catalina - not required

The easiest way to use reattach-to-user-namespace with tmux is use to use the tmux-sensible plugin.

To use it manually, use:

# ~/.tmux.conf
set-option -g default-command "reattach-to-user-namespace -l $SHELL"

If you have tmux 1.5 or newer and are using iTerm2 version 3 or newer then the y in copy-mode and mouse selection will work without tmux-yank.

To enable this:

  1. Go into iTerm2's preferences.

  2. Go to the "General" tab.

  3. Check "Applications in terminal may access clipboard"

  4. In tmux, ensure set-clipboard is turned on:

    $ tmux show-options -g -s set-clipboard
    set-clipboard on

HomeBrew (recommended)

$ brew install reattach-to-user-namespace

MacPorts

$ sudo port install tmux-pasteboard

Linux

  • xsel (recommended) or xclip (for X).
  • wl-copy from wl-clipboard (for Wayland)

If you have tmux 1.5 or newer and are using xterm, the y in copy-mode and mouse selection will work without tmux-yank. See the tmux(1) man page entry for the set-clipboard option.

Debian & Ubuntu

$ sudo apt-get install xsel # or xclip

RedHat & CentOS

$ sudo yum install xsel # or xclip

Cygwin

  • (optional) putclip which is part of the cygutils-extra package.

Windows Subsystem for Linux (WSL)

  • clip.exe is shipped with Windows Subsystem for Linux.

Configuration

Key bindings

  • Normal Mode

    • prefixā€“y ā€” copies text from the command line to the clipboard.

      Works with all popular shells/repls. Tested with:

      • shells: bash, zsh (with bindkey -e), tcsh
      • repls: irb, pry, node, psql, python, php -a, coffee
      • remote shells: ssh, mosh
      • vim/neovim command line (requires vim-husk or vim-rsi plugin)
    • prefixā€“Y ā€” copy the current pane's current working directory to the clipboard.

  • Copy Mode

    • y ā€” copy selection to system clipboard.
    • Y (shift-y) ā€” "put" selection. Equivalent to copying a selection, and pasting it to the command line.

Default and Preferred Clipboard Programs

tmux-yank does its best to detect a reasonable choice for a clipboard program on your OS.

If tmux-yank can't detect a known clipboard program then it uses the @custom_copy_command tmux option as your clipboard program if set.

If you need to always override tmux-yank's choice for a clipboard program, then you can set @override_copy_command to force tmux-yank to use whatever you want.

Note that both programs must accept STDIN for the text to be copied.

An example of setting @override_copy_command:

# ~/.tmux.conf

set -g @custom_copy_command 'my-clipboard-copy --some-arg'
# or
set -g @override_copy_command 'my-clipboard-copy --some-arg'

Linux Clipboards

Linux has several cut-and-paste clipboards: primary, secondary, and clipboard (default in tmux-yank is clipboard).

You can change this by setting @yank_selection:

# ~/.tmux.conf

set -g @yank_selection 'primary' # or 'secondary' or 'clipboard'

With mouse support turned on (see below) the default clipboard for mouse selections is primary.

You can change this by setting @yank_selection_mouse:

# ~/.tmux.conf

set -g @yank_selection_mouse 'clipboard' # or 'primary' or 'secondary'

Controlling Yank Behavior

By default, tmux-yank will exit copy mode after yanking text. If you wish to remain in copy mode, you can set @yank_action:

# ~/.tmux.conf

set -g @yank_action 'copy-pipe' # or 'copy-pipe-and-cancel' for the default

Mouse Support

tmux-yank has mouse support enabled by default. It will only work if tmux's built-in mouse support is also enabled (with mouse on since tmux 2.1, or mode-mouse on in older versions).

To yank with the mouse, click and drag with the primary button to begin selection, and release to yank.

If you would prefer to disable this behavior, or provide your own bindings for the MouseDragEnd1Pane event, you can do so with:

# ~/.tmux.conf

set -g @yank_with_mouse off # or 'on'

If you want to remain in copy mode after making a mouse selection, set @yank_action as described above.

vi mode support

If using tmux 2.3 or older and using vi keys then you'll have add the following configuration setting:

# ~/.tmux.conf

set -g @shell_mode 'vi'

This isn't needed with tmux 2.4 or newer.

Screen-cast

screencast screenshot

Note: The screen-cast uses Controlā€“y for "put selection". Use Y in v2.0.0 and later.

Other tmux plugins

  • tmux-copycat - a plugin for regular expression searches in tmux and fast match selection
  • tmux-open - a plugin for quickly opening highlighted file or a URL
  • tmux-continuum - automatic restoring and continuous saving of tmux environment.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].