stevearc / stickybuf.nvim

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

Having more than one pinned buffer causes the new window to open in a small split with a fixed width #10

Closed ten3roberts closed 1 year ago

ten3roberts commented 1 year ago

Screenshot 2023-03-20 at 13 47 50

The terminal to the right is pinned, as well as the aerial buffer.

Opening a buffer in the terminal buffer causes the window to open/split in the aerial buffer. The resulting small window has winfixwidth=1, most likely because it replaces the aerial window, which opened anew.

Screenshot 2023-03-20 at 13 47 58

stevearc commented 1 year ago

I couldn't get your exact issue to reproduce, but I think that's likely because of slightly different settings for aerial. I was able to produce some bad behavior that I would believe is the cause of this issue. I've pushed up a fix, can you check if that takes care of your problem?

ten3roberts commented 1 year ago

Thank you. It seems to work now, and will be of great use for my task management plugin having a "fixed" terminal window.

Just for future reference, here's my Aerial config

return {

  "stevearc/aerial.nvim",
  keys = { { "<leader>po", "<cmd>AerialOpen<CR>" }, { "<leader>pp", "<cmd>AerialToggle!<CR>" } },
  event = "BufWinEnter",
  config = function()
    local aerial = require "aerial"
    aerial.setup {
      -- backends = { "treesitter", "lsp", "markdown" },
      -- on_attach = function(bufnr)
      --   vim.keymap.set("n", "[[", aerial.prev, { buffer = bufnr })
      --   vim.keymap.set("n", "]]", aerial.next, { buffer = bufnr })
      -- end,
      layout = {

        -- The maximum width of the aerial window
        max_width = { 20, 0.2 },
        placement = "edge",
        default_direction = "prefer_left",
      },

      attach_mode = "global",

      -- default_bindings = true,

      -- Use symbol tree for folding. Set to true or false to enable/disable
      -- 'auto' will manage folds if your previous foldmethod was 'manual'
      -- manage_folds = false,

      -- Automatically open aerial when entering supported buffers.
      -- This can be a function (see :help aerial-open-automatic)
      open_automatic = function(_)
        return not vim.o.diff
      end,

      -- close_automatic_events = { "unsupported" },

      -- Run this command after jumping to a symbol (false will disable)
      post_jump_cmd = "normal! zz",

      -- -- Show box drawing characters for the tree hierarchy
      show_guides = true,
    }
  end,
}