45 lines
1.3 KiB
Lua
45 lines
1.3 KiB
Lua
-- oil.nvim
|
|
vim.g.loaded_netrwPlugin = 1
|
|
require("oil").setup({
|
|
default_file_explorer = false,
|
|
view_options = {
|
|
show_hidden = true
|
|
},
|
|
columns = {
|
|
"icon",
|
|
"permissions",
|
|
"size",
|
|
-- "mtime",
|
|
},
|
|
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>"] = "actions.preview",
|
|
["<C-c>"] = "actions.close",
|
|
["<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",
|
|
["g\\"] = "actions.toggle_trash",
|
|
},
|
|
})
|
|
-- setup rename autocmds
|
|
local prev = { new_name = "", old_name = "" } -- Prevents duplicate events
|
|
vim.api.nvim_create_autocmd("User", {
|
|
pattern = "OilActionsPost",
|
|
callback = function(event)
|
|
if event.data.actions.type == "move" then
|
|
Snacks.rename.on_rename_file(event.data.actions.src_url, event.data.actions.dest_url)
|
|
end
|
|
end,
|
|
})
|
|
-- oil keybinds
|
|
vim.keymap.set("n", "-", "<cmd>Oil<CR>", { noremap = true, desc = "Open Parent Directory" })
|
|
vim.keymap.set("n", "<leader>-", "<cmd>Oil .<CR>", { noremap = true, desc = "Open nvim root directory" })
|