chore: lint

This commit is contained in:
mpaulson 2023-12-10 12:51:03 -07:00
parent 5a3195e7bf
commit d043904d1e
5 changed files with 17 additions and 25 deletions

View File

@ -49,26 +49,17 @@ function M.setup_autocmds_and_keymaps(bufnr)
end end
vim.api.nvim_buf_set_option(bufnr, "filetype", "harpoon") vim.api.nvim_buf_set_option(bufnr, "filetype", "harpoon")
vim.keymap.set( vim.keymap.set("n", "q", function()
"n", M.run_toggle_command("q")
"q", end, { buffer = bufnr, silent = true })
function() M.run_toggle_command("q") end,
{ buffer = bufnr, silent = true }
)
vim.keymap.set( vim.keymap.set("n", "<Esc>", function()
"n", M.run_toggle_command("Esc")
"<Esc>", end, { buffer = bufnr, silent = true })
function() M.run_toggle_command("Esc") end,
{ buffer = bufnr, silent = true }
)
vim.keymap.set( vim.keymap.set("n", "<CR>", function()
"n", M.run_select_command()
"<CR>", end, { buffer = bufnr, silent = true })
function() M.run_select_command() end,
{ buffer = bufnr, silent = true }
)
vim.api.nvim_create_autocmd({ "BufWriteCmd" }, { vim.api.nvim_create_autocmd({ "BufWriteCmd" }, {
group = HarpoonGroup, group = HarpoonGroup,

View File

@ -59,7 +59,7 @@ local function read_data()
local out_data = path:read() local out_data = path:read()
if not out_data or out_data == '' then if not out_data or out_data == "" then
write_data({}) write_data({})
out_data = path:read() out_data = path:read()
end end

View File

@ -100,7 +100,10 @@ end
---@return HarpoonList ---@return HarpoonList
function HarpoonList:removeAt(index) function HarpoonList:removeAt(index)
if self.items[index] then if self.items[index] then
Logger:log("HarpoonList:removeAt", { item = self.items[index], index = index }) Logger:log(
"HarpoonList:removeAt",
{ item = self.items[index], index = index }
)
Listeners.listeners:emit( Listeners.listeners:emit(
Listeners.event_names.REMOVE, Listeners.event_names.REMOVE,
{ list = self, item = self.items[index], idx = index } { list = self, item = self.items[index], idx = index }

View File

@ -51,7 +51,7 @@ function HarpoonLog:log(...)
table.insert(self.lines, table.concat(lines, " ")) table.insert(self.lines, table.concat(lines, " "))
while #self.lines > self.max_lines do while #self.lines > self.max_lines do
table.remove(self.lines, 1) table.remove(self.lines, 1)
end end
end end

View File

@ -14,8 +14,8 @@ describe("harpoon", function()
end) end)
it("new lines with vim.inspect get removed too", function() it("new lines with vim.inspect get removed too", function()
Logger:log({hello = "world", world = "hello"}) Logger:log({ hello = "world", world = "hello" })
eq({ "{ hello = \"world\", world = \"hello\" }" }, Logger.lines) eq({ '{ hello = "world", world = "hello" }' }, Logger.lines)
end) end)
it("max lines", function() it("max lines", function()
@ -25,6 +25,4 @@ describe("harpoon", function()
Logger:log("two") Logger:log("two")
eq({ "two" }, Logger.lines) eq({ "two" }, Logger.lines)
end) end)
end) end)