From 0ab0c08bc6cefa0fd91126c97bdf0a7f0918921c Mon Sep 17 00:00:00 2001 From: Ian Date: Tue, 30 Jun 2026 23:43:32 +0200 Subject: [PATCH] :chore: add oil.vim shortcuts --- lua/config/keybinds.lua | 8 ++++++++ lua/config/oil.lua | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/config/keybinds.lua b/lua/config/keybinds.lua index d7d30cc..b118c9a 100644 --- a/lua/config/keybinds.lua +++ b/lua/config/keybinds.lua @@ -37,6 +37,14 @@ bind('n', 'w', '%s/\\s\\+$/nohlsearch', { desc = 'Dele bind('n', 'cc', 'cclose') bind('n', 'co', 'copen') +vim.keymap.set("n", "", function() + local dir = vim.fn.expand("%:p:h") + if dir == "" then + dir = vim.loop.cwd() + end + require("oil").open(dir) +end, { desc = "Open Oil in current file directory" }) + -- Telescope -- bind('n', 'ff', 'Telescope find_files') -- bind('n', 'fg', 'Telescope live_grep') diff --git a/lua/config/oil.lua b/lua/config/oil.lua index 93debdf..fe89606 100644 --- a/lua/config/oil.lua +++ b/lua/config/oil.lua @@ -68,7 +68,8 @@ require("oil").setup({ [""] = { "actions.select", opts = { horizontal = true } }, [""] = { "actions.select", opts = { tab = true } }, [""] = "actions.preview", - [""] = { "actions.close", mode = "n" }, + -- [""] = { "actions.close", mode = "n" }, + ["q"] = { "actions.close", mode = "n" }, [""] = "actions.refresh", ["-"] = { "actions.parent", mode = "n" }, ["_"] = { "actions.open_cwd", mode = "n" },