maybe i didn't explain mysel well enough

i am not using cvs but clearcase.
when a file is checked in - it is read only (both as r--r--r-- and as read-only-file-system)
when i check it out via a command, then it is still as r--r--r--, but i can now change it with chmod. te filesystem is no longer read only


anyway, my question was about vi, not about a script.
i mannaged to map <F9> to do almost what i wanted.

i added a line to ~/.vimrc:

map <F9> :!ctco %:p<return><return>:w!<return>

this will run 'ctco' script with the full path of the file i am editing, then deos a ':w!' to save
the only thing left for me to do is :
1. press f9
2. press y for yes-i-am-sure (strange i couldn't add that to the map command)


what i still need is that if the file is read-only, whenver i press 'i' for insert or 'o' or I or a or A etc ... that it will do what f9 does,
( and also get rid of the 'y' i have to answer)


cheers,
erez.

Tzahi Fadida wrote:

strange, whats the thing with the read only? if this is what you get when you
check out
a file then the "cvs watch on <file>" was set on the file. this means, that
before you start editing a file you must run "cvs edit <file>" and the file will
be set +write. you edit, save, commit. if you changed your mind before commit
and want to return to the original file, just "cvs unedit <file>".
anyway, if you had enough with the read only you can do "cvs watch off <dir>" on
your directory because it could be the default policy for adding files. please
note, that if your are not alone in this cvs repository, you will have to
continue with the "cvs edit" "unedit" thing.
good luck.

* - * - *
Tzahi Fadida
MSc Student
Information System Engineering Area
Faculty of Industrial Engineering & Management
Technion - Israel Institute of Technology
Technion City, Haifa, Israel 32000
Email [EMAIL PROTECTED]
Technion Email: [EMAIL PROTECTED]
* - * - * - * - * - * - * - * - * - *

WARNING TO SPAMMERS: see at http://members.lycos.co.uk/my2nis/spamwarning.html



-----Original Message-----
From: Erez Doron [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 18, 2003 5:13 PM
To: [EMAIL PROTECTED]
Cc: Ilug
Subject: Re: vi question


i have a script that does checkout, but i have to do: 1. write the file -> i get a warning it is r/o 2. force write ( :w! ) -> still can't write 3. run checkout script 4. vi now tells me that the file i'm editing is older than the file on disk. i press 'o' for o.k. 5. i write again (:w) -> still read only 6. force write (:w! ) -> vi says again that the file on disk is newer, and verifies if i really want to save, i answer yes.

i want to skip all this by doing it automatically

cheers,

erez.


Tzahi Fadida wrote:




what about a script?
here is a script i wrote in 5 min. you are missing the "if" to check


if the file


is read only, i don't know what program can test that, but i am sure others
know(p.s i used bash):
#!/bin/sh
PATH=/usr/ucb:/bin:/usr/bin:/usr/sbin
MAILTO=root
MAIL=/bin/mail
CVSROOT=:pserver:[EMAIL PROTECTED]:/home/cvs/master
cvs update $1
cvs edit $1
vi $1


* - * - * Tzahi Fadida MSc Student Information System Engineering Area Faculty of Industrial Engineering & Management Technion - Israel Institute of Technology Technion City, Haifa, Israel 32000 Email [EMAIL PROTECTED] Technion Email: [EMAIL PROTECTED] * - * - * - * - * - * - * - * - * - *

WARNING TO SPAMMERS: see at


http://members.lycos.co.uk/my2nis/spamwarning.html





-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Erez Doron
Sent: Thursday, September 18, 2003 1:15 PM
To: Ilug
Subject: vi question


hi


i am using a version control software
i want vi to automatically checkout a file whenver i try to edit it
while it is read-only.
this includes running a command line, then reloading the file (because
the date changes when i checkout the file), then let me edit it.

i want all to be automatically ( e.g. when i change the file)

how do i do that ( or part of it ) ?


cheers, erez


================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]




















================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]



Reply via email to