GithubHelp home page GithubHelp logo

optionalg / tmux-yank Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tmux-plugins/tmux-yank

0.0 3.0 0.0 158 KB

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

License: MIT License

Shell 100.00%

tmux-yank's Introduction

Tmux Yank

Enables copying to system clipboard in Tmux.

Tested and working on Linux, OSX and Cygwin.

Screencast

screencast screenshot

Note: screencast shows using the "put selection" feature with Ctrl-y key binding in copy mode. In v2.0.0 this key binding was changed to Y (shift-y).

Key bindings

  • prefix + y - copies text from the command line to 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 (shift-y) - copy pane current working directory to clipboard.

copy mode bindings:

  • y - copy selection to system clipboard
  • Y (shift-y) - "put" selection - equivalent to copying a selection, and pasting it to the command line
  • Alt-y - performs both of the above: copy to system clipboard and put to command line (deprecated, not useful)

OS X requirements

  • reattach-to-user-namespace
    Install with brew $ brew install reattach-to-user-namespace or macports $ sudo port install tmux-pasteboard.

    Note: Beginning with OSX Yosemite (10.10), pbcopy is reported to work correctly with tmux, so we believe reattach-to-user-namespace is not needed anymore. Please install it in case the plugin doesn't work for you.

Linux requirements

  • xclip OR xsel command
    You most likely already have one of them, but if not:
    • Debian / Ubuntu: $ sudo apt-get install xclip or $ sudo apt-get install xsel
    • Red hat / CentOS: $ yum install xclip or $ yum install xsel

Cygwin requirements

  • putclip command
    Get the command by installing cygutils-extra package with Cygwin's setup*.exe.

Notes

Mouse Support

When making a selection using tmux mode-mouse on or mode-mouse copy-mode, you cannot rely on the default 'release mouse after selection to copy' behavior. Instead, press y before releasing mouse.

Shell vi mode compatibility

# in .tmux.conf
set -g @shell_mode 'vi'

Linux clipboard

Copying to clipboard is done using xclip -selection clipboard or xsel --clipboard command by default.

If copying is different on your system, and you need the command to be i.e. xclip -selection primary or xsel -i --primary, here's how to customize:

# in .tmux.conf
set -g @yank_selection 'primary'

Use full names as option ('primary', 'secondary', 'clipboard')

Installation with Tmux Plugin Manager (recommended)

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

set -g @plugin 'tmux-plugins/tmux-yank'

Hit prefix + I to fetch the plugin and source it. You should now be able to use the plugin.

Manual Installation

Clone the repo:

$ git clone https://github.com/tmux-plugins/tmux-yank ~/clone/path

Add this line to the bottom of .tmux.conf:

run-shell ~/clone/path/yank.tmux

Reload TMUX environment:

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

You should now be able to use the plugin.

Other Tmux goodies

  • tmux-copycat - a plugin for regex 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 env

You might want to follow @brunosutic on twitter if you want to hear about new tmux plugins or feature updates.

License

MIT

tmux-yank's People

Contributors

romainbossart avatar calvinchengx avatar janko avatar qstrahl avatar sencer avatar duffytilleman avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.