tmux-open


Ⅰ. 插件描述

Tmux key bindings for quick opening of a highlighted file or url

Ⅱ. 基本信息

创建日期:  2014-07-31
使用用户:  1
Github星:  359
插件作者:  tmux-plugins

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'tmux-plugins/tmux-open'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'tmux-plugins/tmux-open'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'tmux-plugins/tmux-open'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/tmux-plugins/tmux-open

Ⅳ. 文档说明

# Tmux open

Plugin for opening highlighted selection directly from Tmux copy mode.

Tested and working on Linux, OSX and Cygwin.

Key bindings

In tmux copy mode:

  • o - "open" a highlighted selection with the system default program. open
    for OS X or xdg-open for Linux.
  • Ctrl-o - open a highlighted selection with the $EDITOR
  • Shift-s - search the highlighted selection directly inside a search engine (defaults to google).

Examples

In copy mode:

  • highlight file.pdf and press o - file will open in the default PDF viewer.
  • highlight file.doc and press o - file will open in system default .doc
    file viewer.
  • highlight http://example.com and press o - link will be opened in the
    default browser.
  • highlight file.txt and press Ctrl-o - file will open in $EDITOR.
  • highlight TypeError: 'undefined' is not a function and press Shift-s - the text snipped will be searched directly inside google by default

Screencast

screencast screenshot

Installation with Tmux Plugin Manager (recommended)

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

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

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-open ~/clone/path

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

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

Reload TMUX environment:

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

You should now be able to use the plugin.

Configuration

How can I change the default "o" key binding to something else? For example,
key "x"?

Put set -g @open 'x' in tmux.conf.

How can I change the default "Ctrl-o" key binding to "Ctrl-x"?

Put set -g @open-editor 'C-x' in tmux.conf.

How can I change the default search engine to "duckduckgo" or any other one?

Put set -g @open-S 'https://www.duckduckgo.com/' in tmux.conf

How can I use multiple search engines?

Put:

set -g @open-B 'https://www.bing.com/search?q='
set -g @open-S 'https://www.google.com/search?q='

in tmux.conf

Other goodies

tmux-open works great with:

  • tmux-copycat - a plugin for
    regex searches in tmux and fast match selection
  • tmux-yank - enables copying
    highlighted text to system clipboard

License

MIT

添加新评论