1

There is an old question here about best practices to store swap files, and there is an answer by flemingfleming (who haven't visited the site since 2018) where he suggested the following:

set directory^=$HOME/.vim/swap//

For what reason is the ^ character is used there?

Yes, I know I can open :h set, but I simply don't understand.

:se[t] {option}^={value}              *:set^=*
          Multiply the {value} to a number option, or prepend
          the {value} to a string option.  When the option is a
          comma-separated list, a comma is added, unless the
          value was empty.
          Also see |:set-args| above.
muru
  • 24,838
  • 8
  • 82
  • 143
john c. j.
  • 309
  • 3
  • 21

1 Answers1

5

As help states:

or prepend the {value} to a string option.

Option directory is a string, so if you have set directory=path1,path2 and then do set directory^=path0, result directory would be path0,path1,path2.

KRyan
  • 264
  • 1
  • 7
Maxim Kim
  • 13,376
  • 2
  • 18
  • 46