chore(oil): update shortcuts and add custom winbar

This commit is contained in:
Simon Lasbrugnas 2024-11-09 00:27:51 +01:00
parent 55b2405442
commit 2a266755a3
Signed by untrusted user who does not match committer: simon
GPG key ID: 86039876BA6ED8DE

View file

@ -1,25 +1,41 @@
return { return {
'stevearc/oil.nvim', {
opts = { "stevearc/oil.nvim",
keymaps = { dependencies = { "nvim-tree/nvim-web-devicons" },
["g?"] = "actions.show_help", config = function()
["<CR>"] = "actions.select", CustomOilBar = function()
["<C-s>"] = "actions.select_vsplit", local path = vim.fn.expand "%"
["<C-h>"] = "actions.select_split", path = path:gsub("oil://", "")
["<C-t>"] = "actions.select_tab",
["<C-p>"] = false, return " " .. vim.fn.fnamemodify(path, ":.")
["<C-c>"] = "actions.close", end
["<C-l>"] = "actions.refresh",
["-"] = "actions.parent", require("oil").setup {
["_"] = "actions.open_cwd", columns = { "icon" },
["`"] = "actions.cd", keymaps = {
["~"] = "actions.tcd", ["g?"] = "actions.show_help",
["gs"] = "actions.change_sort", ["<CR>"] = "actions.select",
["gx"] = "actions.open_external", ["<C-p>"] = false,
["g."] = "actions.toggle_hidden", ["<C-c>"] = "actions.close",
["g\\"] = "actions.toggle_trash", ["<C-l>"] = "actions.refresh",
}, ["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["gs"] = "actions.change_sort",
["gx"] = "actions.open_external",
["g."] = "actions.toggle_hidden",
},
win_options = {
winbar = "%{v:lua.CustomOilBar()}",
},
}
-- Open parent directory in current window
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
-- Open parent directory in floating window
vim.keymap.set("n", "<space>-", require("oil").toggle_float)
end,
}, },
-- Optional dependencies
dependencies = { "nvim-tree/nvim-web-devicons" },
} }