ideas icon indicating copy to clipboard operation
ideas copied to clipboard

move cursor to character for tmux (a la ace-jump/easymotion)

Open WillForan opened this issue 5 years ago • 9 comments

Project description

This project creates a tmux plugin that uses a character hinting mechanism to jump to a position in the buffer, like one would with acejump (video ) or easymotion easymotion

A kludge-y attempt might save the current buffer to a file with tmux. colorized text with matches, get the desired match from the user, and use the matching position to move the tmux cursor.

# partial implementation. no tmux movement. screen is spammed, not useful. Term::ReadKey must be fetched from CPAN.
lookfor="a"
tmux capture-pane -J \; save-buffer "test"
perl -MTerm::ReadKey -ne "
BEGIN{ \$replace='a';} 
\$h{\$replace++}=qq/\$. \$-[0]/ while s,$lookfor,$(tput setaf 1)\$replace$(tput sgr0),;
print qq/\$_\n/;
END{
 ReadMode 4; 
 \$b=ReadKey(-1) while(not defined \$b);
 ReadMode 0; 
  print \$h{\$b} 
}"  test

Relevant Technology

  • tmux, tpm
  • shell
  • ncursers (to display colorzed matches without changing the position of text)

Who is this for

An intermediate shell user or scripting language beginner will be able to complete a hacky version. A robust solution might require modification to tmux's source code (advanced).

Complexity and required time

Complexity

  • [ ] Beginner - This project requires no or little prior knowledge of the technolog(y|ies) specified to contribute to the project
  • [x] Intermediate - The user should have some prior knowledge of the technolog(y|ies) to the point where they know how to use it, but not necessarily all the nooks and crannies of the technology
  • [ ] Advanced - The project requires the user to have a good understanding of all components of the project to contribute

Required time (ETA)

  • [x] Little work - A couple of days
  • [ ] Medium work - A week or two
  • [ ] Much work - The project will take more than a couple of weeks and serious planning is required

WillForan avatar Aug 07 '18 23:08 WillForan

https://github.com/hchbaw/zce.zsh ?

afjoseph avatar Dec 23 '18 08:12 afjoseph

not 100% stable, but i'm using this for the last months https://github.com/schasse/tmux-easymotion

schasse avatar Aug 23 '19 12:08 schasse

https://github.com/Morantron/tmux-fingers https://github.com/fcsonline/tmux-thumbs

yutkat avatar Feb 04 '20 04:02 yutkat

Cool idea!

Could you please follow the format of the template next time?

EDIT: Ah never mind, thought this was a new project! :)

FredrikAugust avatar Feb 11 '20 20:02 FredrikAugust

Btw, I improved my plugin, renamed it and me and some friends are using it for quite a while. Check it out and tell me what you guys think. https://github.com/schasse/tmux-jump

schasse avatar Feb 11 '20 20:02 schasse

Just started using it yesterday. Good job, @schasse! I'll be sure to make a PR/issue if something looks weird

afjoseph avatar Feb 12 '20 07:02 afjoseph

Thanks. And sure, if you have a problem, just open an issue and I'll look into it!

schasse avatar Feb 12 '20 10:02 schasse

Another port of easy-motion for tmux: IngoMeyer441/tmux-easy-motion. In the meantime, several easy-motion / jump-mode implementations exist, but most of them only implement a seek or find motion. Therefore, I have started my own implementation which adds more Vim motions (b, B, w, W, e, E, ge, gE, j, J, k, K f, F, t, T, c (camelCase)). It also uses the same grouping algorithm as the Vim plugin to look and feel like the original.

Demo:

tmux-easy-motion demo

IngoMeyer441 avatar Jan 05 '21 11:01 IngoMeyer441