ggandor / leap.nvim

Neovim's answer to the mouse 🦘
MIT License
4.38k stars 46 forks source link

Leap brakes macro execution #180

Closed Drllap closed 11 months ago

Drllap commented 1 year ago

I have this code snippet:

        std::shared_ptr<const pos_data_interface::I_position> get_iposition()  const override { return nullptr; }
        std::shared_ptr<const pos_data_interface::I_velocity>> get_ivelocity()  const override { return nullptr; }
        std::shared_ptr<const pos_data_interface::I_attitude> get_iattitude()  const override { return shared_from_this(); }
        std::shared_ptr<const pos_data_interface::I_heave>    get_iheave()     const override { return nullptr; }
        std::shared_ptr<const pos_data_interface::I_pan_tilt> get_ipan_tilt()  const override { return nullptr; }

I recorded a macro to change the std::shared_ptr< to std::optional<std::referece_wrapper:

let @q="ct<std::optional<std::reference_wrapperjkf>a>jk"

But when I go to the first line of my example and do @q I get this:

        <const pos_data_interface::I_position> get_iposition()  const override { return nullptr; }
        st::optional<std::reference_wrapperd::shared_ptr<const pos_data_interface::I_velocity>>> get_ivelocity()  const override { return nullptr; }
        std::shared_ptr<const pos_data_interface::I_attitude> get_iattitude()  const override { return shared_from_this(); }
        std::shared_ptr<const pos_data_interface::I_heave>    get_iheave()     const override { return nullptr; }
        std::shared_ptr<const pos_data_interface::I_pan_tilt> get_ipan_tilt()  const override { return nullptr; }
Drllap commented 1 year ago

Here is an example of how to reproduce this:

lua/my/leap.lua:

local leap = require('leap')
leap.add_default_mappings()

leap.opts.case_sensitive = true

config.vim:

let @q="ct<std::optional<std::reference_wrapperjkf>a>jk"
inoremap <silent> jk <esc>
cnoremap <silent> jk <C-c>
tnoremap <silent> jk <C-\><C-N>
set nowrap

call plug#begin(stdpath('data') . '/plugged')
Plug 'ggandor/leap.nvim' " Use s to make jumps to some char in view port
call plug#end()

lua require('lua.my.leap')

text.txt:

        std::shared_ptr<const pos_data_interface::I_position> get_iposition()  const override { return nullptr; }
        std::shared_ptr<const pos_data_interface::I_velocity>> get_ivelocity()  const override { return nullptr; }
        std::shared_ptr<const pos_data_interface::I_attitude> get_iattitude()  const override { return shared_from_this(); }
        std::shared_ptr<const pos_data_interface::I_heave>    get_iheave()     const override { return nullptr; }
        std::shared_ptr<const pos_data_interface::I_pan_tilt> get_ipan_tilt()  const override { return nullptr; }

If you remove the lua require('lua.my.leap') this example works as expected

ggandor commented 11 months ago

I cannot reproduce, no idea what happens in your case. Feel free to reopen if the problem is not solved yet.

Drllap commented 10 months ago

@ggandor I tested it again and it looks like it is fixed. Thanks