From 75eae3f174c5d44bfef1b289156c8f001607ee09 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 18 Sep 2026 14:31:48 +0200 Subject: [PATCH] disable oil, enable mini.files --- nvim/.config/nvim/README.md | 8 +- nvim/.config/nvim/lua/romanzy/keymaps.lua | 4 +- .../.config/nvim/lua/romanzy/plugins/mini.lua | 3 + nvim/.config/nvim/lua/romanzy/plugins/oil.lua | 178 +++++++++--------- 4 files changed, 97 insertions(+), 96 deletions(-) diff --git a/nvim/.config/nvim/README.md b/nvim/.config/nvim/README.md index d663a5e..694f9fc 100644 --- a/nvim/.config/nvim/README.md +++ b/nvim/.config/nvim/README.md @@ -53,13 +53,9 @@ Refresh shortcuts (oil and buffers): - `gR` refresh the current buffer - `` refresh the current buffer -Oil usage: +Files usage: -- `dl` opens the file browser -- `-`, `` goes to the parent directory -- `` also goes to the parent directory -- `` opens the selected file or enters the selected directory -- `` previews the selected entry +- `e` opens the file browser - `gx` opens the file in external viewer Toggle shortcuts: diff --git a/nvim/.config/nvim/lua/romanzy/keymaps.lua b/nvim/.config/nvim/lua/romanzy/keymaps.lua index fd064f4..f725fd9 100644 --- a/nvim/.config/nvim/lua/romanzy/keymaps.lua +++ b/nvim/.config/nvim/lua/romanzy/keymaps.lua @@ -20,7 +20,9 @@ end map("n", "r", ":source ~/.config/nvim/init.lua", { desc = "reload init.lua" }) map("n", "h", telescope_picker("keymaps"), { desc = "show keymaps" }) -map("n", "dl", "Oil", { desc = "open oil" }) +map("n", "e", function() + MiniFiles.open() +end, { desc = "open mini.files" }) map("n", "ff", telescope_picker("find_files"), { desc = "find files" }) map("n", "fg", telescope_picker("live_grep"), { desc = "live grep" }) map("n", "fb", telescope_picker("buffers"), { desc = "find buffers" }) diff --git a/nvim/.config/nvim/lua/romanzy/plugins/mini.lua b/nvim/.config/nvim/lua/romanzy/plugins/mini.lua index ca152d3..4a21403 100644 --- a/nvim/.config/nvim/lua/romanzy/plugins/mini.lua +++ b/nvim/.config/nvim/lua/romanzy/plugins/mini.lua @@ -9,6 +9,7 @@ vim.pack.add({ local clue = require("mini.clue") local completion = require("mini.completion") local icons = require("mini.icons") +local files = require("mini.files") local git = require("mini.git") local diff = require("mini.diff") local statusline = require("mini.statusline") @@ -42,6 +43,8 @@ clue.setup({ icons.setup({}) +files.setup({}) + git.setup({}) diff.setup({}) diff --git a/nvim/.config/nvim/lua/romanzy/plugins/oil.lua b/nvim/.config/nvim/lua/romanzy/plugins/oil.lua index f883529..36fe27a 100644 --- a/nvim/.config/nvim/lua/romanzy/plugins/oil.lua +++ b/nvim/.config/nvim/lua/romanzy/plugins/oil.lua @@ -1,89 +1,89 @@ -vim.pack.add({ - { - src = "https://github.com/stevearc/oil.nvim", - name = "oil.nvim", - }, - { - src = "https://github.com/malewicz1337/oil-git.nvim", - name = "oil-git.nvim", - }, -}) - -local function set_oil_git_highlights() - vim.api.nvim_set_hl(0, "OilGitAdded", { link = "MiniDiffSignAdd" }) - vim.api.nvim_set_hl(0, "OilGitUntracked", { link = "MiniDiffSignAdd" }) - vim.api.nvim_set_hl(0, "OilGitModifiedStaged", { link = "MiniDiffSignChange" }) - vim.api.nvim_set_hl(0, "OilGitModifiedUnstaged", { link = "MiniDiffSignChange" }) - vim.api.nvim_set_hl(0, "OilGitRenamed", { link = "MiniDiffSignChange" }) - vim.api.nvim_set_hl(0, "OilGitCopied", { link = "MiniDiffSignChange" }) - vim.api.nvim_set_hl(0, "OilGitDeleted", { link = "MiniDiffSignDelete" }) - vim.api.nvim_set_hl(0, "OilGitConflict", { link = "MiniDiffSignDelete" }) - vim.api.nvim_set_hl(0, "OilGitIgnored", { link = "Comment" }) -end - -require("oil").setup({ - keymaps = { - [""] = false, - [""] = false, - [""] = false, - [""] = false, - ["gR"] = "actions.refresh", -- replaces default behavior - [""] = "actions.refresh", - [""] = false, - [""] = { "actions.preview", opts = { vertical = true, split = "belowright" } }, - [""] = { "actions.parent", mode = "n" }, - }, - view_options = { - show_hidden = true, - is_hidden_file = function(_, _) - return false - end, - is_always_hidden = function(name, _) - return name == ".git" - end, - }, -}) - -local oil_git_trie = require("oil-git.trie") -local oil_git_lookup = oil_git_trie.lookup - --- ugly internal monkey patch to not show partially git-ignored foldres as grey -rawset(oil_git_trie, "lookup", function(root, entry_path, git_root, exclude_ignored) - local status = oil_git_lookup(root, entry_path, git_root, exclude_ignored) - if status ~= "!!" or exclude_ignored then - return status - end - - local relative_path = entry_path:sub(#git_root + 2) - local node = root - for segment in relative_path:gmatch("[^/\\]+") do - node = node.children[segment] - if not node then - return nil - end - end - - -- oil-git normally propagates an ignored child's status to every parent. - -- Only grey a directory when Git reported that directory itself as ignored. - if not node.is_dir_ignored then - return nil - end - - return status -end) - -require("oil-git").setup({ - show_file_highlights = true, - show_directory_highlights = true, - show_ignored_files = true, - show_ignored_directories = true, - show_file_symbols = true, - show_directory_symbols = true, - symbol_position = "none", -}) - -set_oil_git_highlights() -vim.api.nvim_create_autocmd("ColorScheme", { - group = vim.api.nvim_create_augroup("romanzy_oil_git_highlights", { clear = true }), - callback = set_oil_git_highlights, -}) +-- vim.pack.add({ +-- { +-- src = "https://github.com/stevearc/oil.nvim", +-- name = "oil.nvim", +-- }, +-- { +-- src = "https://github.com/malewicz1337/oil-git.nvim", +-- name = "oil-git.nvim", +-- }, +-- }) +-- +-- local function set_oil_git_highlights() +-- vim.api.nvim_set_hl(0, "OilGitAdded", { link = "MiniDiffSignAdd" }) +-- vim.api.nvim_set_hl(0, "OilGitUntracked", { link = "MiniDiffSignAdd" }) +-- vim.api.nvim_set_hl(0, "OilGitModifiedStaged", { link = "MiniDiffSignChange" }) +-- vim.api.nvim_set_hl(0, "OilGitModifiedUnstaged", { link = "MiniDiffSignChange" }) +-- vim.api.nvim_set_hl(0, "OilGitRenamed", { link = "MiniDiffSignChange" }) +-- vim.api.nvim_set_hl(0, "OilGitCopied", { link = "MiniDiffSignChange" }) +-- vim.api.nvim_set_hl(0, "OilGitDeleted", { link = "MiniDiffSignDelete" }) +-- vim.api.nvim_set_hl(0, "OilGitConflict", { link = "MiniDiffSignDelete" }) +-- vim.api.nvim_set_hl(0, "OilGitIgnored", { link = "Comment" }) +-- end +-- +-- require("oil").setup({ +-- keymaps = { +-- [""] = false, +-- [""] = false, +-- [""] = false, +-- [""] = false, +-- ["gR"] = "actions.refresh", -- replaces default behavior +-- [""] = "actions.refresh", +-- [""] = false, +-- [""] = { "actions.preview", opts = { vertical = true, split = "belowright" } }, +-- [""] = { "actions.parent", mode = "n" }, +-- }, +-- view_options = { +-- show_hidden = true, +-- is_hidden_file = function(_, _) +-- return false +-- end, +-- is_always_hidden = function(name, _) +-- return name == ".git" +-- end, +-- }, +-- }) +-- +-- local oil_git_trie = require("oil-git.trie") +-- local oil_git_lookup = oil_git_trie.lookup +-- +-- -- ugly internal monkey patch to not show partially git-ignored foldres as grey +-- rawset(oil_git_trie, "lookup", function(root, entry_path, git_root, exclude_ignored) +-- local status = oil_git_lookup(root, entry_path, git_root, exclude_ignored) +-- if status ~= "!!" or exclude_ignored then +-- return status +-- end +-- +-- local relative_path = entry_path:sub(#git_root + 2) +-- local node = root +-- for segment in relative_path:gmatch("[^/\\]+") do +-- node = node.children[segment] +-- if not node then +-- return nil +-- end +-- end +-- +-- -- oil-git normally propagates an ignored child's status to every parent. +-- -- Only grey a directory when Git reported that directory itself as ignored. +-- if not node.is_dir_ignored then +-- return nil +-- end +-- +-- return status +-- end) +-- +-- require("oil-git").setup({ +-- show_file_highlights = true, +-- show_directory_highlights = true, +-- show_ignored_files = true, +-- show_ignored_directories = true, +-- show_file_symbols = true, +-- show_directory_symbols = true, +-- symbol_position = "none", +-- }) +-- +-- set_oil_git_highlights() +-- vim.api.nvim_create_autocmd("ColorScheme", { +-- group = vim.api.nvim_create_augroup("romanzy_oil_git_highlights", { clear = true }), +-- callback = set_oil_git_highlights, +-- })