mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
feat: makefile + acwrite.
This commit is contained in:
parent
fa73cd0c33
commit
34d2e6be9a
3
Makefile
3
Makefile
@ -8,7 +8,6 @@ lint:
|
||||
|
||||
test:
|
||||
echo "===> Testing"
|
||||
nvim --headless -c "PlenaryBustedDirectory lua/harpoon/test"
|
||||
|
||||
nvim --headless -c "PlenaryBustedDirectory lua/harpoon/test"
|
||||
|
||||
pr-ready: fmt lint test
|
||||
|
@ -48,6 +48,7 @@ function M.setup_autocmds_and_keymaps(bufnr)
|
||||
vim.api.nvim_set_option_value("filetype", "harpoon", {
|
||||
buf = bufnr,
|
||||
})
|
||||
vim.api.nvim_set_option_value("buftype", "acwrite", { buf = bufnr })
|
||||
vim.keymap.set("n", "q", function()
|
||||
M.run_toggle_command("q")
|
||||
end, { buffer = bufnr, silent = true })
|
||||
|
@ -5,10 +5,12 @@ local harpoon = require("harpoon")
|
||||
local eq = assert.are.same
|
||||
local be = utils.before_each(os.tmpname())
|
||||
|
||||
--[[
|
||||
local function key(k)
|
||||
k = vim.api.nvim_replace_termcodes(k, true, false, true)
|
||||
vim.api.nvim_feedkeys(k, "m", false)
|
||||
end
|
||||
--]]
|
||||
|
||||
describe("harpoon", function()
|
||||
before_each(function()
|
||||
@ -21,20 +23,16 @@ describe("harpoon", function()
|
||||
|
||||
local bufnr = harpoon.ui.bufnr
|
||||
local win_id = harpoon.ui.win_id
|
||||
local border_win_id = harpoon.ui.border_win_id
|
||||
|
||||
eq(vim.api.nvim_buf_is_valid(bufnr), true)
|
||||
eq(vim.api.nvim_win_is_valid(win_id), true)
|
||||
eq(vim.api.nvim_win_is_valid(border_win_id), true)
|
||||
|
||||
harpoon.ui:toggle_quick_menu()
|
||||
|
||||
eq(vim.api.nvim_buf_is_valid(bufnr), false)
|
||||
eq(vim.api.nvim_win_is_valid(win_id), false)
|
||||
eq(vim.api.nvim_win_is_valid(border_win_id), false)
|
||||
eq(harpoon.ui.bufnr, nil)
|
||||
eq(harpoon.ui.win_id, nil)
|
||||
eq(harpoon.ui.border_win_id, nil)
|
||||
end)
|
||||
|
||||
it("delete file from ui contents and save", function()
|
||||
|
@ -12,10 +12,9 @@ local function toggle_config(config)
|
||||
return vim.tbl_extend("force", {
|
||||
ui_fallback_width = 69,
|
||||
ui_width_ratio = 0.62569,
|
||||
}, config)
|
||||
}, config or {})
|
||||
end
|
||||
|
||||
|
||||
---@class HarpoonUI
|
||||
---@field win_id number
|
||||
---@field bufnr number
|
||||
@ -102,7 +101,9 @@ function HarpoonUI:_create_window(toggle_opts)
|
||||
})
|
||||
|
||||
if win_id == 0 then
|
||||
Logger:log("ui#_create_window failed to create window, win_id returned 0")
|
||||
Logger:log(
|
||||
"ui#_create_window failed to create window, win_id returned 0"
|
||||
)
|
||||
self.bufnr = bufnr
|
||||
self:close_menu()
|
||||
error("Failed to create window")
|
||||
|
Loading…
x
Reference in New Issue
Block a user