Let's take undodir as an example; we might have something like this in our vimrc:

set undodir=$HOME/.config/nvim/undo/

In order to make config platform-agnostic one might want to use variables instead, eg

let conf_dir = stdpath('config')
set undodir=conf_dir.'/undo/'    " this is problematic

The above example doesn't work - conf_dir variable is not expanded as expected.

  • 1
    Does this answer your question? vi.stackexchange.com/questions/21392/…
    – D. Ben Knoble
    Jul 30 at 12:46
  • @3N4N please don’t post answers in comments. And OP, please don’t edit answers into questions. Answers always belong in the answers section where they can be voted on.
    – D. Ben Knoble
    Jul 30 at 12:47
  • @D.BenKnoble it felt wrong to me as well, but how should I behave in this circumstance? "steal" the answer and post it myself? Ignore the comment altogether and wait 'til someone forms an answer reply? And yes, my question could be marked as dupe of the link you provided.
    – laur
    Jul 30 at 13:34
  • @laur I would encourage answer-in-comment posters to answer in answers. If it doesn’t happen in a day or two, self-answer. If you feel you’ve stolen the answer, you could community wiki it, but that’s a personal choice and I don’t even have a hard and fast rule for when I CW answers.
    – D. Ben Knoble
    Jul 31 at 15:56


Browse other questions tagged or ask your own question.