Git Product home page Git Product logo

Comments (18)

endrebak avatar endrebak commented on September 7, 2024 1

Often people have the pwd on their bash prompt like so (fish truncates all but the last paths to one letter):

endrebak@havpryd ~/c/c/workflows>

I'd like some way of avoiding those in the file search, but dunno if that is possible.

from tmux-copycat.

ctjhoa avatar ctjhoa commented on September 7, 2024

Get commit hash in git log
set -g @copycat_search_WHATEVER '^commit[[:space:]]*'

from tmux-copycat.

justmytwospence avatar justmytwospence commented on September 7, 2024

Amazon jobflow ID
set -g @copycat_search_C-j 'j-[[:alnum:]]*'

from tmux-copycat.

AnAppAMonth avatar AnAppAMonth commented on September 7, 2024

I have a stored search for quoted text:
set -g @copycat_search_C-q '\"[^\"]*\"'

Frequently filenames, error messages and other important info are quoted in a program's output.

However, I'm unable to match single quotes, even escaping doesn't work. Is this a bug or am I doing it wrong?

from tmux-copycat.

bruno- avatar bruno- commented on September 7, 2024

@AnAppAMonth, interesting idea. Thanks for the submission.

I think a single quote searches could have a bug! I also just tried it and got an error.
Please open an issue with the description of what you tried. A pull request for this is also very welcome.

from tmux-copycat.

jbnicolai avatar jbnicolai commented on September 7, 2024

@ctjhoa improved the regex to match SHA1 hashes in every output format. See #73

from tmux-copycat.

davidjb avatar davidjb commented on September 7, 2024

Pull request for email address search over at #78

from tmux-copycat.

konstantinstadler avatar konstantinstadler commented on September 7, 2024

Get the last entry of a line if it is standard filename.

set -g @copycat_search_C-l '[a-zA-Z0-9_-./]+$'

This works for filenames without any path (basename - as for example for ls -l) and for git status if you are not in the root of the repo.

from tmux-copycat.

alphaCTzo7G avatar alphaCTzo7G commented on September 7, 2024

Can we have these searches in a way similar to vim-text-objects? That would make it much easier to remember and increase the key-combination space available to reduce clashes.

from tmux-copycat.

diepfote avatar diepfote commented on September 7, 2024

Match kubernetes objects
e.g. "asdf-gk8nr" or "asdf-foo-7bdcf85cf5-97x64"
set -g @copycat_search_C-k '[A-Za-z0-9-]+-[a-f0-9]{10}-[a-z0-9]{5}|[A-Za-z0-9-]+-[a-z0-9]{5}'

from tmux-copycat.

diepfote avatar diepfote commented on September 7, 2024

Match 32 bit or 64 bit addresses
e.g. "0xffffd53a", "0xffffd53affffd53a", "ffffd53a" or "ffffd53affffd53a"
set -g @copycat_search_a '0x[A-Fa-f0-9]{8}|0x[A-Fa-f0-9]{16}|[A-Fa-f0-9]{8}|[A-Fa-f0-9]{16}' # 32 or 64 bit adresses

from tmux-copycat.

nilesh-akhade avatar nilesh-akhade commented on September 7, 2024

The example here

set -g @copycat_search_G '\b[0-9a-f]{5,40}\b'

should be

set -g @copycat_search_G '\b[0-9a-f]{5}|[0-9a-f]{40}\b'

from tmux-copycat.

nilesh-akhade avatar nilesh-akhade commented on September 7, 2024

The search goes from bottom to top. Is there any way to search only the last command output (preferably from top to bottom)?

from tmux-copycat.

diepfote avatar diepfote commented on September 7, 2024

based on a quick search no. you would need to re-write or duplicate and change https://github.com/tmux-plugins/tmux-copycat/blob/master/scripts/copycat_generate_results.sh#L20

--

I guess you could use this somehow https://github.com/tmux-plugins/tmux-copycat/blob/master/scripts/copycat_jump.sh#L231
Use get_number_of_results to set initial jump position.

from tmux-copycat.

iloveitaly avatar iloveitaly commented on September 7, 2024

The "last entry" file search didn't work for me. The order of the regex was causing an issue:

set -g @copycat_search_C-f '[a-zA-Z0-9_./-]+$'

For the future reader, here's the issue reporting the single quote breakage.

I was not able to get the quoting snippet to work:

set -g @copycat_search_C-q "\"[^\"]*\""

It always selected the quotes incorrectly for me (if anyone knows why, I'd love to hear it):

image

from tmux-copycat.

diepfote avatar diepfote commented on September 7, 2024

@iloveitaly looks like you are on a mac.
Maybe you are not using GNU grep?

$ grep --version
grep (GNU grep) 3.11
Packaged by Homebrew
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others; see
<https://git.savannah.gnu.org/cgit/grep.git/tree/AUTHORS>.

grep -P uses PCRE2 10.42 2022-12-11

from tmux-copycat.

iloveitaly avatar iloveitaly commented on September 7, 2024

@iloveitaly I am on a mac, but changing the default grep installation would be a large-ish change since many other applications rely on the terrible grep version installed by default.

from tmux-copycat.

diepfote avatar diepfote commented on September 7, 2024

@iloveitaly

if you are on an M1 chip just do
export PATH=/opt/homebrew/opt/grep/libexec/gnubin/grep:$PATH"

on an x86-64 bit machine do
export PATH=/usr/local/opt/grep/libexec/gnubin:$PATH"


you can check what to export at

$ brew info grep
==> grep: stable 3.11 (bottled), HEAD
GNU grep, egrep and fgrep
https://www.gnu.org/software/grep/
/opt/homebrew/Cellar/grep/3.11 (19 files, 1MB) *
  Poured from bottle using the formulae.brew.sh API on 2023-07-04 at 11:37:53
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/grep.rb
License: GPL-3.0-or-later
==> Dependencies
Build: pkg-config (installed)
Required: pcre2 (installed)
==> Options
--HEAD
        Install HEAD version
==> Caveats
All commands have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
  PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH"

from tmux-copycat.

Related Issues (20)

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.