Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zoxide edit to increment use ctrl-w , but my shutcurt ctrl-w is close window #949

Closed
huo-feng-ding opened this issue Dec 3, 2024 · 4 comments

Comments

@huo-feng-ding
Copy link

zoxide edit to increment , I want to change ctrl-w , because my ctrl-w is close window

@WieeRd
Copy link

WieeRd commented Dec 3, 2024

@huo-feng-ding Didn't quite understand what you are saying but my best guess is that you want to change keybinds of zoxide interactive mode (zi). The interactive mode is powered by fzf and you can change the options passed to fzf via _ZO_FZF_OPTS environment variable and set the keybinds in it.

https://github.com/ajeetdsouza/zoxide?tab=readme-ov-file#environment-variables

@huo-feng-ding
Copy link
Author

image

I want to modify the Ctrl-W shortcut because it conflicts with the terminal's shortcut, which is used to close the window.

@TanguyLH
Copy link

TanguyLH commented Dec 17, 2024

From what I understand, this would be like overwriting this part right ?

// src/cmd/edit.rs
impl Edit {
    fn get_fzf() -> Result<FzfChild> {
        Fzf::new()?
            .args([
                // Search mode
                "--exact",
                // Search result
                "--no-sort",
                // Interface
                "--bind=\
btab:up,\
ctrl-r:reload(zoxide edit reload),\
ctrl-d:reload(zoxide edit delete {2..}),\
ctrl-w:reload(zoxide edit increment {2..}),\
ctrl-s:reload(zoxide edit decrement {2..}),\
ctrl-z:ignore,\
double-click:ignore,\
enter:abort,\
start:reload(zoxide edit reload),\
tab:down",
                "--cycle",
                "--keep-right",
                // Layout
                "--border=sharp",
                "--border-label=  zoxide-edit  ",
                "--header=\
ctrl-r:reload   \tctrl-d:delete
ctrl-w:increment\tctrl-s:decrement

 SCORE\tPATH",
                "--info=inline",
                "--layout=reverse",
                "--padding=1,0,0,0",
                // Display
                "--color=label:bold",
                "--tabstop=1",
            ])
            .enable_preview()
            .spawn()
    }
}

And setting manually in your shell, before the config, your own binging the same way it's done here right ?

Setting the environment variable _ZO_FZF_OPTS doesn't seem to affect anything either. My guess would be that adding some binding like this (before the init in your shell config) :

$Env:_ZO_FZF_OPTS="--scheme=path --bind 'ctrl-n:reload(zoxide edit increment {2..})'"

would work from zi.

I have yet to test this specific command, but then it would also mean that the binding is made available if you ever do a zi.

@huo-feng-ding
Copy link
Author

thank you. zi is work for me .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants