4 files changed,
18 insertions(+),
55 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2025-03-10 18:56:15 +0200
Parent:
63f78dc
M
after/ftplugin/go.lua
@@ -13,5 +13,3 @@
map("n", "<localleader>t", "<cmd>GoTestAdd<cr>", true) map("n", "<localleader>a", "<cmd>GoTestsAll<cr>", true) map("n", "<localleader>e", "<cmd>GoTestsExp<cr>", true) - -map("n", "<localleader>s", require("scratch.gotest_switcher").switch, true)
M
lua/plugins/lualine.lua
@@ -25,7 +25,24 @@ return "[" .. client_names_str .. "]"
end end, }, - harpoon_status = { require("scratch.harpoon_status").status }, + harpoon_status = { + function() + local list = require("harpoon"):list() + local rdir = list.config:get_root_dir() + local cfpath = vim.api.nvim_buf_get_name(0) + local status = {} + for i = 1, list:length() do + local value = list:get(i).value:gsub("^%./", "") + if cfpath == rdir .. "/" .. value then + table.insert(status, string.format("]%d[", i)) + else + table.insert(status, i) + end + end + + return table.concat(status, " "):reverse() + end, + }, } ---@type LazySpec
D
@@ -1,19 +0,0 @@
-local gotests = {} - -function gotests.switch() - local bufnr = vim.api.nvim_get_current_buf() - local fname_parts = vim.split(vim.api.nvim_buf_get_name(bufnr), "/") - local test_fname = fname_parts[#fname_parts] - if test_fname:find "_test.go" then - test_fname = test_fname:gsub("_test.go", ".go") - else - test_fname = test_fname:gsub(".go", "_test.go") - end - - table.remove(fname_parts, #fname_parts) - local path = table.concat(fname_parts, "/") .. "/" .. test_fname - - vim.cmd("edit " .. path) -end - -return gotests
D
@@ -1,33 +0,0 @@
-local M = {} - ----@param v number ----@return string -local function get_active_indicator(v) - return string.format("]%d[", v) -end - ----@return string -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 status = {} - 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 - table.insert(status, i) - end - end - - return table.concat(status, " "):reverse() -end - ----@return boolean -function M.exists() - return package.loaded["harpoon"] ~= nil -end - -return M