all repos

init.lua @ 79d4a480357c63e226656e5ffc4f02f00259d6a5

my nvim config

init.lua/lua/scratch/harpoon_status.lua(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local h = require "harpoon"
local M = {}

local function get_active_indicator(v)
  return string.format("|%d|", v)
end

function M.status()
  local list = h: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("^%./", "")

    if cfpath == rdir .. "/" .. value then
      table.insert(status, get_active_indicator(i))
    else
      table.insert(status, i)
    end
  end

  return table.concat(status, " ")
end

function M.lualine()
  if not package.loaded["harpoon"] ~= nil then
    return
  end
  return M.status():reverse()
end

function M.debug()
  package.loaded["scratch.harpoon_status"] = nil
  require "scratch.harpoon_status"
end

return M