Skip to content

Instantly share code, notes, and snippets.

@frangio
Created May 22, 2011 17:22
Show Gist options
  • Save frangio/985684 to your computer and use it in GitHub Desktop.
Save frangio/985684 to your computer and use it in GitHub Desktop.
Vim - Don't create swap files for files in the Dropbox folder (useful for folders shared with Windows people)
autocmd BufNewFile,BufRead *
\ if expand('%:~') =~ '^\~/Dropbox' |
\ set noswapfile |
\ else |
\ set swapfile |
\ endif
@skroon
Copy link

skroon commented Aug 15, 2016

http://vim.wikia.com/wiki/Remove_swap_and_backup_files_from_your_working_directory seems to have an alternative for storing the swap file in a different directory.

@joeytwiddle
Copy link

swapfile is local to the buffer, so I don't think re-enabling it is necessary. I am using this for now:

autocmd BufNewFile,BufRead {$HOME/Dropbox/*} setlocal noswapfile | let b:NoSwapSuck_NoSwapfile = 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment