Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion to replace your greatest remap ever #124

Open
mangelozzi opened this issue Jul 3, 2024 · 0 comments
Open

Suggestion to replace your greatest remap ever #124

mangelozzi opened this issue Jul 3, 2024 · 0 comments

Comments

@mangelozzi
Copy link

mangelozzi commented Jul 3, 2024

Was looking at your maps and saw:

-- greatest remap ever
vim.keymap.set("x", "<leader>p", [["_dP]])

I think you would get a lot value out of:
https://github.com/vim-scripts/ReplaceWithRegister

Its the plugin I use the most, and think it should be built into VIM as a default text motion.

In your case you could do something like:

vim.keymap.set('n', '<leader>p', '<Plug>ReplaceWithRegisterOperator', {})
vim.keymap.set('n', '<leader>P', 'Plug>ReplaceWithRegisterLine', {})
vim.keymap.set('x', '<leader>p', '<Plug>ReplaceWithRegisterVisual', {})

From the help file:

-- REPLACE WITH REGISTER
-- https://github.com/vim-scripts/ReplaceWithRegister
-- https://www.youtube.com/watch?v=wlR5gYd6um0#t=26m49
-- [count]["x]gr{motion} = Replace {motion} text with the contents of register x.
--                         Especially when using the unnamed register, this is
--                         quicker than "_d{motion}P or "_c{motion}<C-R>"
-- [count]["x]grr        = Replace [count] lines with the contents of register x.
--                         To replace from the cursor position to the end of the
--                         line use ["x]gr$
-- {Visual}["x]gr        = Replace the selection with the contents of register x.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant