Mouse context menu support for snacks.nvim file explorer.
Bring familiar GUI-style right-click menus to your terminal Neovim workflow.
- Right-click context menu with common file operations
- Copy, paste, rename, delete files and directories
- Create new files and directories from the menu
- Copy file paths to system clipboard
- Keyboard shortcut fallback via
<Plug>mappings - Automatic explorer refresh after operations
- Works with LazyVim and custom Neovim configurations
- Neovim >= 0.9.0
- snacks.nvim
- Terminal with mouse support (see Terminal Setup)
{
"AIntelligentTech/nvim-snacks-file-picker-mouse-support",
dependencies = { "folke/snacks.nvim" },
event = "VeryLazy",
opts = {},
}use {
"AIntelligentTech/nvim-snacks-file-picker-mouse-support",
requires = { "folke/snacks.nvim" },
config = function()
require("snacks-explorer-mouse").setup()
end
}{
dir = "~/path/to/nvim-snacks-file-picker-mouse-support",
dependencies = { "folke/snacks.nvim" },
event = "VeryLazy",
opts = {},
}The plugin works out of the box with sensible defaults. Configuration is optional.
require("snacks-explorer-mouse").setup({
-- Refresh explorer after file operations (default: true)
refresh_after_action = true,
-- Show notifications for operations (default: true)
notify_operations = true,
-- Register to use for copy/paste operations (default: "e")
copy_register = "e",
})- Open the snacks explorer (
<leader>ein LazyVim) - Navigate to a file or directory
- Right-click to open the context menu
- Select an action
| Action | File | Directory | Description |
|---|---|---|---|
| Copy | ✓ | ✓ | Copy to internal clipboard |
| Paste | ✓ | ✓ | Paste previously copied item |
| Rename | ✓ | ✓ | Rename with prompt |
| Delete | ✓ | ✓ | Delete with confirmation |
| New File | ✓ | Create new file in directory | |
| New Directory | ✓ | Create new subdirectory | |
| Copy Path | ✓ | ✓ | Copy full path to system clipboard |
Use the <Plug> mapping for keyboard access:
vim.keymap.set("n", "<leader>m", "<Plug>(SnacksExplorerMenu)")Or use the command:
:SnacksExplorerMenuFor right-click to work, your terminal must pass mouse events to Neovim.
Add to ~/.config/kitty/kitty.conf:
mouse_map right press ungrabbed no-op
Mouse events are passed through by default. No configuration needed.
Go to Preferences → Profiles → Terminal and check "Report mouse clicks".
| Command | Description |
|---|---|
:SnacksExplorerMenu |
Open context menu for item under cursor |
:SnacksExplorerDebug |
Print debug information |
local sem = require("snacks-explorer-mouse")
-- Show context menu
sem.show_context_menu()
-- File operations
sem.copy_file(path)
sem.paste_file(target_path)
sem.rename_file(path)
sem.delete_file(path)
sem.create_file(dir_path)
sem.create_directory(dir_path)
sem.copy_path(path)
-- Picker utilities
local picker, err = sem.get_picker()
local item, err = sem.get_current_item()
local path = sem.get_file_path(item)
-- Debug
sem.debug()- Check your terminal setup
- Ensure you're in the explorer window (filetype should be
snacks_picker_list) - Run
:SnacksExplorerDebugfor diagnostic information
- Make sure cursor is on a file/directory line
- Run
:SnacksExplorerDebugto check picker state
:SnacksExplorerDebug
" or
:lua require("snacks-explorer-mouse").debug()- snacks.nvim - The picker this plugin extends
- lazy.nvim - Plugin manager
- LazyVim - Neovim distribution
MIT License - see LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request