Compare commits

..
Author SHA1 Message Date
romanzy313 b1714279ff disable lsp progress
Very annoying in slow dart lsp
2026-09-21 16:43:32 +02:00
romanzy313 94972506c2 improve mini_files 2026-09-18 19:01:58 +02:00
romanzy313 0ac228d0c3 change mini.files open location 2026-09-18 18:53:36 +02:00
romanzy313 e8027c8c7f primitive spell checking 2026-09-18 17:45:45 +02:00
romanzy313 a0e45a6dec config mini.input 2026-09-18 17:01:20 +02:00
romanzy313 18931930a2 added mini.input 2026-09-18 16:29:48 +02:00
romanzy313 dda48dc457 buffers close toast 2026-09-18 16:03:22 +02:00
romanzy313 cbe9447671 cleanup structure 2026-09-18 16:00:05 +02:00
romanzy313 c67352a14d refactor 2026-09-18 15:56:14 +02:00
romanzy313 0e8f4bc7a5 open files from mini.files 2026-09-18 15:50:54 +02:00
romanzy313 292961ae93 refreshing the shortcuts 2026-09-18 15:39:36 +02:00
romanzy313 9a01804f2f improve highlight 2026-09-18 15:30:19 +02:00
romanzy313 d41c23b9aa implemted oil compatibility 2026-09-18 15:03:27 +02:00
romanzy313 75eae3f174 disable oil, enable mini.files 2026-09-18 14:33:35 +02:00
romanzy313 c71d6ae982 improve mini.diff 2026-09-18 02:43:20 +02:00
romanzy313 7c24bf6c94 declutter statusline 2026-09-18 02:19:00 +02:00
romanzy313 da7f9d0bdb mini.cmdline 2026-09-18 02:05:31 +02:00
romanzy313 83561baf1f adhoc better completions 2026-09-18 01:50:34 +02:00
romanzy313 5b7df5dfb4 fix wrapping!!! 2026-09-18 01:09:58 +02:00
11 changed files with 681 additions and 146 deletions
+11 -16
View File
@@ -14,6 +14,12 @@ To remove a plugin run `:lua vim.pack.del({ "<plugin name>" })`.
See custom keymaps with short descriptions with `<leader><leader>h`.
General shortcuts:
- `<leader>e` opens the file browser
- `gx` opens an external viewer
- `gR`, `<F5>` refresh
Windowing shortcuts:
- `<leader>sv` open a vertical split
@@ -45,26 +51,16 @@ Git shortcuts:
- `<leader>lg` open LazyGit
- `<leader>dv` open Diffview
- `<leader>dc` close Diffview
- `[h`, `]h`, `[H`, `]H` jump to hunks
- `<leader>th` — toggle the expanded hunk view
Toggle shortcuts:
- `<leader>tw` toggle soft wrap
- `<leader>ts` toggle spell checking
- `<leader>ti` toggle inline diagnostics
- `<leader>tv` toggle virtual diagnostics
Refresh shortcuts (oil and buffers):
- `gR` refresh the current buffer
- `<F5>` refresh the current buffer
Oil usage:
- `<leader>dl` opens the file browser
- `-`, `<BS>` goes to the parent directory
- `<A-h>` also goes to the parent directory
- `<A-l>` opens the selected file or enters the selected directory
- `<C-p>` previews the selected entry
- `gx` opens the file in external viewer
- `<leader>th` — toggle the expanded hunk view
## Terminal
@@ -102,8 +98,7 @@ Diagnostics:
- `g.` open diagnostic float
- `gl` send diagnostics to the location list
- `gld` display diagnostic information
- `]g` jump to next warning or error
- `[g` jump to previous warning or error
- `]g`, `[g` jump to warning or error
- `<leader>ti` toggle inline diagnostics
- `<leader>tv` toggle virtual diagnostics
- `<leader>xx` toggle project warnings and errors
@@ -2,6 +2,7 @@ local M = {}
function M.close_hidden()
local visible_buffers = {}
local closed_count = 0
for _, tabpage in ipairs(vim.api.nvim_list_tabpages()) do
for _, window in ipairs(vim.api.nvim_tabpage_list_wins(tabpage)) do
@@ -12,8 +13,17 @@ function M.close_hidden()
for _, buffer in ipairs(vim.api.nvim_list_bufs()) do
if vim.bo[buffer].buflisted and not visible_buffers[buffer] then
vim.api.nvim_buf_delete(buffer, { force = true })
closed_count = closed_count + 1
end
end
if closed_count == 0 then
vim.notify("No hidden buffers to close", vim.log.levels.INFO)
return
end
local buffer_label = closed_count == 1 and "buffer" or "buffers"
vim.notify(string.format("Closed %d hidden %s", closed_count, buffer_label), vim.log.levels.INFO)
end
return M
@@ -0,0 +1,426 @@
-- Custom module to config a few things for the mini.files:
-- - git highlighting
-- - refresh
-- - file open in external programs
local M = {}
local uv = vim.uv or vim.loop
local cache_ttl_ms = 1000
local status_cache = {}
local git_root_cache = {}
local known_git_roots = {}
local function is_path_inside(path, root)
return path == root or vim.startswith(path, root .. "/")
end
local function new_status_node()
return {
children = {},
status = nil,
priority = 0,
is_dir_ignored = false,
is_dir_untracked = false,
}
end
local function is_conflict(status)
if #status < 2 then
return false
end
local index_status = status:sub(1, 1)
local worktree_status = status:sub(2, 2)
return index_status == "U"
or worktree_status == "U"
or status == "AA"
or status == "DD"
end
local function status_priority(status)
-- Folder aggregation follows the Zed-inspired order create < edit <
-- delete. `subtree_status()` uses the greatest priority, so deletion
-- must outrank every create or edit status.
if #status < 2 then
return 0
end
if is_conflict(status) then
return 8
end
if status == "!!" then
return 1
end
if status == "??" then
return 2
end
local index_status = status:sub(1, 1)
local worktree_status = status:sub(2, 2)
if index_status == "D" or worktree_status == "D" then
return 4
end
if index_status == "A" then
return 2
end
if index_status == "R" or index_status == "C" then
return 3
end
if index_status == "M" or worktree_status == "M" then
return 3
end
return 0
end
local function status_highlight(status)
if not status then
return nil
end
if status == "!!" then
return "Comment"
end
if is_conflict(status) then
return "MiniDiffSignDelete"
end
if status == "??" or status:sub(1, 1) == "A" then
return "MiniDiffSignAdd"
end
if status:sub(1, 1) == "D" or status:sub(2, 2) == "D" then
return "MiniDiffSignDelete"
end
if status:sub(1, 1) == "M"
or status:sub(1, 1) == "R"
or status:sub(1, 1) == "C"
or status:sub(2, 2) == "M"
then
return "MiniDiffSignChange"
end
return nil
end
local function insert_status(root, relative_path, status, is_directory)
local priority = status_priority(status)
if priority == 0 then
return
end
local node = root
local segments = vim.split(relative_path, "/", { plain = true, trimempty = true })
for index, segment in ipairs(segments) do
node.children[segment] = node.children[segment] or new_status_node()
node = node.children[segment]
if index == #segments then
if priority > node.priority then
node.status = status
node.priority = priority
end
if is_directory and status == "!!" then
node.is_dir_ignored = true
end
if is_directory and status == "??" then
node.is_dir_untracked = true
end
end
end
end
local function subtree_status(node)
local best_status = node.status
local best_priority = node.priority
for _, child in pairs(node.children) do
local child_status, child_priority = subtree_status(child)
if child_priority > best_priority then
best_status = child_status
best_priority = child_priority
end
end
return best_status, best_priority
end
local function parse_status(output, root)
local data = {
root = root,
statuses = {},
trie = new_status_node(),
timestamp = uv.now(),
}
local records = vim.split(output, "\0", { plain = true, trimempty = true })
local record_index = 1
while record_index <= #records do
local record = records[record_index]
if #record >= 4 then
local status = record:sub(1, 2)
local relative_path = record:sub(4)
-- With -z, rename/copy output contains the new path followed by
-- the old path. Oil highlights the new path only.
if status:sub(1, 1) == "R" or status:sub(1, 1) == "C" then
record_index = record_index + 1
end
local is_directory = relative_path:sub(-1) == "/"
relative_path = relative_path:gsub("^%./", ""):gsub("/$", "")
if relative_path ~= "" then
local absolute_path = vim.fs.normalize(vim.fs.joinpath(root, relative_path))
data.statuses[absolute_path] = status
insert_status(data.trie, relative_path, status, is_directory)
end
end
record_index = record_index + 1
end
return data
end
local function find_cached_root(path)
local result
for root in pairs(known_git_roots) do
if is_path_inside(path, root) and (result == nil or #root > #result) then
result = root
end
end
return result
end
local function find_git_root(path)
local cached_root = find_cached_root(path)
if cached_root ~= nil then
return cached_root
end
local cached = git_root_cache[path]
if cached ~= nil then
return cached or nil
end
local result = vim.system({ "git", "-C", path, "rev-parse", "--show-toplevel" }, { text = true }):wait()
if result.code ~= 0 then
git_root_cache[path] = false
return nil
end
local root = vim.trim(result.stdout)
if root == "" then
git_root_cache[path] = false
return nil
end
root = vim.fs.normalize(root)
git_root_cache[path] = root
known_git_roots[root] = true
return root
end
local function get_status_data(fs_entry)
local path = fs_entry.path
if fs_entry.fs_type ~= "directory" then
path = vim.fs.dirname(path)
end
path = vim.fs.normalize(path)
local root = find_git_root(path)
if root == nil then
return nil
end
local cached = status_cache[root]
if cached ~= nil and uv.now() - cached.timestamp < cache_ttl_ms then
return cached
end
local result = vim.system({
"git",
"-C",
root,
"--no-optional-locks",
"status",
"--porcelain",
"--ignored",
"-z",
}, { text = true }):wait()
if result.code ~= 0 then
status_cache[root] = parse_status("", root)
return status_cache[root]
end
local data = parse_status(result.stdout, root)
status_cache[root] = data
return data
end
local function lookup_status(data, fs_entry)
local path = vim.fs.normalize(fs_entry.path)
local direct_status = data.statuses[path]
if fs_entry.fs_type ~= "directory" and direct_status ~= nil then
return direct_status
end
if not is_path_inside(path, data.root) then
return nil
end
local relative_path = path:sub(#data.root + 2)
local node = data.trie
for _, segment in ipairs(vim.split(relative_path, "/", { plain = true, trimempty = true })) do
if node.is_dir_ignored then
return "!!"
end
if node.is_dir_untracked then
return "??"
end
node = node.children[segment]
if node == nil then
return nil
end
end
if node.is_dir_ignored then
return "!!"
end
if node.is_dir_untracked then
return "??"
end
if next(node.children) == nil then
return node.status
end
local status = subtree_status(node)
-- Match the Oil configuration: an ignored descendant does not grey its
-- parent directory unless Git reported that directory as ignored.
if fs_entry.fs_type == "directory" and status == "!!" then
return nil
end
return status
end
function M.filter(fs_entry)
return fs_entry.name ~= ".git"
end
local function get_entry_status(fs_entry)
local data = get_status_data(fs_entry)
if data == nil then
return nil
end
return lookup_status(data, fs_entry)
end
function M.highlight(fs_entry)
local status = get_entry_status(fs_entry)
return status_highlight(status)
or (fs_entry.fs_type == "directory" and "MiniFilesDirectory" or "MiniFilesFile")
end
function M.invalidate()
status_cache = {}
git_root_cache = {}
known_git_roots = {}
end
local function refresh()
M.invalidate()
if _G.MiniFiles == nil or MiniFiles.get_explorer_state() == nil then
return
end
vim.schedule(function()
if MiniFiles.get_explorer_state() ~= nil then
MiniFiles.refresh()
end
end)
end
local function refresh_filetree()
M.invalidate()
if _G.MiniFiles == nil or MiniFiles.get_explorer_state() == nil then
return
end
vim.schedule(function()
if MiniFiles.get_explorer_state() ~= nil then
MiniFiles.refresh({
content = {
filter = M.filter,
highlight = M.highlight,
},
})
end
end)
end
local function open_external()
local fs_entry = MiniFiles.get_fs_entry()
if fs_entry == nil then
vim.notify("No file system entry under the cursor", vim.log.levels.WARN)
return
end
vim.ui.open(fs_entry.path)
end
function M.setup()
local group = vim.api.nvim_create_augroup("romanzy_mini_files_git", { clear = true })
vim.api.nvim_create_autocmd("User", {
group = group,
pattern = "MiniFilesBufferCreate",
callback = function(args)
if args.data == nil then
return
end
for _, lhs in ipairs({ "gR", "<F5>" }) do
vim.keymap.set("n", lhs, refresh_filetree, {
buffer = args.data.buf_id,
desc = "refresh mini.files filetree",
})
end
vim.keymap.set("n", "gx", open_external, {
buffer = args.data.buf_id,
desc = "open mini.files entry externally",
})
vim.keymap.set("n", "<CR>", "L", {
buffer = args.data.buf_id,
remap = true,
desc = "go in entry plus (extra)",
})
end,
})
vim.api.nvim_create_autocmd({ "BufWritePost", "FocusGained", "TermClose" }, {
group = group,
callback = refresh,
})
vim.api.nvim_create_autocmd("User", {
group = group,
pattern = {
"GitSignsUpdate",
"LazyGitClosed",
"MiniFilesActionCreate",
"MiniFilesActionDelete",
"MiniFilesActionRename",
"MiniFilesActionCopy",
"MiniFilesActionMove",
},
callback = refresh,
})
return {
content = {
filter = M.filter,
highlight = M.highlight,
},
}
end
return M
@@ -0,0 +1,35 @@
local M = {}
--- Toggle spell checking for the current window.
function M.toggle()
if vim.bo.buftype == "terminal" then
return
end
vim.opt_local.spell = not vim.wo.spell
vim.cmd("redrawstatus")
end
function M.setup()
vim.opt.spelllang = { "en_us" }
vim.opt.spell = true
local group = vim.api.nvim_create_augroup("RomanzySpell", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
group = group,
pattern = "terminal",
callback = function()
vim.opt_local.spell = false
end,
})
vim.api.nvim_create_autocmd("TermOpen", {
group = group,
callback = function()
vim.cmd("setfiletype terminal")
end,
})
end
return M
+10 -10
View File
@@ -1,18 +1,18 @@
local M = {}
--- Toggle wrapping, or force it to the provided state.
--- This plugin is buggy, so it does nothing
--- @param enabled? boolean
function M.toggle(enabled)
-- if enabled == nil then
-- enabled = not vim.wo.wrap
-- end
--
-- vim.wo.wrap = enabled
-- vim.wo.linebreak = enabled
-- vim.wo.breakindent = enabled
-- vim.bo.textwidth = enabled and 80 or 0
-- vim.bo.wrapmargin = 0
if enabled == nil then
enabled = not vim.wo.wrap
end
vim.wo.wrap = enabled
vim.wo.linebreak = enabled
vim.wo.breakindent = enabled
vim.wo.colorcolumn = enabled and "" or "80"
vim.bo.textwidth = enabled and 0 or 80
vim.bo.wrapmargin = 0
end
return M
+14 -1
View File
@@ -18,9 +18,18 @@ local function telescope_picker(picker)
end
end
local function open_mini_files_at_current_buffer()
local current_path = vim.api.nvim_buf_get_name(0)
if vim.bo.buftype ~= "" or current_path == "" then
current_path = nil
end
MiniFiles.open(current_path)
end
map("n", "<leader><leader>r", ":source ~/.config/nvim/init.lua<CR>", { desc = "reload init.lua" })
map("n", "<leader><leader>h", telescope_picker("keymaps"), { desc = "show keymaps" })
map("n", "<leader>dl", "<Cmd>Oil<CR>", { desc = "open oil" })
map("n", "<leader>e", open_mini_files_at_current_buffer, { desc = "open mini.files" })
map("n", "<leader>ff", telescope_picker("find_files"), { desc = "find files" })
map("n", "<leader>fg", telescope_picker("live_grep"), { desc = "live grep" })
map("n", "<leader>fb", telescope_picker("buffers"), { desc = "find buffers" })
@@ -29,6 +38,10 @@ map("n", "<leader>lg", "<Cmd>LazyGit<CR>", { desc = "open lazygit" })
map("n", "<leader>dv", "<Cmd>DiffviewOpen<CR>", { desc = "open diffview" })
map("n", "<leader>dc", "<Cmd>DiffviewClose<CR>", { desc = "close diffview" })
map("n", "<leader>tw", require("romanzy.custom.wrap").toggle, { desc = "toggle soft wrap" })
map("n", "<leader>ts", require("romanzy.custom.spell").toggle, { desc = "toggle spell checking" })
map("n", "<leader>th", function()
MiniDiff.toggle_overlay()
end, { desc = "toggle hunk view" })
map("n", "<leader>sv", "<Cmd>vs<CR>", { desc = "split vertical" })
map("n", "<leader>sh", "<Cmd>sp<CR>", { desc = "split horizontal" })
+3 -4
View File
@@ -1,6 +1,5 @@
local g = vim.g
local o = vim.opt
g.mapleader = " " -- Uses space as the global leader key.
g.maplocalleader = " " -- Uses space as the local leader key.
g.clipboard = "osc52" -- Routes the + and * registers through OSC52 in terminal Neovim.
@@ -11,7 +10,8 @@ o.cursorline = true -- Highlights the line under the cursor.
o.textwidth = 80 -- Wraps inserted text after 80 columns when formatting is active.
o.scrolloff = 8 -- Keeps context lines visible around the cursor.
o.signcolumn = "yes" -- Always reserves space for signs in the gutter.
o.colorcolumn = "+1" -- Highlights the preferred maximum line width.
o.colorcolumn = "80" -- Highlights the preferred maximum line width.
o.wrap = false -- Prevents long lines from wrapping on screen.
o.list = true -- Displays whitespace characters using listchars.
o.listchars = {
tab = "» ",
@@ -29,10 +29,9 @@ o.expandtab = true -- Inserts spaces w
o.smartindent = true -- Adds indentation automatically on new lines.
o.swapfile = false -- Disables swapfile creation.
o.incsearch = true -- Updates search matches as you type.
o.completeopt = { "menuone", "noselect", "fuzzy", "nosort" } -- Enables fuzzy completion matching.
o.completeopt = { "menuone", "noinsert", "fuzzy", "nosort" } -- Enables fuzzy completion matching.
o.pumheight = 8 -- Limits the completion popup menu size.
o.updatetime = 50 -- Reduces idle delay for swap and CursorHold events.
o.spelllang = { "en_us" } -- Uses US English for spell checking.
o.shell = "bash" -- Runs shell commands through bash.
-- Only show the invisible characters inside the code editing buffers
+2 -1
View File
@@ -9,4 +9,5 @@ require("romanzy.plugins.nvim-treesitter")
require("romanzy.plugins.conform")
require("romanzy.plugins.lsp")
require("romanzy.plugins.codamheader")
require("romanzy.plugins.romanzy")
require("romanzy.custom.spell").setup()
require("romanzy.custom.tabline").setup()
+81 -24
View File
@@ -6,18 +6,35 @@ vim.pack.add({
},
})
local icons = require("mini.icons")
local input = require("mini.input")
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")
local cmdline = require("mini.cmdline")
local hipatterns = require("mini.hipatterns")
local pairs = require("mini.pairs")
local ai = require("mini.ai")
local notify = require("mini.notify")
local surround = require("mini.surround")
icons.setup({})
local input_view = input.gen_view.floatwin({
-- other interesting symbols for the caret `▏` `⎕` `░` `▒` `▓`
to_chunks = function(state, max_width)
return input.state_to_chunks(state, max_width, {
include_prompt = false,
include_hint = false,
symbol_caret = "█",
})
end,
})
input.setup({ handlers = { view = input_view } })
clue.setup({
triggers = {
{ mode = "n", keys = "<leader>" },
@@ -39,39 +56,70 @@ clue.setup({
},
})
completion.setup({})
local function complete_accept_top()
if vim.fn.pumvisible() == 0 then
return "<C-y>"
end
if vim.fn.complete_info({ "selected" }).selected == -1 then
return "<C-n><C-y>"
end
return "<C-y>"
end
vim.keymap.set("i", "<C-y>", complete_accept_top, { expr = true })
icons.setup({})
files.setup(require("romanzy.custom.mini_files").setup())
git.setup({})
diff.setup({})
local function set_mini_diff_highlights()
vim.api.nvim_set_hl(0, "MiniDiffSignAdd", { fg = "#9ccf8d" })
vim.api.nvim_set_hl(0, "MiniDiffSignChange", { fg = "#f6c177" })
vim.api.nvim_set_hl(0, "MiniDiffSignDelete", { fg = "#eb6f92" })
vim.api.nvim_set_hl(0, "MiniDiffOverAdd", { fg = "#9ccf8d" })
vim.api.nvim_set_hl(0, "MiniDiffOverChange", { fg = "#f6c177" })
vim.api.nvim_set_hl(0, "MiniDiffOverDelete", { fg = "#eb6f92" })
vim.api.nvim_set_hl(0, "MiniDiffSignAdd", { fg = "#9ccf8d", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffSignChange", { fg = "#f6c177", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffSignDelete", { fg = "#eb6f92", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffOverAdd", { fg = "#9ccf8d", bg = "#333c48", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffOverChange", { fg = "#eb6f92", bg = "#43293a", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffOverChangeBuf", { fg = "#9ccf8d", bg = "#333c48", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffOverContext", { fg = "#908caa", bg = "#26233a" })
vim.api.nvim_set_hl(0, "MiniDiffOverContextBuf", { fg = "#e0def4", bg = "#1f1d2e" })
vim.api.nvim_set_hl(0, "MiniDiffOverDelete", { fg = "#eb6f92", bg = "#43293a", bold = true })
end
set_mini_diff_highlights()
vim.api.nvim_create_autocmd("ColorScheme", {
callback = set_mini_diff_highlights,
})
statusline.setup({ use_icons = true })
-- Custom de-cluttered status line output. The default was waaay to noisy
local function statusline_active()
local function statusline_filetype()
local filetype = vim.bo.filetype
if filetype == "" then
return ""
end
local icon = MiniIcons.get("filetype", filetype)
return icon .. " " .. filetype
end
local function statusline_spell()
return vim.wo.spell and "spell" or ""
end
local mode, mode_hl = statusline.section_mode({ trunc_width = 120 })
local git_info = statusline.section_git({ trunc_width = 40 })
-- local diff_info = statusline.section_diff({ trunc_width = 75 })
-- local diagnostics = statusline.section_diagnostics({ trunc_width = 75 })
local lsp = statusline.section_lsp({ trunc_width = 75 })
local filename = statusline.section_filename({ trunc_width = 140 })
local spell = statusline_spell()
local fileinfo = statusline_filetype()
local search = statusline.section_searchcount({ trunc_width = 75 })
return statusline.combine_groups({
{ hl = mode_hl, strings = { mode } },
{ hl = "MiniStatuslineDevinfo", strings = { git_info, lsp } },
"%<",
{ hl = "MiniStatuslineFilename", strings = { filename } },
"%=",
{ hl = "MiniStatuslineFileinfo", strings = { spell, fileinfo } },
{ hl = mode_hl, strings = { search } },
})
end
statusline.setup({
use_icons = true,
content = { active = statusline_active },
})
cmdline.setup({})
hipatterns.setup({
highlighters = {
@@ -87,13 +135,22 @@ pairs.setup({
modes = { insert = true, command = true, terminal = false },
})
completion.setup({})
vim.keymap.set("i", "<CR>", function()
if vim.fn.complete_info({ "selected" }).selected ~= -1 then
return "\25"
end
return MiniPairs.cr()
end, { expr = true })
ai.setup({})
notify.setup({
lsp_progress = {
-- the message "lua_ls: processing completion..." and
-- "lua_ls: Diagnosing" is very annoying
enable = true,
-- enable = true,
},
})
vim.notify = notify.make_notify()
+89 -89
View File
@@ -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 = {
["<C-h>"] = false,
["<C-j>"] = false,
["<C-k>"] = false,
["<C-l>"] = false,
["gR"] = "actions.refresh", -- replaces default <C-l> behavior
["<F5>"] = "actions.refresh",
["<C-s>"] = false,
["<C-p>"] = { "actions.preview", opts = { vertical = true, split = "belowright" } },
["<BS>"] = { "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 = {
-- ["<C-h>"] = false,
-- ["<C-j>"] = false,
-- ["<C-k>"] = false,
-- ["<C-l>"] = false,
-- ["gR"] = "actions.refresh", -- replaces default <C-l> behavior
-- ["<F5>"] = "actions.refresh",
-- ["<C-s>"] = false,
-- ["<C-p>"] = { "actions.preview", opts = { vertical = true, split = "belowright" } },
-- ["<BS>"] = { "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,
-- })
@@ -1 +0,0 @@
require("romanzy.custom.tabline").setup()