all repos

init.lua @ 96737b4

my nvim config
2 files changed, 5 insertions(+), 15 deletions(-)
refactor(harpoon_status): some optimizing ig
Author: Smirnov Oleksandr ss2316544@gmail.com
Committed at: 2024-03-21 19:57:52 +0200
Parent: c436309
M lua/plugins/lualine.lua

@@ -35,9 +35,7 @@ return ""

end, }, harpoon_status = { - function() - return require("scratch.harpoon_status").status():reverse() - end, + require("scratch.harpoon_status").status, cond = require("scratch.harpoon_status").exists, }, }
M lua/scratch/harpoon_status.lua

@@ -3,7 +3,7 @@

---@param v number ---@return string local function get_active_indicator(v) - return string.format("|%d|", v) + return string.format("]%d[", v) end ---@return string

@@ -11,13 +11,10 @@ function M.status()

local list = require("harpoon"):list() local rdir = list.config:get_root_dir() local cfpath = vim.api.nvim_buf_get_name(0) - local len = list:length() local status = {} - for i = 1, len do - local value = list:get(i).value - value = value:gsub("^%./", "") - + for i = 1, list:length() do + local value = list:get(i).value:gsub("^%./", "") if cfpath == rdir .. "/" .. value then table.insert(status, get_active_indicator(i)) else

@@ -25,17 +22,12 @@ table.insert(status, i)

end end - return table.concat(status, " ") + return table.concat(status, " "):reverse() end ---@return boolean function M.exists() return package.loaded["harpoon"] ~= nil -end - -function M.debug() - package.loaded["scratch.harpoon_status"] = nil - require "scratch.harpoon_status" end return M