tmux-plugins / tmux-copycat

A plugin that enhances tmux search
MIT License
1.11k stars 63 forks source link

Abstract search plugin to use alternate backends (awk, ag) #68

Open dragon788 opened 9 years ago

dragon788 commented 9 years ago

Grep is great, but for codebases awk and/or Ag (aka Silver Surfer) can greatly speed up searching by ignoring things like the .git and .hg folders as well as other folders that rarely need searched.

jbnicolai commented 9 years ago

@dragon788 the regex searching is performed on the tmux panel buffer (your recent stdout), not on the underlying filesystem. What would the usecase for ag or awk be?

javier-lopez commented 9 years ago

Not sure about ag, it's incredible fast but doesn't allow a great customization in the output, using awk however could improve the portability (there are some hacks in the code to deal with grep in OS X), could improve the matching (currently it's not possible to match the same regex multiple times per line), could improve the performance, by defining the x,y matches coordinates in a single step instead of finding x with grep and then y with awk index (it could also skip the usage of a temporal scrollback file).

The downside is that there could be awk versions with limited regex support (gawk is not one of them), the default searches seems to be working ok, though.

Hints to accomplish an alternative awk implementation are available at:

https://github.com/chilicuil/tundle-plugins/blob/master/tmux-copycat/scripts/copycat_mode_start.sh#L26 https://github.com/chilicuil/tundle-plugins/blob/master/tmux-copycat/scripts/copycat_jump.sh#L106