let g:dartfmt_options
drexel-ue opened this issue · 9 comments
What is the correct use of this variable? And where should it be declared? I currently have it in a lone file that is being sourced in my init.vim. I'd like to increase the line length to 180. Not noticing this variable come into play. I've set it to both a string and a hashmap.
I use this option like so (note --fix is not required but I find it nice to have enabled):
let g:dartfmt_options = ['--fix', '-l 80']You can indeed call it in your vimrc/init.vim or what I do is I have it in my .vim/after/ftplugin/dart.vim which will get sourced any time you open a dart file
And I've put this version there which only sets it if it is not yet defined so I can override it for a project if I want:
if (!exists("g:dartfmt_options"))
let g:dartfmt_options = ['--fix', '-l 80']
endifOh that's super cool! I'll give it a go! what does the --fix flag bring to the table?
Very interesting. Though, it doesn't seem as though the variable is being respected
In dart.vim i have the variable defined:
if (!exists("g:dartfmt_options"))
let g:dartfmt_options = ['--fix', '-l 180']
endifand am sourcing it in init.vim: source $HOME/.config/nvim/plug-config/dart.vim
Maybe it's the if? i suppose it could just be defined somewhere else
You could check what the current value is after opening a dart file
But I don’t think it should exist yet when running your init.vim unless you’ve set it earlier already
You can see the content of that variable with :echo g:dartfmt_options.
I would expect to need to use ['-l', '80'] instead of ['-l 80'], however that argument also shouldn't be necessary since 80 is the default.
If you update to the latest version of this plugin you should be able to use :help g:dartfmt_options to see help about the format for this variable.