|
|
||
|---|---|---|
| lua | ||
| LICENSE | ||
| README.md | ||
| blubb.md | ||
README.md
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 nicer 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, or moving to the trash instead of removing files.
- Except for
trashFileandchmodxonly vim commands or lua os-modules are used to keep shell requirements to a minimum.
Installation and Setup
-- Recommended (Packer)
use {"chrisgrieser/nvim-ghengis", requires = "stevearc/dressing.nvim"}
-- if you do not care about nice input fields
use "chrisgrieser/nvim-ghengis"
nvim-ghengis (and dressign.nvim) require no .setup() function. Just 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", function () ghengis.trashFile{trashLocation = "your/path"} end) -- ; default '~/.Trash'. Requires macOS or Linux for `mv`.
keymap("x", "<leader>x", ghengis.moveSelectionToNewFile)
Available Commands
.copyFilepath: Copy the absolute file path. Whenclipboard='unnamed[plus], copies to the+register, otherwise to"..copyFilename: Copy file name. Whenclipboard='unnamed[plus], copies to the+register, otherwise to"..chmodx: Runchmod +xon the current file..renameFile: Rename the current file. If no extension is provided, will keep the current file extension..createNewFile: Create a new file. If no extension is provided, will keep use the extension of the current file..duplicateFile: Duplicate the current file. If no extension is provided, will keep the current file extension..trashFile: Move the current file to$HOME/.Trash. Can optionally be passed a table to change the trash location:.trashFile{trashLocation = "your/path/"}. (Requires macOS or Linux, since usingmv.).moveSelectionToNewFile: Visual Mode Command. Prompts for a new file name and moves the current selection to that new file.
Why that name?
A nod to vim.eunuch – as opposed to childless eunuchs, it is said that Ghengis Khan has fathered thousands of children.
This is my very first neovim plugin, so suggestions for code improvements are welcome. 🙏