DreamMaoMao / searchjump.yazi

A Yazi plugin which the behavior consistent with flash.nvim in Neovim, allow search str to generate lable to jump.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

searchjump.yazi

A Yazi plugin which the behavior consistent with flash.nvim in Neovim, allow search str to generate lable to jump.support chinese pinyin search,regular expression search.

english search

2024-06-01.19-44-14.mp4

chiese pinyin search(first character of a word pinyin)

2024-06-17.11-12-26.mp4

regular expression search(set patterns in option search_patterns)

  • for example:
search_patterns = {"%.e%d+","s%d+e%d+","%d+.1080p","第%d+集"}
2024-06-17.14-32-05.mp4

Note

The latest main branch of Yazi is required at the moment.

Install

Linux

git clone https://github.com/DreamMaoMao/searchjump.yazi.git ~/.config/yazi/plugins/searchjump.yazi

Windows

With Powershell :

if (!(Test-Path $env:APPDATA\yazi\config\plugins\)) {mkdir $env:APPDATA\yazi\config\plugins\}
git clone https://github.com/DreamMaoMao/searchjump.yazi.git $env:APPDATA\yazi\config\plugins\searchjump.yazi

Usage

set shortcut key to toggle searchjump mode in ~/.config/yazi/keymap.toml. for example set i to toggle searchjump mode

[[manager.prepend_keymap]]
on   = [ "i" ]
run = "plugin searchjump"
desc = "searchjump mode"


[[manager.prepend_keymap]]
on   = [ "i" ]
run = "plugin searchjump --args='autocd'"
desc = "searchjump mode(auto cd select folder)"

opts setting (~/.config/yazi/init.lua)

require("searchjump"):setup {
	unmatch_fg = "#b2a496",
    match_str_fg = "#000000",
    match_str_bg = "#73AC3A",
    first_match_str_fg = "#000000",
    first_match_str_bg = "#73AC3A",
    lable_fg = "#EADFC8",
    lable_bg = "#BA603D",
    only_current = false, -- only search the current window
    show_search_in_statusbar = false,
    auto_exit_when_unmatch = true,
    enable_capital_lable = false,
    search_patterns = {}  -- demo:{"%.e%d+","s%d+e%d+"}
}

When you see some character singal lable in right of the entry. Press the key of the character will jump to the corresponding entry. if you want to search chiese,for example,search 你好,you can press n or nh to search.

It is worth noting

  • the <Space> key is a special key when you are in sj mode,it will toggle search regular expression that set in search_patterns.

  • the re match is case insensitive whether you use uppercase or lowercase in your regular expression

  • the <Enter> key will jump to the first match result or only result.

  • the <Backspace> key will backout the last key you input.

About

A Yazi plugin which the behavior consistent with flash.nvim in Neovim, allow search str to generate lable to jump.

License:MIT License


Languages

Language:Lua 100.0%