Skip to content

Instantly share code, notes, and snippets.

@tsmoreland
Last active May 12, 2022 10:04
Show Gist options
  • Save tsmoreland/061518b3f446653f0a3df5e523da03cc to your computer and use it in GitHub Desktop.
Save tsmoreland/061518b3f446653f0a3df5e523da03cc to your computer and use it in GitHub Desktop.
vim replace selected text without replacing register/buffer

VIM Replace without losing register

Intellij

add the following line to .ideavimrc

xnoremap p "_dP

visual studio code

add the following entry to settings.json

    "vim.visualModeKeyBindings": [
        {
            "before": [  
                "p",  
            ],  
            "after": [  
                "p",  
                "`",  
                "[",  
                "v",  
                "`",  
                "]",  
                "h",  
                "y",  
                "<Esc>"  
            ]  
        }  
    ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment