Further thoughts:
On Tue, Jan 3, 2012 at 9:19 AM, Marty Fried <ma...@leftcoast-usa.com> wrote:

> On Tue, Jan 3, 2012 at 7:45 AM, Graham Lawrence <gl00...@gmail.com> wrote:
>
>> I thank you all for your help, but I really can't use your
>> recommendations without screwing up something else on my system.  I
>> have a script which runs automatically on system startup which
>> immediately references this ntfs drive, so I must have this drive
>> automount on startup like my internal HD, or the script will fail.  It
>> runs for several hours, during which I can't unmount and remount the
>> drive.
>>
> There is no reason you should have to do this anyway.  Nobody suggested
you should.


>
>> The initial mount command assigns the drive to ROOT:ROOT with rwx
>> permissions for all users.  These cannot be changed with chown, chmod,
>> chgrp as explained at
>>    http://ubuntu.swerdna.org/ubuntfs.html
>> As this is an ubuntu site this behavior is not specific to my distro,
>> slackware.  I assume it is standard behavior for the kernel, ntfs-3g
>> and the core utilities.
>>
> Yes, and I am very aware of this, which is exactly why I suggested
experimenting with
your fstab settings instead.

>
>> I appreciate that one can get vim to write to this drive by having it
>> use a different linux command to do so, and am already doing that.
>
> But I often forget to use it because my vim shutdown script
>> automatically writes out any altered buffers; but then it fails if it
>> tries to write to this ntfs drive.  The only feasible solution for me
>> is to elaborate my shutdown script to choose the appropriate write
>> procedure for each buffer.
>>
> I wouldn't say it's the *only feasible* solution, only that it's a
possible solution.

Did you know there is a Vim command that will automatically write any
named, unsaved
buffers anytime Vim loses focus?  You can add this to your .vimrc:
au FocusLost * :wa

The Vim FAQ addresses this, and another that might be useful:

23.5. How do I automatically save all the changed buffers whenever Vim
      loses focus?

You can define an autocommand for the FocusLost event which will save all
the modified buffers whenever Vim loses focus:
    :autocmd FocusLost * wall

For more information, read
    :help FocusLost
    :help :wall


23.6. How do I execute/run a function when Vim exits to do some cleanup?

You can use VimLeave autocmd event to execute a function just before Vim
exists. For example,
    :autocmd VimLeave * call MyCleanupFunction()

For more information, read
    :help VimLeave

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

Reply via email to