Skip to content

svban/YankAssassin.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

lua rewrite of YankAssassin.vim

What is YankAssassin.nvim?

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.

Demo

1 2 3

Installation

with Lazy.nvim

{
    "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.

Features

  1. Mapping-less solution - not necessary to set any mappings.
  2. Text-objects, count, registers still work
  3. Provides extra mappings, which have default behavior, and no move behavior
  4. Works in both Normal & Visual Mode.

Others

  • 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

About

Don't let the cursor move while Yanking in Neovim

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages