Home

Awesome

<!-- LTeX: enabled=false -->

nvim-genghis ⚔️

<!-- LTeX: enabled=true --> <a href="https://dotfyle.com/plugins/chrisgrieser/nvim-genghis"> <img alt="badge" src="https://dotfyle.com/plugins/chrisgrieser/nvim-genghis/shield"/></a>

Lightweight and quick file operations without being a full-blown file manager. For when you prefer a fuzzy finder over a file tree, but still want some convenient file operations inside nvim.

<img alt="Showcase for renaming files" width=50% src="https://github.com/user-attachments/assets/010f3786-e4b2-4c4e-8cbb-a7618de93eb7">

Table of contents

<!-- toc --> <!-- tocstop -->

Features

Installation

Requirements

-- lazy.nvim
{ 
	"chrisgrieser/nvim-genghis",
	cmd = "Genghis",
	opts = {}, -- empty table needed even for default config
},

-- packer
use { 
	"chrisgrieser/nvim-genghis", 
}

Configuration

The setup call is required for lazy.nvim, but otherwise optional.

-- default config
require("genghis").setup {
	-- default is `"trash"` on Mac/Windows, and `{ "gio", "trash" }` on Linux
	trashCmd = "trash",

	-- set to empty string to disable
	-- (some icons are only used for notification plugins like `snacks.nvim`)
	icons = {
		chmodx = "󰒃",
		copyPath = "󰅍",
		copyFile = "󱉥",
		duplicate = "",
		file = "󰈔",
		move = "󰪹",
		new = "󰝒",
		rename = "󰑕",
		trash = "󰩹",
	}
}

Usage

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

Available commands

File operations

The following applies to all commands above:

  1. If no extension has been provided, uses the extension of the original file.
  2. If the new file name includes a /, the new file is placed in the respective subdirectory, creating any non-existing intermediate folders.
  3. All movement and renaming commands update import statements to the renamed file (if the LSP supports workspace/willRenameFiles).

Copy operations

All commands use the system clipboard.

Why that name?

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.

About the author

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

<a href='https://ko-fi.com/Y8Y86SQ91' target='_blank'> <img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>