change the temp directory in vim

vim Add bellow lines to vimrc file.

" store backup, undo, and swap files in temp directory
set directory=~\tmp
set backupdir=~\tmp
set undodir=~\tmp