tmux-yank

授权协议 MIT License
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 孟思远
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

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 PluginManager.

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

    set -g @plugin 'tmux-plugins/tmux-yank'
  2. Use prefixI install tmux-yank. You should nowbe able to tmux-yank immediately.

  3. When you want to update tmux-yank use prefixU.

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 inthe system clipboard.

macOS

Note: Some versions of macOS (aka OS X) have been reported to workwithout 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 touse the tmux-sensibleplugin.

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 usingiTerm2 version 3 or newer then the yin 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 incopy-mode and mouse selection will work without tmux-yank. See thetmux(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

    • prefixy — copies text from the command lineto 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 (requiresvim-husk orvim-rsi plugin)
    • prefixY — copy the current pane's currentworking directory to the clipboard.

  • Copy Mode

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

Default and Preferred Clipboard Programs

tmux-yank does its best to detect a reasonable choice for a clipboardprogram 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 whateveryou 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, andclipboard (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 mouseselections 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 toremain 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'sbuilt-in mouse support is also enabled (with mouse on since tmux 2.1, ormode-mouse on in older versions).

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

If you would prefer to disable this behavior, or provide your own bindings forthe 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 thefollowing configuration setting:

# ~/.tmux.conf

set -g @shell_mode 'vi'

This isn't needed with tmux 2.4 or newer.

Screen-cast

Note: The screen-cast uses Controly for"put selection". Use Y in v2.0.0 and later.

Other tmux plugins

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

License

MIT

  • 一、Tmux安装 sudo apt-get install tmux 若已经安装有Tmux,想更新成最新版本: sudo apt-get install -y tmux 二、Tmux环境变量配置 完成安装以后,可以进行环境变量的配置。 vim ~/.tmux.conf #使用vim打开 ~/.tmux.conf 使用vim打开 ~/.tmux.conf 后,添加如下代码并保存::  (以下是某

  • 注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。 Tmux 快捷键 & 速查表 启动新会话: tmux [new -s 会话名 -n 窗口名] 恢复会话: tmux at [-t 会话名] 列出所有会话: tmux ls 关闭会话: tmux kill-session -t 会话名 关闭所有会

  • set -g prefix ^a unbind ^b bind a send-prefix unbind '"' bind - splitw -v unbind % bind \ splitw -h bind r source-file ~/.tmux.conf \; unbind C-[ unbind C-] bind C-n new-session bind Tab last-window #

  • TPM安装 按照官网的做法,很简单就安装上了,输入下面命令: # 把管理器文件安装到`~/.tmux/plugins/tpm`之下 此前这些目录是不存在的 git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm # 新建配置文件 vim ~/.tmux.conf # 将下面内容复制到`~/.tmux.conf` # Lis

  • 一、Tmux安装 sudo apt-get install tmux 若已经安装有Tmux,想更新成最新版本: sudo apt-get install -y tmux 二、Tmux环境变量配置 完成安装以后,可以进行环境变量的配置。 vim ~/.tmux.conf #使用vim打开 ~/.tmux.conf 使用vim打开 ~/.tmux.conf 后,添加如下代码并保存::  (以

  • tmux系统剪切板 by Alexey Samoshkin 通过阿列克谢·萨莫什金(Alexey Samoshkin) 在实践中使用tmux:与系统剪贴板集成 (tmux in practice: integration with the system clipboard) 如何在tmux复制缓冲区和系统剪贴板之间建立桥梁,以及如何在OSX或Linux系统剪贴板上存储所选文本,从而解决本地和远程使

  • 本文全部快捷键和配置文件均在以下环境成功运行: 操作系统:MacOS 10.14 tmux 版本:tmux 2.9a 复制代码 最近进入了工作热情高涨的时期,疯狂的重构、打包、上传,每次这样搞都要重复开好多的终端窗口而且要一个一个的用鼠标点来点去的很麻烦(最近莫名的嫌弃鼠标),所以想起了之前被自己放到「待会儿再读」收藏夹的「十分钟学会 tmux」,貌似这个工具可以帮助我更好的管理终端窗口。 话不多

  •   (1)clone 源代码仓库: $ git clone https://github.com/tmux/tmux.git (2) 编译之前先安装libevent,去官网下载tar包: http://libevent.org 选择需要下载的版本复制链接地址,使用wget下载到本地(图形化的也可以直接下载),如(选择合适的版本,一般选stable即可): wget https://git

  • Cheatsheet: tmux, 参考 https://www.outcoldman.com/cheatsheets/tmux/ https://gist.github.com/noku/ceb09028b815034e41c1 Command line tmux new -s {session_name} -n {name} - create new session and specify w

  • 什么是Tmux 当你在公司使用SSH连接到公司的机器上,使用Iterm2打开很多窗体。当你回家后,准备工作时,还需要再那打那么多窗体。如果你感觉到烦的话,请使用它。 如何学习文章 Tmux 简介与使用:总结的很好 如何使用Tmux提高终端环境下的效率:特别基础,内容不多,多图。 tmux使用及个性化配置 Tmux 速成教程:技巧和调整:非常实用的文章 优雅地使用命令行:Tmux 终端复用 如何使用

  • tmux 配置 tmux 简介 tmux 是一个终端复用软件,类似的软件有screen,但是tmux 有一统江湖的趋势。 tmux 有如下好处。 session管理。可以在服务器上开一个tmuxsession,比开很多窗口到服务器上去好很多。 终端分割,可以将很大的一个窗口分成若干小块,每一个小块都可以独立操作,可以比较好 的处理一些小需求。 比如大部分用来写代码,一小块用来看程序的运行结果,这样

  • [20150427]tmux与INPUTRC定义冲突.txt --我前一阵子发现在tmux里面一些按键与INPUTRC冲突. 我的/etc/inputrc定义如下: "\e[1~": beginning-of-line    # home "\e[2~": yank-last-arg        # insert "\e[3~": delete-char          # delete "\

  • I'm currently stuck with a laptop running Windows at work, but I do all my development on a server running Linux, so I end up working in a tmux session over PuTTY all day. I wanted to copy text betwee

  • I'm currently stuck with a laptop running Windows at work, but I do all my development on a server running Linux, so I end up working in a tmux session over PuTTY all day. I wanted to copy text betwee

 相关资料
  • tmux allows you to create multiple tabs and panes within a single terminal window. It can also keep programs running after you disconnect (e.g. when you ssh into an AWS instance) Tutorials A Quick and

  • tmux是一个终端多路复用器:它可以在一个屏幕上创建、访问和控制多个终端。 tmux可以从屏幕上分离出来,在后台继续运行,然后再重新连接。可以在 OpenBSD、FreeBSD、NetBSD、Linux、OS X 和 Solaris 上运行。

  • .tmux Self-contained, pretty and versatile .tmux.conf configuration file. Installation Requirements: tmux >= 2.3 (soon >= 2.4) running inside Linux, Mac, OpenBSD, Cygwinor WSL awk, perl and sed outsid

  • Tmux Guest tmux-guest是一个管理tmux监视器的包。这个包的目的是创建一个可以以只读模式连接到tmux会话的用户。除了看tmux会话,创建的用户无法对系统做任何事情。只要你能直接调用tmux bin,它可以和tmux,byobu等一起工作。 安装: 安装Tmux Guest之前要确保你已经安装了tmux。 wget https://github.com/mie00/tmux-g

  • Tmux-config 是窗口管理器(tmux)上的配置工具,可作为一个 Vim 插件。 这个插件包含了使用 tmux 和 VIM 的工具和配置: tmux.conf -- 默认 tmux 配置 Vim cursors -- 在 Vim 模式中区别光标类型 Vim autosave -- 在任何终端命令执行前,自动保存所有 Vim 缓存

  • kubectl-tmux-exec 是一个使用 Tmux 将命令多路复用到 Pod 的 kubectl 插件,可以实现类似于 ssh 中的 csshX 或者 pssh 命令。 使用示例 同时用bash登录所有满足app=nginx的容器: kubectl tmux-exec -it -l app=nginx /bin/bash 安装方式 安装Homebrew,然后执行下面命令, brew inst

相关阅读

相关文章

相关问答

相关文档