tmux-plugins / tmux-copycat Goto Github PK
View Code? Open in Web Editor NEWA plugin that enhances tmux search
License: MIT License
A plugin that enhances tmux search
License: MIT License
Things to use:
I'm not a clever man… but I'd really like to use this to grab the sha1 of commits in git… I have been trying the regex I found on stack overflow, but I think it may be in a different syntax than what copycat uses.
\b[0-9a-f]{5,40}\b
Do you have any tips?
Improve the way copycat handles stored regex searches
I think it would be consistent and convenient if you could make n
and N
to cycle through searches rather than get stuck on top or bottom.
This path is not matched:
./something.txt
Example:
git status # no results
But when prefix + C-g
is pressed, copycat mode is entered. We should handle this case by displaying the "No results!" message.
When searching using copycat either by saved searches or "normal" search (prefix + /) there isn't any highlighting. The cursor is placed on the end of the line of the match, but the match isn't highlighted. Therefore you have to select manually before it to work....
I've tried this on an almost empty .tmux.conf and tried to set my PROMPT in zsh to 'XX ' to avoid problems with that. None of this has worked.
The .tmux.conf I have tried with is:
bind-key R source-file ~/.tmux.conf ; display-message "source-file do"
set -g @tpm_plugins "
tmux-plugins/tpm
tmux-plugins/tmux-yank
tmux-plugins/tmux-copycat
"
run-shell ~/.tmux/plugins/tpm/tpm
I'm running tmux 1.9a on Ubuntu 12.04 with zsh 4.3.17.
Suppose a range of characters is selected when in emacs copy mode.
these are the highlighted chars
When the highlighted characters are copied, the last character is cut off.
A user would get this if the above characters were copy, then pasted:
these are the highlighted char
I tried copying these new stored search examples from the README to my tmux.conf:
# 'prefix + ctrl-t' searches for "search me" string
set -g @copycat_search_C-t "search me"
# 'prefix + alt-t' searches for defined regex
set -g @copycat_search_M-t "regex search[[:alnum:]]\*"
I tried putting these before / after the run-shell ~/.../copycat.tmux
line, but in either case pressing the key combinations didn't do anything.
Predefined stored searches such as prefix + C-d work without problems.
I worked around this by editing copycat.tmux locally.
hey , I really like the idea of this plugin but it does not work for me with zsh
I get this error
zsh: command not found: G0:3
For this line:
=> #<Transaction:0x007f7f9682f240>
Number results with prefix - C-d
aren't displayed properly.
If a user has sophisticated zsh shell prompt with unicode characters, match selection could be buggy.
Example: zsh shell prompt contains unicode chars and current directory path. File search (prefix + C-f) highlights the directory path invalidly.
Presumably, this is because of unicode characters.
This is due to use of 0
(vim copy mode) to go to the beginning of the line, prior to selecting the match.
In some cases 0 makes the cursor go to the beginning of the previous line which causes an error.
As far as I can see it's not possible to provide tmux-copycat with options to modify the key-bindings of the default stored searches (C-u, C-f, C-d, M-i). Would it be somehow possible to add specific options for those searches?
Thanks in advance
Hi Bruno,
Love the idea of this plugin, and am trying to get it to work. However, when I hit ^A^D (or any other trigger) in tmux, I get a quick flash of copy mode and then junk output at my cursor, in the form of /\d{1,3}lh/.
I'm using tmux 1.9a on OS X. My day-to-day shell is zsh 5.0.5 from homebrew; I've also installed bash 4.3 from homebrew to ensure it's available for copycat. I've commented out most of my tmux.conf, leaving me with just the following:
unbind C-b
set-option -g prefix C-a
bind-key a send-prefix
# Swap between current and previous windows with C-a C-a, like screen.
unbind l
bind-key C-a last-window
run-shell ~/.tmux/plugins/tmux-copycat/copycat.tmux
Any pointers would be greatly appreciated!
Currently, the test suite runs in vi copy mode (because vi mode is faster).
However, making all the test run also in emacs mode would probably be low effort.
As described in the defining new stored searches doc, this plugin enables you to define your own, custom searches.
Let's tap into the community ideas and see what others came up with or are missing.
Use this thread to:
Interesting searches will be added to Useful searches section.
Awk treats escaped characters \n
, \r
as a single character. Tmux, on the other hand treats those as 2 chars.
Example line:
_file\"; filename=\"test.csv\"\r\nContent-Type: text/csv\r\n", @tempfile=#<File:/var/folders/jw
match:
text/csv\r\n
Came across this when reading some non-wrapped mail in mutt which contained several URLs.
Love your plugins btw. Thanks for each and every one.
This problem happens because of vertical result centering.
If no vertical centering can be done (padding 0), then cursor makes a move and messes the result.
I saw the video for tmux-copycat and was extremely excited to use it, but my custom keybindings conflict with the defaults enough that tmux-copycat is unusable and returns nonsense results.
I took a look at the source and I saw several key combinations for commands are hardcoded in.
Is it possible to completely abstract these tmux-send-keys calls with the actual tmux command you're trying to run, so arbitrary configuration changes won't break the script? This would certainly help with adoption.
For reference, my tmux.conf is below:
# change prefix to Ctrl-a (like in gnu screen)
unbind C-b
set-option -g prefix C-s
bind-key C-a send-prefix
# allow terminal scrolling
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
# copy mode - turning off for a little bit
# unbind [
# bind Escape copy-mode
unbind Escape
bind [ copy-mode
# use vi mode
set-window-option -g mode-keys vi
set-option -g status-keys vi
set-window-option -g utf8 on
# splitting
unbind %
bind | split-window -h
unbind '"'
bind - split-window -v
# colon :
bind : command-prompt
# status line
set-option -g status-utf8 on
set-option -g status-justify left
set-option -g status-bg default
set-option -g status-fg green
set-window-option -g window-status-current-fg colour135
set-window-option -g window-status-current-attr underscore
set-option -g status-right '#H #[fg=colour]%I:%M #[fg=colour14]%d.%m.%Y'
# let's keep it quiet, ok?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-content off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-window-option -g monitor-content ''
set-option -g bell-action none
# some key-binding changes
bind x kill-pane
bind X next-layout
bind Z previous-layout
unbind Left
bind h select-pane -L
unbind Down
bind j select-pane -D
unbind Up
bind k select-pane -U
unbind Right
bind l select-pane -R
unbind C-Left
bind C-h resize-pane -L
unbind C-Down
bind C-j resize-pane -D
unbind C-Up
bind C-k resize-pane -U
unbind C-Right
bind C-l resize-pane -R
unbind M-Left
bind C-H resize-pane -L 30
unbind M-Down
bind C-J resize-pane -D 30
unbind M-Up
bind C-K resize-pane -U 30
unbind M-Right
bind C-L resize-pane -R 30
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# don't rename window
set-window-option -g automatic-rename off
# TPM
# List of plugins
# Supports `github_username/repo` or full git URLs
set -g @tpm_plugins " \
tmux-plugins/tpm \
tmux-plugins/tmux-copycat \
"
# Other examples:
# github_username/plugin_name \
# [email protected]/user/plugin \
# [email protected]/user/plugin \
# initializes TMUX plugin manager
run-shell ~/.tmux/plugins/tpm/tpm
File search prefix + C-f
is not ideal and it can't match file names that don't contain forward slash /
.
That means when a user uses ls
, most files won't be matched.
Consider adding a stored search that will focus on matching ls
output well.
Example use case:
ls -al
prefix + C-l
(think more about the specific key, maybe it won't be C-l)n
and N
and move over file-names in the above ls
outputIn my tmux.conf I have the following to move around panes. Somewhere in this plugin this binding is being reset to default "accept-line". Ctrl+J works until I do something like Ctrl+a, Ctrl+f
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|/)g?(view|vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
I did a search on this repo for ctrl_j but didn't find anything. Hopefully you can point me in the right direction.
Thanks for making an awesome plugin!
In this line:
n/ignore-request [4] https://www.relishapp.com/vcr/vcr/v/2-8-0/docs/record-modes/once [5] https://www.relish
there are 2 url results (both starting with https://www...
).
While the first match is highlighted properly, second match highlights only this: //www.relish
. The starting https
is missing from the highlight.
I have found that copycat cannot match path starting with ../
for instance git status
...
Untracked files:
(use "git add <file>..." to include in what will be committed)
../../docs/chapter_one/introduction.rst
I tried to fix it at line 25 of copycat.tmux
but couldn't find a good regex for that.
When I activate the copycat command with Ctrl+A, /
, subsequently the tmux bind made by me using bind -n C-J
stops working. It appears that the plugin sets the bind to
bind-key -n C-j run-shell "tmux send-keys 'C-j'; /root/.tmux/plugins/tmux-copycat/scripts/copycat_mode_quit.sh; true"
I wonder if there is a way for copycat to store the existing binding before overwriting it so that it can restore the original bind when done with copycat mode?
Wrong match highlighting happening for this match.
https://localhost:%d
Since we're using printf
to generate matches, this is the match we would actually search in a line:
https://localhost:0
Notice %d
got changed to 0
.
Can't access matches on the last 'screen' of scrollback buffer. This is the limitation on Tmux side.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.