Loading ...
Sorry, an error occurred while loading the content.

42161Re: Force write

Expand Messages
  • Antoine J. Mechelynck
    Jul 31, 2003
      Y Hu <yh86us@...> wrote:
      > Hi,
      >
      > In vim version 5.7, I can force writing to a file
      > using w!. But, now I change to version 6.2, I am not
      > able to force writing to a read-only file in my local
      > directory. I really want this function, please how can
      > I do it in version 6.2?
      >
      > Thank you.
      >
      > fh
      >
      > __________________________________
      > Do you Yahoo!?
      > Yahoo! SiteBuilder - Free, easy-to-use web site design software
      > http://sitebuilder.yahoo.com

      There are 3 possibilities:

      (a) You opened the file with :view, or you manually set 'readonly'. Just do
      :set noro and the write should work (if 'modifiable is set).

      (b) Another program had the file open with a lock at the time you opened it
      in vim. First remove the lock (for instance by closing the other program)
      then go back to (a) above.

      (c) You don't have write permission in the directory entry for that file.
      Check it with dir /t (for Dos) or ls -l (for Unix). But maybe you can give
      yourself permission (if you think you may).

      Under Unix:
      chmod a+w filename

      Under Dos:
      attrib -r filename.ext

      If it succeeds, go back to (a). If chmod fails, and you are still sure that
      you are allowed to modify the file, you must get help from a sysadmin who
      knows the "root" password. (If it fails for "Invalid parameter a+w" or some
      such, then try 666 or 777 instead of a+w. -r stands for "minus-readonly",
      a+w stands for "all-plus-write", 666 stands for rw-rw-rw- and 777 stands for
      rwxrwxrwx.)

      HTH,
      Tony.
    • Show all 5 messages in this topic