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

Follow textwidth (tw) #155

Closed
4e554c4c opened this issue Jan 29, 2023 · 5 comments · Fixed by #156
Closed

Follow textwidth (tw) #155

4e554c4c opened this issue Jan 29, 2023 · 5 comments · Fixed by #156
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

@4e554c4c
Copy link

Describe the problem

Currently the width of no-neck-pain has to be specified globally. However, I use several different languages and projects, each with different width standards. For example, Lean projects usually like to have a maximum text width of 100 characters. C projects usually stick to 80 characters, and so does my personal writing.
I keep track of all of these with the 'texwidth' variable.

Describe the solution

There should be an option for no-neck-pain.nvim to follow the texwidth variable instead of simply following a global width.

@shortcuts shortcuts added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jan 29, 2023
@shortcuts
Copy link
Owner

Hey! Thanks for opening the issue :D

This seems pretty feasible, I just need to find a correct API to expose. Would you mind explaining how you use this option?

  • Do you define it every time you open Nvim, or is it defined at your config level?
  • Would you expect the width to exactl match the textwidth?

@shortcuts
Copy link
Owner

#156 should cover this issue, waiting for some more insights from you on the two questions above before merging

@4e554c4c
Copy link
Author

Hi! thanks for working on this.

Usually I have textwidth defined in ftplugins, so it isn't always defined on nvim startup. For example consider

  1. you open nvim src/file.c, so tw=80.
  2. you decide some documentation fixes are necessary, so you :e README.md with a modeline of vim: tw=90.

Because it needs to be different for different kinds of buffers, I'm not sure if this option can be set in the setup function (like in #156).

Regarding whether tw=width exactly.... that's a good question. I think it depends on filetype. e.g. for programming languages I would probably want the width to be 10 chars or so more than tw (so you can see the beginning of non-wrapped text). But this is not a requirement for this issue.

shortcuts added a commit that referenced this issue Jan 31, 2023
## 📃 Summary

Kind of provides an escape hatch for things like
#155

This PR provides a new `NoNeckPainResize` command, that updates the
width of the main buffer and triggers a resize of the windows. This can
be useful when switching context and the user don't want to update the
`setup` method.
@shortcuts
Copy link
Owner

Thanks for giving more details! I guess this will need a bit of investigation of what to do for a full support.

I've exposed a resize command that should suit your need for the short term, however there should be a better solution!

@shortcuts shortcuts added need investigation When an issue lack context/is not straight forward to solve and removed good first issue Good for newcomers in progress When an issue is being working on labels Jan 31, 2023
shortcuts added a commit that referenced this issue Feb 3, 2023
## 📃 Summary

closes #155

This PR provides additional accepted values to the `width` option, in
order to let the user default the width of the main focused window based
on vim options.
@shortcuts
Copy link
Owner

I still added support for textwidth and colorcolumn as it provides some great benefits to make usage more consistent across different file types, along with the resize command it should cover a lot of use cases.

I'll now work on providing an option the user can enable to resize when the filetype changes, so the plugin would adapt to the two options

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

Successfully merging a pull request may close this issue.

2 participants