ThePrimeagen / ThePrimeagen/init.lua

Suggestion to replace your greatest remap ever

Open
#124 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
4k
Forks
680
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing "greatest remap ever" keymap in init.lua and compare it with the ReplaceWithRegister plugin and mappings shown in the issue. Done means the relevant normal, line, and visual keymaps use the proposed replace-with-register behavior, with the configuration still loading correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.