gbprod/yanky.nvim

Wrong position of special mark after paste

Closed this issue · 1 comments

bak-t commented

Hi.
When I select item from history & paste it using Telescope.nvim, pressing `[ moves cursor to first line in current buffer instead of start position of newly pasted text. Pressing `] works as expected.

OS: Windows 10
Neovim: 0.9.4

Here is my config for the plugin:

return {
	'gbprod/yanky.nvim',
	dependencies = {'nvim-telescope/telescope.nvim'},
	keys = {
		{
			'<leader>fy',
			function() require("telescope").extensions.yank_history.yank_history() end,
			desc = 'Kill ring with fuzzy search'
		},

		{'p', '<Plug>(YankyPutAfter)', mode={'n','x'}},
		{'P', '<Plug>(YankyPutBefore)', mode={'n','x'}},
		{'gp', '<Plug>(YankyGPutAfter)', mode={'n','x'}},
		{'gP', '<Plug>(YankyGPutBefore)', mode={'n','x'}},

		{'<c-n>', '<Plug>(YankyCycleForward)'},
		{'<c-p>', '<Plug>(YankyCycleBackward)'},
	},
	cmd = {'YankyClearHistory'},
	config = function()
		local mapping = require("yanky.telescope.mapping")
		local utils = require("yanky.utils")
		local action = {
			paste = mapping.put('p'),
			paste_behind = mapping.put('P'),
			set_default_register = mapping.set_register(utils.get_default_register()),
			delete = mapping.delete(),
		}

		require('yanky').setup({
			system_clipboard = {
				sync_with_ring = false,
			},
			picker = {
				telescope = {
					use_default_mappings = false,
					mappings = {
						default = action.paste,
						i = {
							['<S-CR>'] = action.paste_behind,
							['<M-r>'] = action.set_default_register,
							['<M-d>'] = action.delete,
						},
						n = {
							['<leader>p'] = action.paste,
							['<leader>P'] = action.paste_behind,
							['<S-CR>'] = action.paste_behind,
							['<leader>r'] = action.set_default_register,
							['<leader>d'] = action.delete,
						},
					},
				}
			},
		})
	end,
}
gbprod commented

Thanks, I think I've found a fix, I'll merge it soon