Lightweight and quick file operations without being a full-blown file manager.
import
statements to the renamed
file (if the LSP supports workspace/willRenameFiles
).-- lazy.nvim
{
"chrisgrieser/nvim-genghis",
dependencies = "stevearc/dressing.nvim"
},
-- packer
use {
"chrisgrieser/nvim-genghis",
requires = "stevearc/dressing.nvim"
}
The setup
call is optional.
-- default config
require("genghis").setup {
backdrop = {
enabled = true,
blend = 50,
},
-- default is ` "trash" ` on Mac/Windows, and `{ "gio", "trash" }` on Linux
trashCmd = "trash",
}
You can access a command via the lua API:
require("genghis").createNewFile()
Or you can use the ex command :Genghis
with the respective sub-command:
:Genghis createNewFile
[!TIP] Previously, the plugins used ex commands such as
:New
or:Move
. To avoid conflicts, the ex commands are now only available as sub-commands of:Genghis
. If you prefer the old, shorter ex commands, you can use abbreviations to re-create them, for example:vim.cmd.cabbrev("New Genghis createNewFile")
.
.createNewFile
: Create a new file..duplicateFile
: Duplicate the current file..moveSelectionToNewFile
: Prompts for a new file name
and moves the current selection to that new file. (Note that this is a Visual
Line mode command, the selection is moved linewise.).renameFile
: Rename the current file..moveAndRenameFile
: Move and Rename the current file. Keeps the
old name if the new path ends with /
. Works like the Unix mv
command..moveToFolderInCwd
: Move the current file to an existing folder in the
current working directory.The following applies to all commands above:
/
, the new file is placed in the
respective subdirectory, creating any non-existing folders.import
statements to the renamed
file (if the LSP supports workspace/willRenameFiles
)..copyFilename
: Copy the file name..copyFilepath
: Copy the absolute file path..copyFilepathWithTilde
: Copy the absolute file path, replacing the home
directory with ~
..copyRelativePath
: Copy the relative file path..copyDirectoryPath
: Copy the absolute directory path..copyRelativeDirectoryPath
: Copy the relative directory path.All commands use the system clipboard.
.chmodx
: Makes current file executable. Equivalent to chmod +x
..trashFile
: Move the current file
to the trash location.gio trash
on Linux, trash
on Mac and Windows.require'bufdelete.nvim'.bufwipeout
would be used to keep window layout
intact instead of vim.cmd.bwipeout
.[!NOTE] The trash CLIs are usually not available by default, and must be installed.
A nod to vim.eunuch, an older vimscript plugin with a similar goal. As opposed to childless eunuchs, it is said that Genghis Khan has fathered thousands of children.
In my day job, I am a sociologist studying the social mechanisms underlying the digital economy. For my PhD project, I investigate the governance of the app economy and how software ecosystems manage the tension between innovation and compatibility. If you are interested in this subject, feel free to get in touch.
I also occasionally blog about vim: Nano Tips for Vim