diff --git a/lua/harpoon/buffer.lua b/lua/harpoon/buffer.lua index d038781..95eae4e 100644 --- a/lua/harpoon/buffer.lua +++ b/lua/harpoon/buffer.lua @@ -49,26 +49,17 @@ function M.setup_autocmds_and_keymaps(bufnr) end vim.api.nvim_buf_set_option(bufnr, "filetype", "harpoon") - vim.keymap.set( - "n", - "q", - function() M.run_toggle_command("q") end, - { buffer = bufnr, silent = true } - ) + vim.keymap.set("n", "q", function() + M.run_toggle_command("q") + end, { buffer = bufnr, silent = true }) - vim.keymap.set( - "n", - "", - function() M.run_toggle_command("Esc") end, - { buffer = bufnr, silent = true } - ) + vim.keymap.set("n", "", function() + M.run_toggle_command("Esc") + end, { buffer = bufnr, silent = true }) - vim.keymap.set( - "n", - "", - function() M.run_select_command() end, - { buffer = bufnr, silent = true } - ) + vim.keymap.set("n", "", function() + M.run_select_command() + end, { buffer = bufnr, silent = true }) vim.api.nvim_create_autocmd({ "BufWriteCmd" }, { group = HarpoonGroup, diff --git a/lua/harpoon/data.lua b/lua/harpoon/data.lua index c23f40c..2efd193 100644 --- a/lua/harpoon/data.lua +++ b/lua/harpoon/data.lua @@ -59,7 +59,7 @@ local function read_data() local out_data = path:read() - if not out_data or out_data == '' then + if not out_data or out_data == "" then write_data({}) out_data = path:read() end diff --git a/lua/harpoon/list.lua b/lua/harpoon/list.lua index 0c5c281..8cfefd6 100644 --- a/lua/harpoon/list.lua +++ b/lua/harpoon/list.lua @@ -100,7 +100,10 @@ end ---@return HarpoonList function HarpoonList:removeAt(index) 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.event_names.REMOVE, { list = self, item = self.items[index], idx = index } diff --git a/lua/harpoon/logger.lua b/lua/harpoon/logger.lua index 9fd5fcc..aff979b 100644 --- a/lua/harpoon/logger.lua +++ b/lua/harpoon/logger.lua @@ -51,7 +51,7 @@ function HarpoonLog:log(...) 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) end end diff --git a/lua/harpoon/test/logger_spec.lua b/lua/harpoon/test/logger_spec.lua index d97054d..486569d 100644 --- a/lua/harpoon/test/logger_spec.lua +++ b/lua/harpoon/test/logger_spec.lua @@ -14,8 +14,8 @@ describe("harpoon", function() end) it("new lines with vim.inspect get removed too", function() - Logger:log({hello = "world", world = "hello"}) - eq({ "{ hello = \"world\", world = \"hello\" }" }, Logger.lines) + Logger:log({ hello = "world", world = "hello" }) + eq({ '{ hello = "world", world = "hello" }' }, Logger.lines) end) it("max lines", function() @@ -25,6 +25,4 @@ describe("harpoon", function() Logger:log("two") eq({ "two" }, Logger.lines) end) - end) -