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,12 +1,20 @@
return {
'stevearc/oil.nvim',
opts = {
{
"stevearc/oil.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
CustomOilBar = function()
local path = vim.fn.expand "%"
path = path:gsub("oil://", "")
return " " .. vim.fn.fnamemodify(path, ":.")
end
require("oil").setup {
columns = { "icon" },
keymaps = {
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<C-s>"] = "actions.select_vsplit",
["<C-h>"] = "actions.select_split",
["<C-t>"] = "actions.select_tab",
["<C-p>"] = false,
["<C-c>"] = "actions.close",
["<C-l>"] = "actions.refresh",
@ -17,9 +25,17 @@ return {
["gs"] = "actions.change_sort",
["gx"] = "actions.open_external",
["g."] = "actions.toggle_hidden",
["g\\"] = "actions.toggle_trash",
},
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" },
}