Skip to content

Add separated option to set formatting column limit#348

Open
myl7 wants to merge 2 commits into
vim-autoformat:masterfrom
myl7:columnlimit
Open

Add separated option to set formatting column limit#348
myl7 wants to merge 2 commits into
vim-autoformat:masterfrom
myl7:columnlimit

Conversation

@myl7

@myl7 myl7 commented Apr 26, 2021

Copy link
Copy Markdown
Contributor

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

chtenb commented Apr 26, 2021

Copy link
Copy Markdown
Member

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

Comment thread plugin/defaults.vim
endif

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

Copy link
Copy Markdown
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

chtenb commented Apr 26, 2021

Copy link
Copy Markdown
Member

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.

2 participants