Skip to content

Commit

Permalink
Better (?) location for transient files
Browse files Browse the repository at this point in the history
Closes #22.
  • Loading branch information
tpope committed Jan 20, 2013
1 parent 6083bf4 commit 6c1ed9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ mostly `:set` calls.) Here's a taste:
* `'incsearch'`: Start searching before pressing enter.
* `'listchars'`: Makes `:set list` (visible whitespace) prettier.
* `'scrolloff'`: Always show at least one line above/below the cursor.
* `'directory'`: Dump swap files under `~/.cache/vim/swap` (only if that
directory already exists). Also `'backupdir'` and `'undodir'`. Try
`mkdir -p ~/.cache/vim/{swap,backup,undo}`.
* `'directory'`: Dump swap files under `~/.local/share/vim/swap`,
`~/Library/Vim/swap`, or `~\Application Data\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`.
* `runtime! macros/matchit.vim`: Load the version of matchit.vim that ships
with Vim.
Expand Down
9 changes: 5 additions & 4 deletions plugin/sensible.vim
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,16 @@ if &history < 1000
endif
set viminfo^=!

if isdirectory(expand('~/.cache/vim'))
let s:dir = has('win32') ? '~/Application Data/Vim' : has('mac') ? '~/Library/Vim' : '~/.local/share/vim'
if isdirectory(expand(s:dir))
if &directory =~# '^\.,'
set directory^=~/.cache/vim/swap//
let &directory = s:dir . '/swap//,'
endif
if &backupdir =~# '^\.,'
set backupdir^=~/.cache/vim/backup//
let &backupdir = s:dir . '/backup//,'
endif
if exists('+undodir') && &undodir =~# '^\.\%(,\|$\)'
set undodir^=~/.cache/vim/undo//
let &undodir = s:dir . '/undo//,'
endif
endif
if exists('+undofile')

This comment has been minimized.

Copy link
@sheerun

sheerun Jan 20, 2013

Are you sure you want to enable this feature if the only existent undodir is . ?
Maybe move it into if isdirectory(expand(s:dir)) statement.

This comment has been minimized.

Copy link
@tpope

tpope Jan 21, 2013

Author Owner

Yes, I'm sure, same as last time you asked. Set up a global git ignore.

Expand Down

5 comments on commit 6c1ed9b

@sheerun
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My vim installation began to create undo files in project directory. Do I need to create ~/Library/Vim manually again?

Last time I needed to create ~/.cache/vim/undo directory for this feature to work properly.

@tpope
Copy link
Owner Author

@tpope tpope commented on 6c1ed9b Jan 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you do.

@kwbr
Copy link

@kwbr kwbr commented on 6c1ed9b Jan 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason to move the transient files from ~/.cache to ~/.local/share/vim?

@teranex
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kwbr
Copy link

@kwbr kwbr commented on 6c1ed9b Jan 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@teranex thanks

Please sign in to comment.