lua rewrite of YankAssassin.vim
It is really annoying when you want to yank text and the cursor moves to the start of the yanked text. Especially when you are using text-objects. This plugin helps you fix it. Basically, while Yanking your cursor will not move to the start of the Yanked Text.
{
"svban/YankAssassin.nvim",
config = function()
require("YankAssassin").setup {
auto_normal = true, -- if true, autocmds are used. Whenever y is used in normal mode, the cursor doesn't move to start
auto_visual = true, -- if true, autocmds are used. Whenever y is used in visual mode, the cursor doesn't move to start
}
-- Optional Mappings
vim.keymap.set({ "x", "n" }, "gy", "<Plug>(YADefault)", { silent = true })
vim.keymap.set({ "x", "n" }, "<leader>y", "<Plug>(YANoMove)", { silent = true })
end,
}
- or install it, just like you would any other neovim-plugin.
- Mapping-less solution - not necessary to set any mappings.
- Text-objects, count, registers still work
- Provides extra mappings, which have default behavior, and no move behavior
- Works in both Normal & Visual Mode.
- If you are using Neovim, for Yank highlighting you can use
augroup highlight_yank
autocmd!
au TextYankPost * silent! lua vim.highlight.on_yank{ higroup="IncSearch", timeout=500 }
augroup END
- If you are using Vim, you can use svban/YankAssassin.vim