open-source-ideas / ideas

💡 Looking for inspiration for your next open source project? Or perhaps you've got a brilliant idea you can't wait to share with others? Open Source Ideas is a community built specifically for this! 👋
6.56k stars 221 forks source link

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

Open WillForan opened 6 years ago

WillForan commented 6 years ago

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

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

Required time (ETA)

afjoseph commented 5 years ago

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

schasse commented 5 years ago

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

ddzero2c commented 4 years ago

https://github.com/ddzero2c/tmux-easymotion

yutkat commented 4 years ago

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

FredrikAugust commented 4 years ago

Cool idea!

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

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

schasse commented 4 years ago

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

afjoseph commented 4 years ago

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

schasse commented 4 years ago

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

IngoMeyer441 commented 3 years ago

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