Change Vim swap/backup/undo file name

I have this in my .vimrc and it names the swap files with full path names and percent signs just as you describe:

" Store swap files in fixed location, not current directory.
set dir=~/.vimswap//,/var/tmp//,/tmp//,.

The key is the // at the end of the directories. See this note from :help dir:

  • For Unix and Win32, if a directory ends in two path separators "//"
    or "\\", the swap file name will be built from the complete path to
    the file with all path separators substituted to percent ‘%’ signs.
    This will ensure file name uniqueness in the preserve directory.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)