From 41499a576736069d807c86368a745dd8795cce2f Mon Sep 17 00:00:00 2001 From: Dan Grover Date: Sat, 9 Mar 2013 00:54:26 -0800 Subject: [PATCH] Set correct AppData dir for more Windows versions Replace the hard-coded path with an environment variable supported by all versions of Windows since XP. --- README.markdown | 4 ++-- plugin/sensible.vim | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index e79a694..2b667da 100644 --- a/README.markdown +++ b/README.markdown @@ -32,7 +32,7 @@ mostly `:set` calls.) Here's a taste: * `'listchars'`: Makes `:set list` (visible whitespace) prettier. * `'scrolloff'`: Always show at least one line above/below the cursor. * `'directory'`: Dump swap files under `~/.local/share/vim/swap`, - `~/Library/Vim/swap`, or `~\Application Data\Vim\swap`, depending on your + `~/Library/Vim/swap`, or `%APPDATA%\Vim\swap`, depending on your platform. Also `'backupdir'` and `'undodir'`. The directories aren't created automatically, so try `mkdir -p ~/Library/Vim/{swap,backup,undo}`. * `nmap Y y$`: Make `Y` behave like `C` and `D`. @@ -74,7 +74,7 @@ don't like them strewn all over the file system, you have a few options. * `~/.local/share/vim/undo` on Linux * `~/Library/Vim/undo` on OS X - * `~\Application Data\Vim\undo` on Windows + * `%APPDATA%\Vim\undo` on Windows 2. Provide your own preferred location in `'undodir'`: diff --git a/plugin/sensible.vim b/plugin/sensible.vim index 2d06095..1b4406a 100644 --- a/plugin/sensible.vim +++ b/plugin/sensible.vim @@ -72,7 +72,7 @@ if !empty(&viminfo) set viminfo^=! endif -let s:dir = has('win32') ? '~/Application Data/Vim' : match(system('uname'), "Darwin") > -1 ? '~/Library/Vim' : empty($XDG_DATA_HOME) ? '~/.local/share/vim' : '$XDG_DATA_HOME/vim' +let s:dir = has('win32') ? '$APPDATA/Vim' : match(system('uname'), "Darwin") > -1 ? '~/Library/Vim' : empty($XDG_DATA_HOME) ? '~/.local/share/vim' : '$XDG_DATA_HOME/vim' if isdirectory(expand(s:dir)) if &directory =~# '^\.,' let &directory = expand(s:dir) . '/swap//,' . &directory