Skip to content

Don't let the cursor move while Yanking in Vim/Neovim

Notifications You must be signed in to change notification settings

svban/YankAssassin.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

What is YankAssassin.vim?

It is really annoying when you want to yank text and paste it close to your cursor and your 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

Features

  1. Both Mapping-less(better) & Mapping-plus Solution.
  2. While Yanking, text-objects, count, registers also work.
  3. Provides extra mappings, which have default behaviour.
  4. Works in both Normal & Visual Mode.

Installation

  • Vim plug - Plug 'svban/YankAssassin.vim'
  • or install it, just like you would any vim-plugin.

Options

  • g:yankassassin_use_mappings = 0 - Mapping-less solution(default), 1 - Mapping-plus solution

Usage

  • You need to set these bindings, these are examples.
  • Default Key Bindings - which moves the cursor to start of yanked text
    nmap <leader>y <Plug>YADefault
    xmap <leader>y <Plug>YADefault
    
  • Mapping-plus Solution
    nmap y <Plug>YAMotion
    xmap y <Plug>YAVisual
    nmap yy <Plug>YALine
    

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 Vim/Neovim

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published