chore: style

This commit is contained in:
mpaulson 2023-11-30 20:14:10 -07:00
parent 047cd66d6f
commit 574a642204
8 changed files with 21 additions and 25 deletions

View File

@ -1,4 +1,2 @@
local augroup = vim.api.nvim_create_augroup
return augroup("Harpoon", {})

View File

@ -21,8 +21,7 @@ end
---@param bufnr number
function M.setup_autocmds_and_keymaps(bufnr)
local curr_file = vim.api.nvim_buf_get_name(0)
local cmd =
string.format(
local cmd = string.format(
"autocmd Filetype harpoon "
.. "let path = '%s' | call clearmatches() | "
-- move the cursor to the line containing the current filename
@ -90,7 +89,7 @@ function M.setup_autocmds_and_keymaps(bufnr)
vim.schedule(function()
require("harpoon").ui:toggle_quick_menu()
end)
end
end,
})
vim.api.nvim_create_autocmd({ "BufLeave" }, {
@ -98,7 +97,7 @@ function M.setup_autocmds_and_keymaps(bufnr)
pattern = "__harpoon*",
callback = function()
require("harpoon").ui:toggle_quick_menu()
end
end,
})
end

View File

@ -3,7 +3,6 @@ local function normalize_path(buf_name)
return Path:new(buf_name):make_relative(vim.loop.cwd())
end
local M = {}
---@alias HarpoonListItem {value: any, context: any}
@ -133,7 +132,11 @@ function M.get_default_config()
-- path, if that is the case we can use the context to
-- store the bufname and then have value be the normalized
-- value
or normalize_path(vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()))
or normalize_path(
vim.api.nvim_buf_get_name(
vim.api.nvim_get_current_buf()
)
)
local bufnr = vim.fn.bufnr(name, false)

View File

@ -26,7 +26,6 @@ function M.set_data_path(path)
end
local function has_keys(t)
-- luacheck: ignore 512
for _ in pairs(t) do
return true

View File

@ -50,7 +50,6 @@ function Harpoon:setup(partial_config)
---TODO: should we go through every seen list and update its config?
if self.hooks_setup == false then
vim.api.nvim_create_autocmd({ "BufLeave", "VimLeavePre" }, {
group = HarpoonGroup,
pattern = "*",
@ -145,5 +144,3 @@ function Harpoon:__debug_reset()
end
return Harpoon:new()

View File

@ -72,7 +72,6 @@ describe("harpoon", function()
eq(list:length(), 3)
eq(created_files, list:display())
end)
it("using :q to leave harpoon should quit everything", function()
@ -85,12 +84,11 @@ describe("harpoon", function()
eq(vim.api.nvim_win_is_valid(win_id), true)
eq(vim.api.nvim_get_current_buf(), bufnr)
vim.cmd [[ q! ]] -- TODO: I shouldn't need q! here
vim.cmd([[ q! ]]) -- TODO: I shouldn't need q! here
eq(vim.api.nvim_buf_is_valid(bufnr), false)
eq(vim.api.nvim_win_is_valid(win_id), false)
eq(harpoon.ui.bufnr, nil)
eq(harpoon.ui.win_id, nil)
end)
end)

View File

@ -39,7 +39,10 @@ function HarpoonUI:close_menu()
vim.api.nvim_win_close(self.win_id, true)
end
if self.border_win_id ~= nil and vim.api.nvim_win_is_valid(self.border_win_id) then
if
self.border_win_id ~= nil
and vim.api.nvim_win_is_valid(self.border_win_id)
then
vim.api.nvim_win_close(self.border_win_id, true)
end

View File

@ -1,4 +1,3 @@
local M = {}
function M.is_white_space(str)