2.8 KiB
2.8 KiB
nvim-ghengis
Convenience file operations for neovim written in lua.
How is this different from vim.eunuch?
- Written 100% in lua.
- Uses up-to-date nvim features like
vim.ui.inputorvim.notify. This means you can get nicer input fields via plugins like dressing.nvim, and nice confirmation notices with plugins like nvim-notify, if they are installed and setup. - Some minor improvements like automatically keeping the extensions when no extension is given.
- Except for
trashFileandchmodxonly vim commands or lua os-modules are used to keep shell requirements to a minimum.
Installation and Setup
-- Packer
use "chrisgrieser/nvim-ghengis"
Note
ghengisrequires no.setup()function. Simply create keybindings for the commands you want to use.
local ghengis = require("ghengis")
local keymap = vim.keymap.set
keymap("n", "<leader>yp", ghengis.copyFilepath)
keymap("n", "<leader>yn", ghengis.copyFilename)
keymap("n", "<leader>cx", ghengis.chmodx)
keymap("n", "<leader>rf", ghengis.renameFile)
keymap("n", "<leader>nf", ghengis.createNewFile)
keymap("n", "<leader>yf", ghengis.duplicateFile)
keymap("n", "<leader>df", ghengis.trashFile) -- requires macOS or Linux `mv` command
keymap("x", "<leader>x", ghengis.moveSelectionToNewFile)
Available Commands
ghengis.copyFilepath: Copy the absolute file path. Whenclipboard='unnamed[plus], copies to the+register, otherwise to".ghengis.copyFilename: Copy file name. Whenclipboard='unnamed[plus], copies to the+register, otherwise to".ghengis.chmodx: Runchmod +xon the current file.ghengis.renameFile: Rename the current file. If no extension is provided, will keep the current file extension.ghengis.createNewFile: Create a new file. If no extension is provided, will keep use the extension of the current file.ghengis.duplicateFile: Duplicate the current file. If no extension is provided, will keep the current file extension.ghengis.trashFile: Move the current file to$HOME/.Trash. (Requires macOS or Linux, since is usingmv.)ghengis.moveSelectionToNewFile: Visual Mode Command. Prompts for a new file name and moves the current selection to that new file.
Why that name?
A tribute to vim.eunuch – as opposed to childless eunuchs, it is said that Ghengis Khan has fathered thousands of children.