You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pattern is useful because configuration variables irrelevant to the file type I'm handling are not set, and also I avoid executing every autocmd for every buffer I open.
However, the vim-black plugin does not read variables set in the local scope. Therefore, every time I open a buffer with filetype python, g:black_linelength is set. This could also give rise to conflicts in settings when files from different projects with different style conventions are open at the same time in different buffers.
Proposed solution
vim-black should provide support for configuration options at each appropriate scope level:
buffer-variable b: Local to the current buffer.
window-variable w: Local to the current window.
tabpage-variable t: Local to the current tab page.
global-variable g: Global.
Variables with the lowest scope should take precedence over others. For instance, if b:black_linelength is 120, but g:black_linelength is 79, Black should enforce line length 120.
Considered alternatives
N/A
If there is support for this I could try to put a PR together. (But be warned, my vimscript is even worse than my python ;)
The text was updated successfully, but these errors were encountered:
rpdelaney
changed the title
vim plugin should support buffer scoped configuration vars
vim plugin should support scoped configuration vars
Nov 28, 2019
Problem statement
I use files in
.vim/after/ftplugin
to set filetype specific settings in vim. For example:This pattern is useful because configuration variables irrelevant to the file type I'm handling are not set, and also I avoid executing every
autocmd
for every buffer I open.However, the vim-black plugin does not read variables set in the local scope. Therefore, every time I open a buffer with filetype python,
g:black_linelength
is set. This could also give rise to conflicts in settings when files from different projects with different style conventions are open at the same time in different buffers.Proposed solution
vim-black should provide support for configuration options at each appropriate scope level:
Variables with the lowest scope should take precedence over others. For instance, if
b:black_linelength
is 120, butg:black_linelength
is 79, Black should enforce line length 120.Considered alternatives
N/A
If there is support for this I could try to put a PR together. (But be warned, my vimscript is even worse than my python ;)
The text was updated successfully, but these errors were encountered: