extrakto

laktakMIT更新放缓

tmux 插件,让你不用鼠标就能快速从终端里提取、复制、插入或补全文本,省去来回切换窗口和手动选字的麻烦。

extrakto for tmux - quickly select, copy/insert/complete text without a mouse

暂无版本1,158star61fork同步于 2026-11-07 07:33 UTC

怎么上手

由 README 提炼,执行前请确认
set -g @plugin 'laktak/extrakto'
硬件要求按 README 说明

README 未说明;仅要求 tmux(弹窗需 3.2+)、fzf 或 skim、Python 3.6+ 和 POSIX shell

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

tmux 插件,用模糊查找从屏幕文本里快速选取、复制或插入内容,不用鼠标

tmux 插件,让你不用鼠标就能快速从终端里提取、复制、插入或补全文本,省去来回切换窗口和手动选字的麻烦。

核心能力

  • 按 prefix+tab 启动 fzf 模糊查找屏幕上的文本
  • 支持 word、line、path、url、quote 等过滤器并可自定义
  • tab 插入到当前窗格,enter 复制到系统剪贴板
  • 可抓取 recent、full 或整个 window 的窗格内容
  • 附带独立 CLI 工具从纯文本中提取 token

容易踩的坑

需先安装 fzf 或 skim,否则无法启动;tmux 低于 3.2 时不会用弹窗而是开分屏;远程 ssh 复制需把 @extrakto_clip_mode 设为 tmux_osc52;自定义 FZF_DEFAULT_OPTS 默认会被取消设置

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    extrakto for tmux

    { repos & mirrors: github.com/laktak/extrakto, codeberg.org/laktak/extrakto }

    intro

    Output completions - you can complete commands that require you to retype text that is already on the screen. This works everywhere, even in remote ssh sessions.

    You can fuzzy find your text instead of selecting it by hand:

    • press tmux prefix + tab to start extrakto
    • fuzzy find the text/path/url/line
    • use custom filters (ctrl + f)
    • press
      • tab to insert it to the current pane,
      • enter to copy it to the clipboard,
    • see other features in HELP (press ctrl-l in extrakto)

    Use it for paths, URLs, options from a man page, git hashes, docker container names, ...

    Requirements

    • tmux - popups require 3.2, otherwise extrakto will open in a split window.
    • fzf or skim (see below)
    • Python 3.6+
    • a posix shell like Bash
    • optionally Tmux Plugin Manager

    Supported clipboards:

    • Linux Xorg (xclip) and Wayland (wl-copy)
    • macOS (pbcopy)
    • WSL
    • bring your own, see the Wiki for examples (like termux)

    Installation

    Using Tmux Plugin Manager

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

    set -g @plugin 'laktak/extrakto'
    

    Hit prefix + I to fetch the plugin and source it. You can use prefix + U to update all plugins.

    You should now have all extrakto key bindings defined.

    Manual Method

    Clone the repo:

    $ git clone https://github.com/laktak/extrakto ~/clone/path
    

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

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

    Reload the tmux environment:

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

    You should now have all extrakto key bindings defined.

    Wiki

    Add or look for special requirements and tips in our wiki.

    Options

    You can set any of these options by adding them to your ~/.tmux.conf file:

    set -g <option> "<value>"
    

    Where <option> and <value> correspond to one of the options specified below

    Common Options

    OptionDefaultDescription
    @extrakto_grab_areawindow fullWhether you want extrakto to grab data from the recent area, the full pane, all current window's (window recent) areas or all current window's (window full) panes. You can also set this option to any number you want (or number preceded by "window ", e.g. "window 500"), this allows you to grab a smaller amount of data from the pane(s) than the pane's limit. For instance, you may have a really big limit for tmux history but using the same limit may end up on having slow performance on Extrakto.
    @extrakto_filter_orderword all lineFilter modes order. The first listed mode will be the default when opening extrakto. You may use word, line, path, url, quote, s-quote or any of your own filters separated by a space. all applies all filters at the same time.

    Keys

    OptionDefaultDescription
    @extrakto_keytabThe key binding to start. If you have any special requirements (like a custom key table) set this to 'none'. See "Custom Tmux Keybindings".
    @extrakto_copy_keyenterKey to copy selection to clipboard.
    @extrakto_insert_keytabKey to insert selection.
    @extrakto_filter_keyctrl-fKey to toggle filter mode (see @extrakto_filter_order).
    @extrakto_grab_keyctrl-gKey to toggle grab mode.
    @extrakto_edit_keyctrl-eKey to run the editor.
    @extrakto_open_keyctrl-oKey to run the open command.
    @extrakto_clip_mode_keyctrl-tKey to cycle clipboard mode (see @extrakto_clip_mode_order).

    All but @extrakto_key are controlled by fzf and must follow its conventions.

    Advanced Options

    OptionDefaultDescription
    @extrakto_clip_modebgSet this to tmux_osc52 to enable remote clipboard support, fg/bg to have your clipboard tool run in a foreground/background shell, or buffer to only save to tmux buffer without copying to the clipboard.
    @extrakto_clip_mode_orderbg bufferOrder of clipboard modes to cycle through with @extrakto_clip_toggle_key. Omit modes you don't want in the cycle. Specify any mode of @extrakto_clip_mode.
    @extrakto_clip_toolautoSet this to whatever clipboard tool you would like extrakto to use to copy data into your clipboard. auto will try to choose the correct clipboard for your platform.
    @extrakto_editorThis defaults to $EDITOR if not set.
    @extrakto_fzf_layoutdefaultControl the fzf layout which is "bottom-up" by default. If you prefer "top-down" layout instead set this to reverse. In fact, this value is passed to the fzf --layout parameter. Possible values are: default, reverse and reverse-list
    @extrakto_fzf_toolfzfSet this to path of fzf if it can't be found in your PATH. If you prefer skim you need to set this option to sk or its full path.
    @extrakto_fzf_headeri c o e f g hDefine the fzf header to show keys for insert, copy, open, edit, filter, grab and help. Not shown by default: m=clip mode. You can add, reorder or omit information you don't need.
    @extrakto_fzf_unset_default_optstrueUnsets custom FZF_DEFAULT_OPTS as it can potentially cause problems in extrakto operations
    @extrakto_open_toolautoSet this to path of your own tool or auto to use your platforms open implementation.
    @extrakto_popup_positionCSet position of the tmux popup window. Possible values are in the display-popup entry in man tmux. Set this to x,y to set the x and y positions to x and y respectively.
    @extrakto_popup_size90%Set width and height of the tmux popup window. Set this to w,h to set the width to w and height to h.
    @extrakto_split_directionaWhether the tmux split will be auto, popup, vertical or horizontal
    @extrakto_split_size7The size of the tmux split (for vertical/horizontal)
    @extrakto_altallShow alternative filters. Possible values are: all to only show them for the all filter, any for any filter and none for never.
    @extrakto_prefix_nameallPrefix the results with the filter name. Possible values are: all to only show the prefix for the all filter, any for any filter and none for never.

    Legacy Options

    OptionReplaced by
    @extrakto_clip_tool_run@extrakto_clip_mode, since 2026-03

    Using skim instead of fzf

    If you prefer skim you need to set the @extrakto_fzf_tool option to sk or its full path. Skim should be compatible with fzf but let us know if you run into any issues.

    Examples

    set -g @extrakto_split_size "15"
    set -g @extrakto_clip_tool "xsel --input --clipboard" # works better for nvim
    set -g @extrakto_copy_key "tab"      # use tab to copy to clipboard
    set -g @extrakto_insert_key "enter"  # use enter to insert selection
    set -g @extrakto_fzf_unset_default_opts "false"  # keep our custom FZF_DEFAULT_OPTS
    set -g @extrakto_fzf_header "i c f g" # for small screens shorten the fzf header
    

    Custom Tmux Keybindings

    Instead of using @extrakto_key you can define your own key binding to start extrakto in your .tmux.conf:

    tmux bind-key YOUR-KEY run-shell "~/.tmux/plugins/extrakto/scripts/open.sh \"#{pane_id}\""
    

    If you wish you can also define different keys to start with a specific filter:

    tmux bind-key YOUR-KEY run-shell "~/.tmux/plugins/extrakto/scripts/open.sh \"#{pane_id}\" FILTER-NAME"
    

    Custom Filters

    You can define your own filters by creating a file in ~/.config/extrakto/extrakto.conf:

    [quote]
    regex: ("[^"\n\r]+")
    

    To override an existing filter copy it to your file first.

    If you want to remove one of the alternate filters you can set it to None:

    [quote]
    alt2: None
    

    See extrakto.conf for syntax and predefined filters.


    CLI tool

    You can also use extrakto as a standalone tool to extract tokens from text.

    Installation

    For now simply clone the repository and link to the tool somewhere in your path:

    git clone https://github.com/laktak/extrakto
    cd extrakto
    # assuming you `export PATH=$PATH:~/.local/bin` in your `.bashrc`:
    ln -s $PWD/extrakto.py ~/.local/bin/extrakto
    

    Requires Python 3.6+.

    Usage

    usage: extrakto.py [-h] [--name] [-w] [-l] [--all] [-a ADD] [-p] [-u] [--alt] [-r] [-m MIN_LENGTH] [--warn-empty]
    
    Extracts tokens from plaintext.
    
    optional arguments:
      -h, --help            show this help message and exit
      --name                prefix filter name in the output
      -w, --words           extract "word" tokens
      -l, --lines           extract lines
      --all                 extract using all filters defined in extrakto.conf
      -a ADD, --add ADD     add custom filter
      -p, --paths           short for -a=path
      -u, --urls            short for -a=url
      --alt                 return alternate variants for each match (e.g. https://example.com and example.com)
      -r, --reverse         reverse output
      -m MIN_LENGTH, --min-length MIN_LENGTH
                            minimum token length
      --warn-empty          warn if result is empty
    

    Contributions

    Thanks go to all contributors for their ideas and PRs!

    If you make a PR, please keep it small so that it's easier to test and review. Try to create one PR per feature/bug.

    Please run black if you change any python code and run shfmt -p if you change any shell files.