mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
fix: some basic fixes for buffer type
This commit is contained in:
parent
a31438258a
commit
5a3195e7bf
@ -49,50 +49,26 @@ function M.setup_autocmds_and_keymaps(bufnr)
|
||||
end
|
||||
|
||||
vim.api.nvim_buf_set_option(bufnr, "filetype", "harpoon")
|
||||
vim.api.nvim_buf_set_option(bufnr, "buftype", "acwrite")
|
||||
vim.api.nvim_buf_set_option(bufnr, "bufhidden", "delete")
|
||||
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
bufnr,
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"q",
|
||||
"<Cmd>lua require('harpoon.buffer').run_toggle_command('q')<CR>",
|
||||
{ silent = true }
|
||||
)
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
bufnr,
|
||||
"n",
|
||||
"<ESC>",
|
||||
"<Cmd>lua require('harpoon.buffer').run_toggle_command('Esc')<CR>",
|
||||
{ silent = true }
|
||||
)
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
bufnr,
|
||||
"n",
|
||||
"<CR>",
|
||||
"<Cmd>lua require('harpoon.buffer').run_select_command()<CR>",
|
||||
{}
|
||||
function() M.run_toggle_command("q") end,
|
||||
{ buffer = bufnr, silent = true }
|
||||
)
|
||||
|
||||
-- TODO: Do we want this? is this a thing?
|
||||
-- its odd... why save on text change? shouldn't we wait until close / w / esc?
|
||||
--[[
|
||||
if global_config.save_on_change then
|
||||
vim.cmd(
|
||||
string.format(
|
||||
"autocmd TextChanged,TextChangedI <buffer=%s> lua require('harpoon').ui:save()",
|
||||
bufnr
|
||||
)
|
||||
)
|
||||
end
|
||||
--]]
|
||||
vim.api.nvim_create_autocmd("BufModifiedSet", {
|
||||
buffer = bufnr,
|
||||
group = HarpoonGroup,
|
||||
callback = function()
|
||||
vim.api.nvim_buf_set_option(bufnr, "modified", false)
|
||||
end,
|
||||
})
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<Esc>",
|
||||
function() M.run_toggle_command("Esc") end,
|
||||
{ buffer = bufnr, silent = true }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<CR>",
|
||||
function() M.run_select_command() end,
|
||||
{ buffer = bufnr, silent = true }
|
||||
)
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWriteCmd" }, {
|
||||
group = HarpoonGroup,
|
||||
|
@ -5,6 +5,11 @@ 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()
|
||||
be()
|
||||
|
@ -82,7 +82,8 @@ function HarpoonUI:_create_window()
|
||||
|
||||
local height = 8
|
||||
local borderchars = self.settings.border_chars
|
||||
local bufnr = vim.api.nvim_create_buf(false, false)
|
||||
local bufnr = vim.api.nvim_create_buf(false, true)
|
||||
-- TODO: Remove popup and just use nvim_open_win
|
||||
local _, popup_info = popup.create(bufnr, {
|
||||
title = "Harpoon",
|
||||
highlight = "HarpoonWindow",
|
||||
|
Loading…
x
Reference in New Issue
Block a user