Coder Social home page Coder Social logo

tmux-copycat's Introduction

Tmux copycat

Build Status

This plugin enables:

  • regex searches
  • search result highlighting
  • predefined searches

Predefined searches are plugin killer feature. It speeds the workflow and reduces mouse usage with Tmux.

It works even better when paired with tmux yank.

Note: new version 2.0 uses extended regexes! Regex character escaping with backslashes \ isn't required anymore.

Screencast

screencast screenshot

Search

  • prefix + / - regex search (strings work too)

Example search entries:

  • foo - searches for string foo
  • [0-9]+ - regex search for numbers

Grep is used for searching.
Searches are case insensitive.

Predefined searches

  • prefix + ctrl-f - simple file search
  • prefix + ctrl-g - jumping over git status files (best used after git status command)
  • prefix + ctrl-u - url search (http, ftp and git urls)
  • prefix + ctrl-d - number search (mnemonic d, as digit)
  • prefix + alt-i - ip address search

These start "copycat mode" and jump to first match.

"Copycat mode" bindings

These are enabled when you search with copycat:

  • n - jumps to the next match
  • N - jumps to the previous match

To copy a highlighted match:

  • Enter - if you're using Tmux vi mode
  • ctrl-w or alt-w - if you're using Tmux emacs mode

Copying a highlighted match will take you "out" of copycat mode. Paste with prefix + ] (this is Tmux default paste).

Copying highlighted matches can be enhanced with tmux yank.

Customization

Most of the behavior of tmux-copycat can be customized via tmux options.
Check the full options list on the wiki page.

Defining new stored searches

To speed up the workflow you can define new bindings in .tmux.conf for searches you use often.

How to + useful searches in this wiki page.

Limitations

  • This plugin tries hard to consistently enable "marketed" features. It uses some hacks to go beyond the APIs Tmux provides. Because of this, it might have some "rough edges" and there's nothing that can be done.

    Examples: non-perfect file and url matching and selection. That said, usage should be fine in +90% cases.

  • feel free to report search cases you think should work, but are not (provide examples pls!). I'm open to the idea of adding more saved searches.

  • Tmux vi copy mode works faster than emacs. If you don't have a preference yet and to speed up tmux_copycat, I recommend putting this in .tmux.conf to set Tmux copy mode to vi:

    set -g mode-keys vi
    
  • remapping Escape key in copy mode will break the plugin. If you have this in your .tmux.conf, please consider removing it:

    bind -t vi-copy Escape cancel
    

Installation with Tmux Plugin Manager (recommended)

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

set -g @tpm_plugins '          \
  tmux-plugins/tpm             \
  tmux-plugins/tmux-copycat    \
'

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

Optional (but recommended) install gawk via your package manager of choice for better UTF-8 character support.

Manual Installation

Clone the repo:

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

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

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

Reload TMUX environment:

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

You should now be able to use the plugin.

Optional (but recommended) install gawk via your package manager of choice for better UTF-8 character support.

Other goodies

tmux-copycat works great with:

  • tmux-yank - enables copying highlighted text to system clipboard
  • tmux-open - a plugin for quickly opening a 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.

Test suite

This plugin has a pretty extensive integration test suite that runs on travis.

When run locally, it depends on vagrant. Run it with:

# within project top directory
$ ./run-tests

By default tests run in 2 vagrant VMs: ubuntu and centos.

Contributions and new features

Bug fixes and contributions are welcome.

Feel free to suggest new features, via github issues.

If you have a bigger idea you'd like to work on, please get in touch, also via github issues.

License

MIT

tmux-copycat's People

Contributors

toupeira avatar soli avatar metcalfc avatar grota avatar vellvisher avatar

Watchers

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.