diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-09-14 11:13:08 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-09-14 11:13:08 +0900 |
| commit | 0da41319ec4963c863d2f29c9394d70cd67a30ab (patch) | |
| tree | ce1a4ce7bc35b45c5587e51ab63f5e75374bb98d | |
| parent | d0bc9d7fd4ff965b4bae4702c47dfc473bdcd86b (diff) | |
modified core/options.lua, modified plugins/mini.lua, modified shell/aliasrc
| -rw-r--r-- | mac/.config/TheSiahxyz/lua/TheSiahxyz/core/options.lua | 1 | ||||
| -rw-r--r-- | mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua | 69 | ||||
| -rw-r--r-- | mac/.config/shell/aliasrc | 2 |
3 files changed, 45 insertions, 27 deletions
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/options.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/options.lua index 895f9ee..a7908bf 100644 --- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/options.lua +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/options.lua @@ -23,6 +23,7 @@ vim.opt.ignorecase = true vim.opt.inccommand = "split" vim.opt.incsearch = true vim.opt.isfname:append("@-@") +vim.opt.laststatus = 3 vim.opt.list = true vim.opt.listchars = { tab = " ", trail = " ", nbsp = " " } vim.opt.mouse = "a" diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua index a5762d5..031dccd 100644 --- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua @@ -786,31 +786,46 @@ return { local gitStatusCache = {} local cacheTimeout = 2000 -- Cache timeout in milliseconds + local function isSymlink(path) + local stat = vim.loop.fs_lstat(path) + return stat and stat.type == "link" + end + ---@type table<string, {symbol: string, hlGroup: string}> ---@param status string ---@return string symbol, string hlGroup - local function mapSymbols(status) + local function mapSymbols(status, is_symlink) local statusMap = { - -- stylua: ignore start - [" M"] = { symbol = "•", hlGroup = "GitSignsChange"}, -- Modified in the working directory - ["M "] = { symbol = "✹", hlGroup = "GitSignsChange"}, -- modified in index - ["MM"] = { symbol = "≠", hlGroup = "GitSignsChange"}, -- modified in both working tree and index - ["A "] = { symbol = "+", hlGroup = "GitSignsAdd" }, -- Added to the staging area, new file - ["AA"] = { symbol = "≈", hlGroup = "GitSignsAdd" }, -- file is added in both working tree and index - ["D "] = { symbol = "-", hlGroup = "GitSignsDelete"}, -- Deleted from the staging area - ["AM"] = { symbol = "⊕", hlGroup = "GitSignsChange"}, -- added in working tree, modified in index - ["AD"] = { symbol = "-•", hlGroup = "GitSignsChange"}, -- Added in the index and deleted in the working directory - ["R "] = { symbol = "→", hlGroup = "GitSignsChange"}, -- Renamed in the index - ["U "] = { symbol = "‖", hlGroup = "GitSignsChange"}, -- Unmerged path - ["UU"] = { symbol = "⇄", hlGroup = "GitSignsAdd" }, -- file is unmerged - ["UA"] = { symbol = "⊕", hlGroup = "GitSignsAdd" }, -- file is unmerged and added in working tree - ["??"] = { symbol = "?", hlGroup = "GitSignsDelete"}, -- Untracked files - ["!!"] = { symbol = "!", hlGroup = "GitSignsChange"}, -- Ignored files + -- stylua: ignore start + [" M"] = { symbol = "✹", hlGroup = "MiniDiffSignChange"}, -- Modified in the working directory + ["M "] = { symbol = "•", hlGroup = "MiniDiffSignChange"}, -- modified in index + ["MM"] = { symbol = "≠", hlGroup = "MiniDiffSignChange"}, -- modified in both working tree and index + ["A "] = { symbol = "+", hlGroup = "MiniDiffSignAdd" }, -- Added to the staging area, new file + ["AA"] = { symbol = "≈", hlGroup = "MiniDiffSignAdd" }, -- file is added in both working tree and index + ["D "] = { symbol = "-", hlGroup = "MiniDiffSignDelete"}, -- Deleted from the staging area + ["AM"] = { symbol = "⊕", hlGroup = "MiniDiffSignChange"}, -- added in working tree, modified in index + ["AD"] = { symbol = "-•", hlGroup = "MiniDiffSignChange"}, -- Added in the index and deleted in the working directory + ["R "] = { symbol = "→", hlGroup = "MiniDiffSignChange"}, -- Renamed in the index + ["U "] = { symbol = "‖", hlGroup = "MiniDiffSignChange"}, -- Unmerged path + ["UU"] = { symbol = "⇄", hlGroup = "MiniDiffSignAdd" }, -- file is unmerged + ["UA"] = { symbol = "⊕", hlGroup = "MiniDiffSignAdd" }, -- file is unmerged and added in working tree + ["??"] = { symbol = "?", hlGroup = "MiniDiffSignDelete"}, -- Untracked files + ["!!"] = { symbol = "!", hlGroup = "MiniDiffSignChange"}, -- Ignored files -- stylua: ignore end } local result = statusMap[status] or { symbol = "?", hlGroup = "NonText" } - return result.symbol, result.hlGroup + local gitSymbol = result.symbol + local gitHlGroup = result.hlGroup + + local symlinkSymbol = is_symlink and "↩" or "" + + -- Combine symlink symbol with Git status if both exist + local combinedSymbol = (symlinkSymbol .. gitSymbol):gsub("^%s+", ""):gsub("%s+$", "") + -- Change the color of the symlink icon from "MiniDiffSignDelete" to something else + local combinedHlGroup = is_symlink and "MiniDiffSignDelete" or gitHlGroup + + return combinedSymbol, combinedHlGroup end ---@param cwd string @@ -826,9 +841,13 @@ return { vim.system({ "git", "status", "--ignored", "--porcelain" }, { text = true, cwd = cwd }, on_exit) end - ---@param str string? + ---@param str string|nil + ---@return string local function escapePattern(str) - return str:gsub("([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1") + if not str then + return "" + end + return (str:gsub("([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1")) end ---@param buf_id integer @@ -852,7 +871,8 @@ return { local status = gitStatusMap[relativePath] if status then - local symbol, hlGroup = mapSymbols(status) + local is_symlink = isSymlink(entry.path) + local symbol, hlGroup = mapSymbols(status, is_symlink) vim.api.nvim_buf_set_extmark(buf_id, nsMiniFiles, i - 1, 0, { -- NOTE: if you want the signs on the right uncomment those and comment -- the 3 lines after @@ -907,11 +927,11 @@ return { ---@param buf_id integer ---@return nil local function updateGitStatus(buf_id) - if not vim.fs.root(vim.uv.cwd(), ".git") then + local cwd = vim.uv.cwd() + if not cwd or not vim.fs.root(cwd, ".git") then return end - local cwd = vim.fn.expand("%:p:h") local currentTime = os.time() if gitStatusCache[cwd] and currentTime - gitStatusCache[cwd].time < cacheTimeout then updateMiniWithGit(buf_id, gitStatusCache[cwd].statusMap) @@ -939,12 +959,9 @@ return { autocmd("User", { group = augroup("start"), pattern = "MiniFilesExplorerOpen", + -- pattern = { "minifiles" }, callback = function() local bufnr = vim.api.nvim_get_current_buf() - local path = vim.api.nvim_buf_get_name(bufnr) - if path:match("^minifiles://") then - return - end updateGitStatus(bufnr) end, }) diff --git a/mac/.config/shell/aliasrc b/mac/.config/shell/aliasrc index cf2b01c..164ceb2 100644 --- a/mac/.config/shell/aliasrc +++ b/mac/.config/shell/aliasrc @@ -488,7 +488,7 @@ alias xauto='xrandr --auto' alias xoff='xset s off -dpms' # yazi -alias i='yazi' +alias a='yazi' # zathura alias za='zathura' |
