diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-30 16:50:19 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-30 21:22:22 +0200 |
| commit | 25cedbb2d9772a8f113c4cc741ea1eccd93576f0 (patch) | |
| tree | 37e36d8e58bdab727713a37d7e5bf9a2f6b3b9d4 /plugin | |
| parent | 6670cfa2569033fc83d8a8000f12263dd848fb5c (diff) | |
| download | nvim-config-25cedbb2d9772a8f113c4cc741ea1eccd93576f0.tar.gz nvim-config-25cedbb2d9772a8f113c4cc741ea1eccd93576f0.zip | |
feat(oil): add oil.nvim as file explorer
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/00-plugin.lua | 1 | ||||
| -rw-r--r-- | plugin/50-oil.lua | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/plugin/00-plugin.lua b/plugin/00-plugin.lua index 6812ced..0864133 100644 --- a/plugin/00-plugin.lua +++ b/plugin/00-plugin.lua @@ -16,6 +16,7 @@ vim.pack.add({ "https://github.com/nvim-tree/nvim-web-devicons", "https://github.com/nvim-treesitter/nvim-treesitter", "https://github.com/qadzek/link.vim", + "https://github.com/stevearc/oil.nvim", "https://github.com/tpope/vim-fugitive", "https://github.com/tpope/vim-surround", "https://github.com/windwp/nvim-autopairs", diff --git a/plugin/50-oil.lua b/plugin/50-oil.lua new file mode 100644 index 0000000..142a65b --- /dev/null +++ b/plugin/50-oil.lua @@ -0,0 +1,35 @@ +--[[ 50-oil.lua — file explorer that edits the filesystem like a buffer (oil.nvim). + +Replaces netrw's local directory browsing (`default_file_explorer`); netrw's remote handlers +(ftp://, scp://, …) live in a separate autocmd group and keep working. Deletions go to the +freedesktop trash rather than being removed permanently. + +Global keymaps: +`-` open the parent directory in the current window +`<M-e>` toggle oil in a floating window + +Keymaps inside an oil buffer (merged with oil's defaults): +`<M-n>` open the entry under the cursor in a horizontal split +`<M-v>` open the entry under the cursor in a vertical split +`<C-w><C-p>`, +`<C-w>p` preview the entry under the cursor in a horizontal split +]] + +local oil = require("oil") + +oil.setup({ + default_file_explorer = true, + delete_to_trash = true, + columns = { "icon", "permissions", "size", "mtime" }, + view_options = { show_hidden = true }, + keymaps = { + ["<C-s>"] = false, + ["<M-n>"] = { "actions.select", opts = { horizontal = true } }, + ["<M-v>"] = { "actions.select", opts = { vertical = true } }, + ["<C-w><C-p>"] = { "actions.preview", opts = { horizontal = true } }, + ["<C-w>p"] = { "actions.preview", opts = { horizontal = true } }, + }, +}) + +vim.keymap.set("n", "-", "<Cmd>Oil<CR>", { desc = "Open parent directory (oil)" }) +vim.keymap.set("n", "<M-e>", oil.toggle_float, { desc = "Toggle oil (floating)" }) |
