-
Notifications
You must be signed in to change notification settings - Fork 25
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
Modes behavior #37
Comments
Hi @darkangel-ua! Thanks for reporting this. When trying it out myself it seems when pasting from telescopes insert mode the cursor ends up one character before the end but when pasting from normal mode it ends up at the end (only for single-line yanks). Is this the same as you experience? When pasting starting from a visual selection I can indeed see that it is lost. I'm not really sure how one would fix this or even if the issue is with telescope or neoclip. |
When it comes to losing visual selection, I managed to find a workaround. I do it do it this way, when I assign it to my binding. require("neoclip").setup({
keys = {
telescope = {
i = {
custom = {
["<cr>"] = function(opts)
local handlers = require("neoclip.handlers")
if isVisualMode then
vim.api.nvim_feedkeys("gv", "xn", false) -- reselect previous selection
end
handlers.paste(opts.entry, "p")
isVisualMode = false
end,
},
},
},
},
})
Basically, I do this by reselecting the previous selection. |
Thanks for sharing @YosefBayoude, where is |
When calling the mapping. Here is the complete config: return {
"AckslD/nvim-neoclip.lua",
dependencies = {
{ "kkharji/sqlite.lua", module = "sqlite" }, -- required for persistent history
{ "nvim-telescope/telescope.nvim" },
},
config = function()
local isVisualMode = false
require("neoclip").setup({
enable_persistent_history = true,
keys = {
telescope = {
i = {
custom = {
["<cr>"] = function(opts)
local handlers = require("neoclip.handlers")
if isVisualMode then
vim.api.nvim_feedkeys("gv", "xn", false) -- reselect previous selection
end
handlers.paste(opts.entry, "p")
isVisualMode = false
end,
},
},
},
},
})
vim.keymap.set({ "v" }, "<leader>p", function()
isVisualMode = true
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<esc>", true, false, true), "xn", false)
vim.cmd("Telescope neoclip")
end, { desc = "Clipboard history" })
vim.keymap.set({ "n" }, "<leader>p", function() vim.cmd("Telescope neoclip") end, { desc = "Clipboard history" })
end,
} |
Hi!
First of all - thanks for such a great plugin!
I have some issues/misunderstandings:
Is this just me or it's designed like this?
The text was updated successfully, but these errors were encountered: