1

Occasionally I would like to override my standard nvim configuration, for example, to tell it not to load vimtex's folding configuration for a very large or complicated tex file for which I don't need folding. For this, I would like to type something like

nvim --someOption="let g:vimtex_fold_enabled = 0"

and have it override the line let g:vimtex_fold_enabled = 1 in my plugin/vimtex.vim file (and have it do so in time so that vimtex loads with the appropriate configuration).

Is there an easy way to do this? Or is there some other way to achieve the same goal (which is basically to tweak my standard configuration on an ad hoc basis when I choose, without changing the standard configuration for all other files). Note: I don't think the filetype-specific configuration will help in this case because I want to be able to have different configurations even when the filetype is the same -- or even to load the same file in different circumstances with a different configuration.

1 Answer 1

2

You could use the --cmd flag:

nvim --cmd "let g:vimtex_fold_enabled=0"

Alternatively you could define an environment variable and use it in your configuration file.

2
  • 1
    Thanks! This is exactly what I was missing. This doesn't actually do what I was trying to do (i.e., my particular use case), but I suspect it is because of when this command is executed (probably before vimtex queries these global variables and sets up the buffer's specific configuration). But now I know how to do this, which for many cases will be a great help. Apr 9, 2023 at 21:44
  • Thanks for the feedback :-) Apr 10, 2023 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.