A lightweight Neovim plugin that lets you interactively navigate upward through your current working directory. It displays the directory path in the command line, highlights the selected level, and allows quick movement and confirmation using simple key mappings (e.g., [motion]h/l to move, Enter to confirm, q or Esc to cancel).
Inspired by ic.sh
| Demo |
|---|
![]() |
- lazy.nvim
{
"shaobosong/cdup.nvim",
lazy = true,
cmd = { "Cdup" },
keys = {
{ "<leader>cu", "<cmd>Cdup<cr>", mode = "" },
},
config = function ()
-- Default configuration
local default_config = {
-- Resolve a valid directory path
resolve_dir = function ()
local path = vim.fn.expand("%:p:h")
path = vim.fn.isdirectory(path) == 1 and path or vim.fn.getcwd()
return path
end,
-- Highlight group for the selected directory name.
-- Good options: 'TermCursor', 'Visual', 'IncSearch', 'Search'
highlight_group = 'TermCursor',
-- Keymaps for navigation. You can customize these.
keymap = {
-- VIM-style keys (default)
left = { 'h', 'b', "<Left>" },
right = { 'l', 'w', "<Right>" },
head = { 'H', '0', "<Home>" },
tail = { 'L', '$', "<End>" },
middle = { 'M' },
confirm = { "<CR>" },
cancel = { 'q', "<ESC>" },
},
show_help = true,
}
-- Setup cdup.nvim
require("cdup").setup(default_config)
end,
}:Cdup
Navigate with [count]h/l, <Enter> to confirm, q/<Esc> to cancel
/home/user/**freedom**/cdup.nvim/
