3 ms·
You can set a few variables to change where these files go: • 'directory' controls where swap files go, toggled by 'swapfile' (default on), filenames like […].
by chrismorgan 6y ago
You can set a few variables to change where these files go:
• 'directory' controls where swap files go, toggled by 'swapfile' (default on), filenames like […].swp; ~/.cache/vim/swap// is a good choice.
• 'undodir' controls where undo files go, toggled by 'undofile' (default off), filenames […].un~; ~/.cache/vim/undo// is a good choice.
• 'backupdir' controls where backup files go, toggled by 'backup' (default off), filename […]~; ~/.cache/vim/backup// is an interesting choice.
Arch Linux actually ships a runtime file that sets these paths, creating the directories if they don’t exist: https://github.com/archlinux/svntogit-packages/blob/packages/vim/trunk/archlinux.vim https://github.com/archlinux/svntogit-packages/blob/packages....
(Note that the double trailing slashes are significant and necessary if you’re using a central location for these files. Refer to the help for explanation.)