Thursday, January 26, 2012

Re: swap file directory

On Jan 25, 12:29 pm, Damian Rodriguez Sanchez
<damian.sanc...@itautec.com> wrote:
> Hello,
>
> I stated to use a new computer where, as I expected for a default behaviour,
> swap files are created in the current directory on a given screen or window.
> But that happens only for the first file opened for a given screen or
> window. If I split the window (:sp or :vsp) and open different files on each
> split, those files will have their corresponding swap files created
> somewhere else (/var/tmp).
>
> I tried specifying a specific directory for swap file in my .vimrc inserting
> a line such as:
>
> set directory=~/.vim/swap_files//
>
> but it had effect only for the main file edited. Swap files for subsequent
> files edited on each split continue to be created on /var/tmp.
>
> Does anybody know what I have to do to have only one location for all swap
> files?
>

You shouldn't need to do anything special. By default Vim will create
the swap files in the same directory as the edited file, for all
files. If this is not working, then Vim either cannot write to the
directory containing the file for some reason, or your 'directory'
option is being changed by some autocmd or plugin without your
knowing. Try using :verbose set directory? to see what it is set to
and from where when you discover that your swap file is not being
written where you expect. Also check that you have permissions to
create files in the directory you're editing files in.

--
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

No comments: