From ca4f0019a843f29106170fff71416f8f5e72fa60 Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Mon, 20 Nov 2023 08:03:03 +0000 Subject: [PATCH] feat(vim): add the oil file management plugin This is the plugin I have been using for a while now. I think its much nicer to use than a tree style. Treating the filesystem as a buffer is something I used in emacs and have come quite used to. --- modules/nvim.lua | 1 + site-modules/core/files/vim/plugin/oil.lua | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 site-modules/core/files/vim/plugin/oil.lua diff --git a/modules/nvim.lua b/modules/nvim.lua index e5631a8..ab801ac 100644 --- a/modules/nvim.lua +++ b/modules/nvim.lua @@ -48,6 +48,7 @@ local start_plugins = { ["cmp-cmdline"] = { url = "https://github.com/hrsh7th/cmp-cmdline.git", revision = "main" }, ["copilot"] = { url = "https://github.com/zbirenbaum/copilot.lua.git" }, ["copilot-cmp"] = { url = "https://github.com/zbirenbaum/copilot-cmp.git" }, + ["oil.nvim"] = { url = "https://github.com/stevearc/oil.nvim.git" }, } local opt_plugins = { diff --git a/site-modules/core/files/vim/plugin/oil.lua b/site-modules/core/files/vim/plugin/oil.lua new file mode 100644 index 0000000..f7e5928 --- /dev/null +++ b/site-modules/core/files/vim/plugin/oil.lua @@ -0,0 +1,15 @@ +local oil = require "oil" + +-- A list of file or directory names that will never be shown in the oil view +local always_hidden = { [".git"] = true } + +oil.setup { + view_options = { + show_hidden = true, + is_always_hidden = function(name) + return always_hidden[name] or false + end, + }, +} + +vim.keymap.set("n", "-", oil.open, { desc = "Open parent directory" })