mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(extras): enhance incremane
bind C+u to clean renaming words
This commit is contained in:
parent
51854046db
commit
5dbb4c04ec
1 changed files with 15 additions and 0 deletions
|
|
@ -1,3 +1,18 @@
|
|||
-- enhances the 'IncRename' command cleaning
|
||||
-- retaining only 'IncRename ' if the command starts with it and has additional characters.
|
||||
local function enhance_rename_cleaner()
|
||||
local cmd_line = vim.fn.getcmdline()
|
||||
local prefix = "IncRename "
|
||||
local prefix_length = #prefix
|
||||
|
||||
if cmd_line:sub(1, prefix_length) == prefix and #cmd_line > prefix_length then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-u>" .. prefix, true, true, true), "n")
|
||||
else
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-u>", true, true, true), "n")
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set("c", "<C-u>", enhance_rename_cleaner, { noremap = true, silent = false })
|
||||
return {
|
||||
|
||||
-- Rename with cmdpreview
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue