refactor: rename files & clearer prompt labels
parent
884d98393d
commit
c75cda23a0
|
|
@ -2,7 +2,7 @@
|
|||
# nvim-genghis ⚔️
|
||||
<!-- LTeX: enabled=true -->
|
||||
<a href="https://dotfyle.com/plugins/chrisgrieser/nvim-genghis">
|
||||
<img src="https://dotfyle.com/plugins/chrisgrieser/nvim-genghis/shield"/></a>
|
||||
<img alt="badge" src="https://dotfyle.com/plugins/chrisgrieser/nvim-genghis/shield"/></a>
|
||||
|
||||
Lightweight file operations without a full-blown file management plugin.
|
||||
|
||||
|
|
@ -23,10 +23,10 @@ Lightweight file operations without a full-blown file management plugin.
|
|||
|
||||
## Features
|
||||
- Commands for moving, renaming, creating, deleting, or, duplicating files and
|
||||
more.
|
||||
more.
|
||||
- Commands for copying the path or name of the current file in various formats.
|
||||
- Renaming commands notify the LSP, meaning references to the renamed file like
|
||||
`import` statements are updated (if the LSP supports it).
|
||||
- Renaming commands update `import` statements to the renamed file (if the LSP
|
||||
supports it).
|
||||
- Lightweight plugin, no file management UI or file tree.
|
||||
- Various quality-of-life improvements like automatically keeping the extensions
|
||||
when no extension is given.
|
||||
|
|
|
|||
|
|
@ -112,10 +112,10 @@ local function fileOp(op)
|
|||
promptStr = "Duplicate File as: "
|
||||
prefill = oldNameNoExt .. "-1"
|
||||
elseif op == "rename" then
|
||||
promptStr = lspSupportsRenaming() and "Rename File & notify LSP:" or "Rename File to:"
|
||||
promptStr = lspSupportsRenaming() and "Rename File & Update Imports:" or "Rename File to:"
|
||||
prefill = oldNameNoExt
|
||||
elseif op == "move-rename" then
|
||||
promptStr = lspSupportsRenaming() and "Move-Rename File & notify LSP:" or "Move & Rename File to:"
|
||||
promptStr = lspSupportsRenaming() and "Move-Rename File & Update Imports:" or "Move & Rename File to:"
|
||||
prefill = dir .. "/"
|
||||
elseif op == "new" or op == "newFromSel" then
|
||||
promptStr = "Name for New File: "
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
if vim.g.genghis_disable_commands then
|
||||
vim.g.genghis_disable_commands = false
|
||||
end
|
||||
|
||||
if not vim.g.genghis_disable_commands then
|
||||
local command = vim.api.nvim_create_user_command
|
||||
local genghis = require("genghis")
|
||||
command("NewFromSelection", function() genghis.moveSelectionToNewFile() end, { range = true })
|
||||
command("Duplicate", function() genghis.duplicateFile() end, {})
|
||||
command("Rename", function() genghis.renameFile() end, {})
|
||||
command("Trash", function() genghis.trashFile() end, {})
|
||||
command("Move", function() genghis.moveAndRenameFile() end, {})
|
||||
command("CopyFilename", function() genghis.copyFilename() end, {})
|
||||
command("CopyFilepath", function() genghis.copyFilepath() end, {})
|
||||
command("CopyRelativePath", function() genghis.copyRelativePath() end, {})
|
||||
command("CopyDirectoryPath", function() genghis.copyDirectoryPath() end, {})
|
||||
command("CopyRelativeDirectoryPath", function() genghis.copyRelativeDirectoryPath() end, {})
|
||||
command("Chmodx", function() genghis.chmodx() end, {})
|
||||
command("New", function() genghis.createNewFile() end, {})
|
||||
end
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
-- deactivated by user
|
||||
if not vim.g.genghis_disable_commands then return end
|
||||
|
||||
local command = vim.api.nvim_create_user_command
|
||||
local genghis = require("genghis")
|
||||
command("NewFromSelection", function() genghis.moveSelectionToNewFile() end, { range = true })
|
||||
command("Duplicate", function() genghis.duplicateFile() end, {})
|
||||
command("Rename", function() genghis.renameFile() end, {})
|
||||
command("Trash", function() genghis.trashFile() end, {})
|
||||
command("Move", function() genghis.moveAndRenameFile() end, {})
|
||||
command("CopyFilename", function() genghis.copyFilename() end, {})
|
||||
command("CopyFilepath", function() genghis.copyFilepath() end, {})
|
||||
command("CopyRelativePath", function() genghis.copyRelativePath() end, {})
|
||||
command("CopyDirectoryPath", function() genghis.copyDirectoryPath() end, {})
|
||||
command("CopyRelativeDirectoryPath", function() genghis.copyRelativeDirectoryPath() end, {})
|
||||
command("Chmodx", function() genghis.chmodx() end, {})
|
||||
command("New", function() genghis.createNewFile() end, {})
|
||||
Loading…
Reference in New Issue