stevearc / stickybuf.nvim

Neovim plugin for locking a buffer to a window
MIT License
246 stars 7 forks source link

Execute a callback after opening new buffer #8

Closed pharaok closed 1 year ago

pharaok commented 1 year ago

I'm using stickybuf with toggleterm, which sets some window options that stay with the newly opened buffer, so I would like a way to reset them.

Example:

require("stickybuf").pin_filetype(false, function()
  vim.wo.winhighlight = ""
  vim.wo.number = vim.go.number
  vim.wo.relativenumber = vim.go.relativenumber
end)
stevearc commented 1 year ago

I've added this by means of the restore_callback option on the stickybuf.pin function. See the API docs for details