Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Option to fix window width of pads #216

Open
AlphabetsAlphabets opened this issue Mar 25, 2023 · 5 comments
Open

Feature request: Option to fix window width of pads #216

AlphabetsAlphabets opened this issue Mar 25, 2023 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed need investigation When an issue lack context/is not straight forward to solve

Comments

@AlphabetsAlphabets
Copy link

Describe the problem

When the two pads show up (or one) to center the content on the screen, I would be nice if the user could optionally configure it to have fixed widths.

The reason I think this is nice is because when I open up a horizontal split and would either maximize the top or bottom split. I sometimes want to look at both of them at the same time again, I would use <C-w>=. But that also resizes width of the pads.

Describe the solution

In the setup function there could be fixwidth = true in buffers.

    buffers = {
      right = {
        enabled = false,
      },
    },

Or it could be for left and right as well. Having this set would just set the winfixedwidth option for the left and right buffers.

@shortcuts shortcuts added enhancement New feature or request help wanted Extra attention is needed need investigation When an issue lack context/is not straight forward to solve labels Mar 25, 2023
@shortcuts
Copy link
Owner

hey, thanks for the suggestion! I wonder if this is applicable as (IIRC) there's no events to listen to for a window resize, but definitely worth investigating!

@AlphabetsAlphabets
Copy link
Author

hey, thanks for the suggestion! I wonder if this is applicable as (IIRC) there's no events to listen to for a window resize, but definitely worth investigating!

I'm not sure what the code is like under the hood but is there a need to listen for a window resize event? If I move to the buffers created by the plugin and manually type :set wfw I can use <C-w>= as much as I want, and the buffer with wfw set won't change in size.

@shortcuts
Copy link
Owner

If I move to the buffers created by the plugin and manually type :set wfw I can use = as much as I want, and the buffer with wfw set won't change in size.

That is interesting, I assume providing the wo option to the side buffers would be enough, as we forward any bo or wo options, something like:

require("no-neck-pain").setup({
    width = 70,
    buffers = {
        wo = {
            winfixwidth = true,
        },
    },
})

but IIRC it gets overridden if you open a vsplit.


Could you share the full set of command you'd apply and the expect behavior? So that I can both see if it's doable, and provide a test suite :)

@AlphabetsAlphabets
Copy link
Author

AlphabetsAlphabets commented Mar 27, 2023

but IIRC it gets overridden if you open a vsplit.

Looks like you're right, I didn't think about this. I'd have to use :set wfw each time the pads disappear.

I assume providing the wo option to the side buffers would be enough, as we forward any bo or wo options, something like:

If that's the case that should be good right?

Could you share the full set of command you'd apply and the expect behavior? So that I can both see if it's doable, and provide a test suite :)

In my case I only have the left pad open so

  1. I move to it <C-w>h
  2. Then fix its width with :set wfw.
  3. Go back to the file I was on <C-w>l
  4. Make a few horizontal splits, maximize one of them. Then use <C-w>= to make all the windows equal. What should happen is that every window will resize except for the pads.

@AlphabetsAlphabets
Copy link
Author

Hey @shortcuts I completely forgot about this, I was wondering if you have the time to look at this again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed need investigation When an issue lack context/is not straight forward to solve
Projects
None yet
Development

No branches or pull requests

2 participants