https://github.com/TheLazyCat00/replace-nvim
Neovim plugin for replacing parts of code.
https://github.com/TheLazyCat00/replace-nvim
neovim-plugin
Last synced: 9 days ago
JSON representation
Neovim plugin for replacing parts of code.
- Host: GitHub
- URL: https://github.com/TheLazyCat00/replace-nvim
- Owner: TheLazyCat00
- License: gpl-3.0
- Created: 2025-04-24T13:00:50.000Z (14 days ago)
- Default Branch: main
- Last Pushed: 2025-04-24T13:13:59.000Z (14 days ago)
- Last Synced: 2025-04-24T14:25:29.673Z (14 days ago)
- Topics: neovim-plugin
- Language: Lua
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- trackawesomelist - TheLazyCat00/replace-nvim (⭐2) - Replace part of your code with the contents of the `+` register using textobjects. (Recently Updated / [Apr 28, 2025](/content/2025/04/28/README.md))
- awesome-neovim-sorted - TheLazyCat00/replace-nvim
README
# replace-nvim 📝
replace-nvim is a Neovim plugin that lets you replace parts of your code with the content from your clipboard using text objects. This means that if you bind `t` to it, you can do `tab` (`t` around block) and the content from the + register will be inserted into that section.
[Demo](https://github.com/user-attachments/assets/1bbfe47b-f7df-42cf-9850-e306a2f51c02)
## 🛠️ Configuration
replace-nvim has no options and is designed to be used via its functions.
> [!IMPORTANT]
> Make sure you set `expr` to `true` in the keymap.Here is an example config:
```lua
return {
"TheLazyCat00/replace-nvim",
opts = {},
keys = {
{
"t",
function() return require('replace-nvim').replace(true) end,
mode = { "n", "x" },
expr = true, -- ⚠️ set expr to true
desc = "Replace with clipboard",
},
},
}
```> [!NOTE]
> `replace()` is the only available function.## 🚧 Parameters
`replace()` has only parameter:
- `writeToReg`: Determines whether the removed text should be placed in the + register.
---
Feel free to open issues or pull requests!