Skip to content

Commit

Permalink
Persist terminal buffer across plugin reloads
Browse files Browse the repository at this point in the history
  • Loading branch information
itmecho committed Sep 27, 2024
1 parent 5389334 commit d77f01a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/neoterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ function neoterm.setup(opts)

config.width = width
config.height = height

if vim.g.neoterm_bufh ~= nil and vim.api.nvim_buf_is_valid(vim.g.neoterm_bufh) then
state.bufh = vim.g.neoterm_bufh
end
end

local function normalize_position(position)
Expand Down Expand Up @@ -127,6 +131,7 @@ function neoterm.open(opts)
local buf_created = false
if buf_is_valid() == false then
state.bufh = vim.api.nvim_create_buf(false, true)
vim.g.neoterm_bufh = state.bufh
buf_created = true
end

Expand Down

0 comments on commit d77f01a

Please sign in to comment.