0
0
Quellcode durchsuchen

feat(neovim): use `oil.nvim`

Joe vor 2 Monaten
Ursprung
Commit
16ea2f294b

+ 1 - 0
.config/nvim/custom/jonathandarker/lua/jonathandarker/colors/plugins/init.lua

@@ -13,5 +13,6 @@ return {
         require("jonathandarker.colors.plugins.jxdash").load(p)
         require("jonathandarker.colors.plugins.render-markdown-nvim").load(p)
         require("jonathandarker.colors.plugins.blink").load(p)
+        require("jonathandarker.colors.plugins.oil").load(p)
     end
 }

+ 20 - 0
.config/nvim/custom/jonathandarker/lua/jonathandarker/colors/plugins/oil.lua

@@ -0,0 +1,20 @@
+return {
+    load = function(p)
+        p.hset("OilDir", { fg = p.ORANGE, bold = true })
+        p.hset("OilDirHidden", { fg = p.GREY, bold = true })
+        p.hset("OilSocket", { fg = p.MAGENTA })
+        p.hset("OilLink", { fg = p.CYAN, italic = true })
+        p.hset("OilFile", { fg = p.FOREGROUND })
+        p.hset("OilFileHidden", { fg = p.GREY })
+
+        p.hset("OilPermission", { fg = p.GREEN })
+        p.hset("OilDate", { fg = p.BLUE })
+        p.hset("OilSize", { fg = p.YELLOW })
+
+        p.link("OilIconDir", "OilDir")
+        p.link("OilIconFile", "OilFile")
+        p.link("OilIconSocket", "OilSocket")
+        p.link("OilIconLink", "OilLink")
+        p.link("OilIconHidden", "OilFileHidden")
+    end
+}

+ 58 - 28
.config/nvim/init.lua

@@ -147,13 +147,13 @@ vim.pack.add({
     "https://github.com/lewis6991/gitsigns.nvim",
     "https://github.com/lukas-reineke/virt-column.nvim",
     "https://github.com/nvim-lua/plenary.nvim",
-    "https://github.com/nvim-telescope/telescope-file-browser.nvim",
     "https://github.com/nvim-telescope/telescope-ui-select.nvim",
     "https://github.com/nvim-telescope/telescope.nvim",
     "https://github.com/nvim-treesitter/nvim-treesitter-context",
     { src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", version = "master" },
     { src = "https://github.com/nvim-treesitter/nvim-treesitter",             version = "master" },
     "https://github.com/stevearc/aerial.nvim",
+    "https://github.com/stevearc/oil.nvim",
     "https://github.com/saghen/blink.cmp",
     "https://github.com/tpope/vim-commentary"
 })
@@ -666,16 +666,6 @@ local function config_telescope()
             }
         }
     })
-    vim.keymap.set("n", "<Leader>f", function()
-        require("telescope").extensions.file_browser.file_browser({
-            select_buffer = true,
-            grouped = true,
-            no_ignore = true,
-            hidden = true,
-            respect_gitignore = false,
-            path = vim.fn.expand("%:p:h")
-        })
-    end, {})
     vim.keymap.set("n", "<Leader>s", builtin.resume)
     vim.keymap.set("n", "<Leader>S", builtin.pickers)
     vim.keymap.set("n", "<Leader>T", builtin.treesitter)
@@ -692,22 +682,6 @@ local function config_telescope()
     vim.keymap.set("n", "<Leader>ls", builtin.lsp_document_symbols)
     vim.keymap.set("n", "<Leader>lS", builtin.lsp_workspace_symbols)
     require("telescope").load_extension("ui-select")
-    require("telescope").load_extension("file_browser")
-end
-
-local function config_telescope_file_browser()
-    require("telescope").setup({
-        extensions = {
-            file_browser = {
-                respect_gitignore = false,
-                hidden = { file_browser = true, folder_browser = true },
-                hijack_netrw = true,
-                display_stat = { date = false, size = true, mode = false },
-                mappings = {}
-            }
-        }
-    })
-    require("telescope").load_extension("file_browser")
 end
 
 local function config_telescope_shroud()
@@ -896,6 +870,62 @@ local function config_aerial()
     })
 end
 
+local function config_oil()
+    require("oil").setup({
+        keymaps = {
+            ["q"] = "actions.close",
+            ["<Esc>"] = "actions.close",
+            ["<C-p>"] = "actions.preview",
+        },
+        default_file_explorer = true,
+        delete_to_trash = true,
+        skip_confirm_for_simple_edits = true,
+        columns = {
+            "size",
+        },
+        view_options = { show_hidden = true },
+        float = {
+            padding = 1,
+            max_width = 999,
+            max_height = 0.99,
+            min_width = 0.999,
+            border = { "⌌", "-", "⌍", "¦", "⌏", "-", "⌎", "¦" },
+            win_options = {
+                winblend = 0,
+                winhl = "Normal:Normal,FloatBorder:WinSeparator",
+            },
+            preview_split = "right",
+        },
+        preview_win = {
+            update_on_cursor_moved = true,
+            preview_method = "fast_scratch",
+            win_options = {
+                winblend = 0,
+                winhl = "Normal:Normal,FloatBorder:WinSeparator",
+                winbar = "",
+                statusline = "",
+                signcolumn = "no",
+                number = false,
+                relativenumber = false,
+                cursorline = false,
+                foldcolumn = "0",
+            },
+        },
+        confirmation = {
+            border = { "⌌", "-", "⌍", "¦", "⌏", "-", "⌎", "¦" },
+            win_options = {
+                winblend = 0,
+                winhl = "Normal:Normal,FloatBorder:WinSeparator",
+            },
+        },
+    })
+    vim.keymap.set("n", "<Leader>f",
+        function() require("oil").open_float(nil, { preview = {} }) end)
+end
+local function config_diagnostic_dock()
+    require("diagnostic-dock").setup()
+end
+
 local setup_plugins = function()
     config_jonathandarker()
     config_nvim_treesitter()
@@ -908,7 +938,6 @@ local setup_plugins = function()
     config_nvim_treesitter_textobjects()
     config_nvim_treesitter_context()
     config_aerial()
-    config_telescope_file_browser()
     config_command_palette()
     config_maj_peg()
     config_bit_browser()
@@ -918,6 +947,7 @@ local setup_plugins = function()
     config_telescope_shroud()
     config_proj_conf()
     config_status_beast()
+    config_oil()
 end
 
 setup_plugins()