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

other entry key than s/S #30

Closed
matu3ba opened this issue Jul 13, 2022 · 7 comments
Closed

other entry key than s/S #30

matu3ba opened this issue Jul 13, 2022 · 7 comments

Comments

@matu3ba
Copy link

matu3ba commented Jul 13, 2022

Will there be an option to remap (dynamically) the keys s/S ?
My main use case is https://github.com/kylechui/nvim-surround.

I checked https://github.com/ggandor/leap.nvim/blob/1d1032feefb53d407c59ea37d80374d77f6f9f3b/doc/leap.txt and did not find any functionality to rebind it/overwrite the default.

Since I dont need the plugin extremely frequent, I would like to use _/- instead or (eventually) hydra.nvim (https://github.com/anuvyklack/hydra.nvim).

@ggandor
Copy link
Owner

ggandor commented Jul 15, 2022

:help leap-custom-keymaps? vim.keymap.set('n', '-', '<Plug>(leap-forward)', {}), etc.

@matu3ba
Copy link
Author

matu3ba commented Jul 15, 2022

---- leap ----
vim.keymap.set('n', '-', '<Plug>(leap-forward)', {})
vim.keymap.set('n', '_', '<Plug>(leap-backward)', {})

works. thanks alot!

Btw, https://github.com/kylechui/nvim-surround has dot-repeat functionality which is code you might want to stealadapt.

@matu3ba matu3ba closed this as completed Jul 15, 2022
@avborup
Copy link

avborup commented Aug 30, 2022

Is there a way to achieve this that doesn't depend on Plug? Can I change this keymap using packer?

@ggandor
Copy link
Owner

ggandor commented Aug 31, 2022

@avborup <Plug> has nothing to do with vim-plug, it is a native Vim feature to alias right hand sides of mappings, see :help <Plug>. (Bottom line: you don't have to do anything.)

bhalash added a commit to bhalash/dotfiles that referenced this issue Apr 8, 2023
@esn89
Copy link

esn89 commented Jan 5, 2024

Hi all, I am having some issues with this. Currently, I am trying to re-map the visual/visual-block mode of this to use something different like - or _:

I have this in my plugin set up:

{
        'ggandor/leap.nvim',
        dependencies = {
            'tpope/vim-repeat',
        },
        config = function()
            require('leap').add_default_mappings()
        end,
        keys = {
            { 's', mode = 'n' },
            { 'S', mode = 'n' },
            { 'f', mode = 'n' },
            { 'F', mode = 'n' },
            { 't', mode = 'n' },
            { 'T', mode = 'n' },
            { 'f', mode = 'v' },
            { 'F', mode = 'v' },
            { 't', mode = 'v' },
            { 'T', mode = 'v' },
            { '-', mode = 'v' },
            { '_', mode = 'v' },
        },
    }

And in my init.lua:

vim.keymap.set({ 'v' }, '-', '<Plug>(leap-forward)', {})
vim.keymap.set({ 'v' }, '_', '<Plug>(leap-backward)', {})

However, once I do a visual-block mode, pressing hyphen does not give the intended behaviour of leaping forward.

@ggandor
Copy link
Owner

ggandor commented Jan 5, 2024

The problem might be keys: #191, https://github.com/ggandor/leap.nvim#lazy-loading

@esn89
Copy link

esn89 commented Jan 6, 2024

This seems to have fixed it. Thanks @ggandor

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

4 participants