O Vim (e por extensão, o GVim) possui arquivos de troca, que geralmente são criados no mesmo diretório que o arquivo, mas também podem ser colocados em um único diretório comum. Os arquivos de swap estão ativados por padrão e, para configurar o local, consulte :h 'directory
:
'directory' 'dir'
'directory' 'dir' string (default for Amiga: ".,t:",
for MS-DOS and Win32: ".,$TEMP,c:\tmp,c:\temp"
for Unix: ".,~/tmp,/var/tmp,/tmp")
global
List of directory names for the swap file, separated with commas.
- The swap file will be created in the first directory where this is
possible.
- Empty means that no swap file will be used (recovery is
impossible!).
- A directory "." means to put the swap file in the same directory as
the edited file. On Unix, a dot is prepended to the file name, so
it doesn't show in a directory listing. On MS-Windows the "hidden"
attribute is set and a dot prepended if possible.
- A directory starting with "./" (or ".\" for MS-DOS et al.) means to
put the swap file relative to where the edited file is. The leading
"." is replaced with the path name of the edited file.
- 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.
Então, no seu ~/.vimrc
, adicione:
set directory^=/path/to/swapfiles
E certifique-se de que /path/to/swapfiles
exista.