Skip to content

Instantly share code, notes, and snippets.

@jettero
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save jettero/4c8ef42b471c902b19bc to your computer and use it in GitHub Desktop.

Select an option

Save jettero/4c8ef42b471c902b19bc to your computer and use it in GitHub Desktop.
Got tired of having all those swap files in the current dir and having them sync over Dropbox or show up in git tracking GUI windows and things
" … blah …
" WARNING: There are probably security problems with using /tmp/ for this!!! \o/
" If this directory isn't owned by the current user and not world writable,
" it's highly likely nefarious evildoers could elite haxx into your vim
" memories through the swap files. (… project for later …)
" (:-2 to remove end of line)
" &g:directory is the global option directory
" let &g:directory="poo" is roughly equiv to set dir=poo
let &g:directory='/tmp/vim-swap.' . system('id -u')[:-2] . "," . $HOME . "/.swap-vim"
for dir in split(&g:directory, ",")
if isdirectory(dir) == 0
:exec "silent !mkdir -p " . dir
endif
endfor
" … blah …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment