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

how to auto focus or auto show repl after REPLSendOporator? #23

Open
soluty opened this issue Feb 14, 2024 · 1 comment
Open

how to auto focus or auto show repl after REPLSendOporator? #23

soluty opened this issue Feb 14, 2024 · 1 comment

Comments

@soluty
Copy link

soluty commented Feb 14, 2024

thank you for great plugin, i read the doc and cant find an autocmd or callback function can auto focus or auto show repl after REPLSendOporator this, is there anything i miss?

@milanglacier
Copy link
Owner

milanglacier commented Mar 18, 2024

Yes, apparently operator function is async and a hook is needed to achieve what you want, which is not available yet. I will consider add the hook later.

However it is easy to do with REPLSendVisual as it is not async. Here is an example code for REPLSendVisual:

            local function run_2_cmds_with_count(cmd1, cmd2)
                return function()
                    local cnt = vim.v.count
                    vim.cmd(string.format('%d%s', cnt, cmd1))
                    vim.cmd(string.format('%d%s', cnt, cmd2))
                end
            end

            vim.api.nvim_buf_set_keymap(0, 'v', '<LocalLeader>1', '', {
                callback = run_2_cmds_with_count('REPLSendVisual', 'REPLFocus'),
            })

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

2 participants