Vim on SMB share

Giorgos Keramidas keramida at
Fri Sep 10 10:29:30 PDT 2004

On 2004-09-10 09:22, Daren Russell <darenr at> wrote:
> Thanks for the ideas.  The server side is Win2k (so not much I can do
> there!), the BSD is using version 3 of the Samba client, so I'll try
> downgrading it to version 2 and see how I go.
> I guess it must also be to do with the way Vim edits files, as the basic
> FBSD editor (ee) seems to manage.

Vim tries to create a file called .FILENAME.swp when you edit FILENAME.
The leading dot is probably what breaks the way vim works on Samba
shares.  You can always try to make vim write its swap files in another
location, i.e. in `/var/tmp' with this in your .vimrc:

        set dir=/var/tmp

or you can disable swapfiles altogether with

        set noswapfile

You can even play nice tricks like selectively disabling the swapfile
only for files that "live" in the well-known path of your Samba shares
with something similar to this in your .vimrc:

        if !exists("samba_swapfile_hack")
          let samba_swapfile_hack = 1
          autocmd BufNewFile,BufRead /share/win2k/* set noswapfile

Unless, of course, my guess is wrong and all this is nonsense :-)


More information about the freebsd-questions mailing list