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

Add visual paste #129

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

peterfication
Copy link

Closes #128

@peterfication
Copy link
Author

So the problem we're facing with a nicer visual range support is that it seems that Telescope does not support ranges. This means we can't allow a range mapping like it is done with :Telescope ... but we need to exit the visual mode before opening Telescope.

If Telescope allowed a visual range, the same mapping could be used and we would be able to work on this range without the need for gv.

Another solution would be to provide a separate command that we control the setup for because then we could add range = true. But this would make the ergonomics of Neoclip even worse.

@peterfication
Copy link
Author

I haven't checked out the fzf part.

@peterfication
Copy link
Author

peterfication commented Jul 11, 2024

https://github.com/gbprod/yanky.nvim is possible to work around this limitation by using Telescope just as a picker so it has it's own command set up with a range and then accesses Telescope after it exited visual mode, see gbprod/yanky.nvim#136 (if I understood it correctly).

@peterfication peterfication force-pushed the add-paste-visual branch 2 times, most recently from 0e5d03c to 18b96ac Compare July 11, 2024 06:03

```vim
<ESC>:Telescope neoclip<CR>
```
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation for fzf-lua needed

Copy link
Owner

@AckslD AckslD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterfication sorry for the very late reply! I think this looks nice and works from what I can see when testing. It would be ideal if telescope worked in visual mode but this seems fine to me and is not breaking anything for anyone not wanting it.

@@ -91,11 +91,24 @@ end

-- TODO can this be done without setting the register?
M.paste = function(entry, op)
if op == "v" then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] should this be done inside the function passed to temporary_reg_usage below in order to call this function at two places? Eg

    temporary_reg_usage(entry, function(register_name)
        if op == 'v' then
            vim.api.nvim_feedkeys('gv"'..register_name..'p', "n", false)
        else
            vim.cmd(string.format('normal! "%s%s', register_name, op))
        end
    end)

also is nvim_feedkeys required here or could it also use vim.cmd, I guess the visual part maybe breaks this?

@AckslD AckslD mentioned this pull request Oct 4, 2024
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

Successfully merging this pull request may close these issues.

Allow for visual selection override
2 participants