mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
nvim: delete unused lua files
This commit is contained in:
parent
8a266783a2
commit
51e6343b9e
18 changed files with 42 additions and 781 deletions
|
|
@ -34,3 +34,27 @@ vim.api.nvim_create_user_command("Reload", function()
|
|||
end, {
|
||||
desc = "Reload Neovim configuration",
|
||||
})
|
||||
|
||||
local renameCurrentBuffer = function()
|
||||
local old_name = vim.fn.expand("%:p")
|
||||
local new_name = vim.fn.input("New name: ", vim.fn.expand("%:p:h") .. "/")
|
||||
|
||||
if new_name == "" then
|
||||
print("No new name provided")
|
||||
return
|
||||
elseif new_name == old_name then
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd("write")
|
||||
|
||||
local success, err = os.rename(old_name, new_name)
|
||||
if not success then
|
||||
print("Error renaming file: " .. err)
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd("edit " .. new_name)
|
||||
vim.cmd("bdelete " .. old_name)
|
||||
end
|
||||
vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue