anuvyklack / windows.nvim

Automatically expand width of the current window. Maximizes and restore it. And all this with nice animations!
MIT License
531 stars 14 forks source link

Autowidth is troublesome with plugins like diffview #10

Open Raekh opened 2 years ago

Raekh commented 2 years ago

Some plugins do not necessarily create entire filetypes or buftypes, making it difficult to accurately pinpoint situations where we don't want the plugin to change that. Such example is easily seen with diffview.

smjonas commented 2 years ago

I know this doesn't really solve the underlying issue but I think specifying a custom filetype is good practice for plugins and the author of diffview should also add this.

cwqt commented 2 years ago

I'm bodging my way around this specific issue with:

  function DiffviewToggle()
    local lib = require("diffview.lib")

    local view = lib.get_current_view()
    if view then
      -- Current tabpage is a Diffview; close it
      vim.cmd(":DiffviewClose")
      vim.cmd(":WindowsEnableAutowidth")
    else
      -- No open Diffview exists: open a new one
      vim.cmd(":WindowsDisableAutowidth")
      vim.cmd(":DiffviewOpen")
    end
  end

  map("n", "<leader>df", ":lua DiffviewToggle()<CR>")
andoArbST commented 2 years ago

I get a similar issue with toggleterm :|

nvim freaks out

great plugin though

d-3nnis commented 1 year ago

I'm also experiencing problems with toggleterm. It's a really cool plugin so I hope this gets fixed.

anuvyklack commented 1 year ago

I will, but now I'm busy