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

Add separated option to set formatting column limit #348

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

myl7
Copy link
Contributor

@myl7 myl7 commented Apr 26, 2021

textwidth's side effects (like forcing to wrap line) may be disliked by some developers.
A separated option for column limit helps developers to set it to a maybe more "modern" value, like 120.

@chtenb
Copy link
Member

chtenb commented Apr 26, 2021

That makes sense, but it shouldn't be a global variable, but rather a buffer local variable.

@@ -21,13 +21,17 @@ if !exists('g:autoformat_verbosemode')
let g:autoformat_verbosemode = 0
endif

if !exists('b:autoformat_columnlimit')
let b:autoformat_columnlimit = &textwidth
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work because this line is only executed on program start. Whenever a new buffer is opened this variable should be synced. However, I'm realizing now that this is a can of worms, since the textwidth can be manipulated by other scripts and it is unclear when it is safe to flush it to the columnlimit variable.

@chtenb
Copy link
Member

chtenb commented Apr 26, 2021

See my other inline comment. I think it is better to override textwidth with the columnlimit right before formatting and reset it afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants