Code Monkey home page Code Monkey logo

easyjump.tmux's Introduction

easyjump.tmux

EasyMotion for Tmux

Demonstration

๐Ÿ“น: https://asciinema.org/a/372086

This project is heavily inspired by tmux-jump.

There some differences between tmux-jump and easyjump.tmux:

  • easyjump.tmux can be integrated into Vim/Neovim! ๐Ÿ”ฅ See Integration with Vim for more details.
  • easyjump.tmux supports the smart case-insensitive search (turned on by default).
  • tmux-jump searches by 1 char and easyjump.tmux does by 2 chars.
  • tmux-jump only matches the prefixes of words, easyjump.tmux matches all substrings.
  • tmux-jump is implemented in Ruby and easyjump.tmux is done in Python 3 with type hints.

Requirements

  • Tmux >= 3.0
  • Python >= 3.8

Windows is not supported now.

Installation

  • TPM

    1. Add to ~/.tmux.conf:

      set-option -g @plugin "roy2220/easyjump.tmux"
    2. Press prefix + I to install the plugin.

  • Manual

    1. Fetch the source:

      git clone https://github.com/roy2220/easyjump.tmux.git /PATH/TO/DIR
    2. Add to ~/.tmux.conf:

      run-shell "/PATH/TO/DIR/easyjump.tmux"
    3. Reload Tmux configuration:

      tmux source ~/.tmux.conf

Usage

  • Press prefix + j to invoke EasyJump.
  • Press Ctrl + j to invoke EasyJump in copy mode.
  • Press Enter to cancel EasyJump.

Configuration

defaults:

set-option -g @easyjump-key-binding "j"
set-option -g @easyjump-smart-case "on"
set-option -g @easyjump-label-chars "fjdkslaghrueiwoqptyvncmxzb1234567890"
set-option -g @easyjump-label-attrs "\e[1m\e[38;5;172m"
set-option -g @easyjump-text-attrs "\e[0m\e[38;5;237m"
set-option -g @easyjump-auto-begin-selection "on"

Note: @easyjump-label-attrs/@easyjump-text-attrs is escape sequence for text coloring and formatting, see https://misc.flogisoft.com/bash/tip_colors_and_formatting for more information.

Integration with Vim

Vim 8 or Neovim is required.

Demonstration in Vim

๐Ÿ“น: https://asciinema.org/a/372879

Installation in Vim

  • vim-plug

    1. Add to ~/.vimrc:
    Plug 'roy2220/easyjump.tmux'
    1. Just :PlugInstall
  • Manual

    1. Fetch the source:

      git clone https://github.com/roy2220/easyjump.tmux.git /PATH/TO/DIR
    2. Add to ~/.vimrc:

      source /PATH/TO/DIR/plugin/easyjump.vim
    3. Reload Vim configuration:

      :source ~/.vimrc

Usage in Vim

  • Press Ctrl + j to invoke EasyJump in normal mode, insert mode, visual mode or operator-pending mode.
  • Press Enter to cancel EasyJump.

Configuration in Vim

defaults:

let g:easyjump_smart_case = v:true
let g:easyjump_label_chars = 'fjdkslaghrueiwoqptyvncmxzb1234567890'
let g:easyjump_label_attrs = "\e[1m\e[38;5;172m"
let g:easyjump_text_attrs = "\e[0m\e[38;5;237m"

nmap <C-J> <Plug>EasyJump
imap <C-J> <Plug>EasyJump
vmap <C-J> <Plug>EasyJump
omap <C-J> <Plug>EasyJump

Note: g:easyjump_label_attrs/g:easyjump_text_attrs is escape sequence for text coloring and formatting, see https://misc.flogisoft.com/bash/tip_colors_and_formatting for more information.

easyjump.tmux's People

Contributors

laggardkernel avatar mihaigalos avatar roy2220 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

easyjump.tmux's Issues

[Bug report] Other texts invisible when selecting matches

Hello! Thank you for creating such an awesome tmux plugin. I really like "searching by 2 chars" feature. However, I'm having the following issue:

simplescreenrecorder-2022-05-03_13.23.59.mp4

screenshot-2022-05-03-16-26-49

After inputting two characters, I can't see anything except the highlighted first char of potential matches. All other texts are darkened.

Is it the problem with my terminal? Here's what I tried but none worked:

  1. I'm using kitty but the same iusse persisted with alacritty

  2. tried different colorschemes in kitty

My config:

set-option -g @plugin "roy2220/easyjump.tmux"
set-option -g @easyjump-key-binding "f"
set-option -g @easyjump-smart-case "off"
set-option -g @easyjump-auto-begin-selection "on"

Is it possible that you add an option to "disable darkened other texts when selecting potential matches"? The first char being orange is apparent enough (at least for me).

Any help is much appreciated. Thank you!

copy mode vs easyjump

Hello!
Great plugin, thank you for your work.

It would be very useful, if this plugin could allow to jump when tmux is in copy mode.

Example:

Some command has produced several screens of output, I activate copy mode, scroll one screen up, see information I want to copy, activate easyjump and with a few strokes I'm in the right position.

Current behavior:

Copy mode exists after I activate easyjump and thus resets my current cursor position and there is no way to jump
where I want.

Option to restrict to insert mode

I've remapped my leader key to Space for easy access.
Now I have the problem that the plugin activates when I also type in insert mode - every time I press space.

Can you please add an option to disable it in insert mode?

Jumping across vim splits is throwing error

Thank you this great plugin! I noticed that the plugin does not work properly when having more than 2 splits in (n)vim.

Assume we have the following split layout:
1 | 2 | 3

I can jump from 1 to 2, and from 2 to 3. However, trying to jump from 1 to 3 is throwing an error. This always seem to happen when there is at least one additional split between origin and destination.

Error detected while processing function <SNR>104_invoke:
line   26:
Traceback (most recent call last):^@  File "/home/int/.vim/plugged/easyjump.tmux/plugin/../easyjump.py", line 553, in <module>^@    main()^@  File "/home/int/.vim/plugged/easyjump.tmux/plugin/../easyjump.py", line 549, in main^@    screen.jump_to_position(position)^@  File "/home/int/.vim/plugged/easyjump.tmux/plugin/../easyjump.py", line 210, in jump_to_position^@    self._mouse_jump_to_position(position)^@  Fil
e "/home/int/.vim/plugged/easyjump.tmux/plugin/../easyjump.py", line 256, in _mouse_jump_to_position^@    x = bytes((0x20 + position.column_number,))^@ValueError: bytes must be in range(0, 256)^@

[Feature Request] Improve length of label characters

easyjump.tmux begins with 1 char label. If 1 char is not enough to differentiate the occurrences, it switches to using 2 character.

The problem is the length of labels ( 1 or 2 characters) is set globally. We could improve it to use both 1 char labels and 2 char labels at the same time when there's too many occurrences.

Vim complains 'No range allowed'

Jumping to a screen position with column number 127 and any line number in Vim will raise error E481: No range allowed, seems the XTerm Control Sequence to simulate mouse clicks, which is sent to Vim by command tmux send-keys, is modified by Tmux before sending it to Vim. May be caused by the UTF-8 encoding/decoding process in Tmux.

[Bug Report] easyjump breaks rectangular selection

Related settings to emulate rectangular selection in vim,

set-option -g mode-keys vi
bind-key -T copy-mode-vi C-v send-keys -X begin-selection \; send-keys -X rectangle-toggle;
bind-key -T copy-mode-vi v   send-keys -X begin-selection;
bind-key -T copy-mode-vi V   send-keys -X select-line;

run-shell /path/to/tmux/plugins/easyjump.tmux/easyjump.tmux

Steps to reproduce

  1. C-b [ enters copy mode, C-v triggers rectangular selection.
  2. Then trigger easyjump. Enter 2 chars to do jumping.

When jumping is done, rectangular is reset to normal selection.

Not running in a tmux inside a docker container

I'm having trouble using easyjump in a tmux session in a docker container using the below settings.
The settings run just fine on a host, directly. What am I doing wrong?

# .tmux.conf
set -g @plugin 'roy2220/easyjump.tmux'
unbind C-s
set-option -g @easyjump-key-binding "s"

Goto next with ; feature

I love your plugin and use it a lot!
In the vim plugin in normal mode, what I'm missing from it is a form of jumping to the next match using ; and to the previous match using , - essentially the same way as vim-sneak motion.

If you can implement this missing feature, it's essentially a vim-sneak on steroids!

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.