On 5/17/2013 1:56 AM, Gary Johnson wrote:
On 2013-05-16, ping wrote:
On 5/16/2013 7:28 PM, tooth pik wrote:
one thing I've found helpful in different circumstances is to set the
'directory' option in my .vimrc to a single known folder (~/.vim-tmp)
-- that way all swap files are created in the same place, facilitating
both recovery and scripting -- I like to make sure there are no
swapfiles before starting an extensive session
that sounds a good idea, but what will happen if you have two files
in different folders have the same name?
will VIM associate each file with a different swap file name without
confusion?
You can specify 'directory' such that there are no name collisions.
See
:help 'directory'
There it explains that
- For Unix and Win32, if a directory ends in two path separators "//"
or "\\", the swap file name will be built from the complete path to
the file with all path separators substituted to percent '%' signs.
This will ensure file name uniqueness in the preserve directory.
On Win32, when a separating comma is following, you must use "//",
since "\\" will include the comma in the file name.
For example, this is how I set 'directory' in my ~/.vimrc:
if has("win32")
set directory=~/tmp/vimswap//,$TMP//,$TEMP//
elseif has("unix")
set directory=~/tmp/vimswap//,~/.vimswap//,~/tmp//,/var/tmp//,/tmp//
else
set directory-=.
endif
I don't know what OS I would ever use other than Windows or Unix,
but I don't want to ever create a swap file in any directory other
than one I've chosen for that purpose. Doing so would change the
modification time of the directory even though I may not have made
any other changes to it.
Regards,
Gary
thanks Gary, that looks nice and self-adaptive
I found another one here:
https://github.com/docwhat/homedir-vim/blob/master/vimrc/.vimrc
it looks more complex, do you think it is good ?
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.