Hey all,
I work in a group environment where multiple people may end up editing the same file. We have measures in place so no two people can edit the same file at once. I have a script that does the following:
call: script file
The script will backup the file,
Moves the file to a safe/busy name, ie: file_in_use (this lets other users know it's busy)
Calls vi to edit it,
I edit the file, then exit vi,
When I exit vi, the script then continues, by
Moving the edited file back to its original name, and
the script exits.
It looks like this bare bones example:
This works brilliantly with vi. But in trying to engage gvim (vim) from within the script, gvim lets the script run its course and exit, then gvim edits "file_in_use," or, effectively, a new file named file_in_use.
When I call vi, it seems to stop or hold up the script until it's done with it, then the script continues with the subsequent steps.
I do not understand how to get gvim to act the same way as vi does.
Or can it?
Thanks in advance.
-Bruce
Moderator's Comments:
edit by bakunin: please use CODE-tags to surround code, data and terminal output. It makes the data stand out and better readable. Thank you.
Why you would want to use anything instead of vi eludes me. ;-))
I suppose it is because gvim - graphically challenged vi-lookalike - detaches itself from the shell it is run in. Therefore the script continues to run instead of stopping until gvim exits. Use the -nofork option to prevent that.
I'm slowly coming around to the 'dark side!' GVIM is a great way to get one used to dabbling in vi. (I have been lured away from EMACS because of GVIM... so I'm hoping to get some credit! LOL.)
Update: UserCP Screeching Frog 0.7641 - Changed Live Chat to Live Updates
In this version of the UserCP, I have changed "Live Chat" to "Live Updates" by disabling the ability to post in the "live chat" area and changed the name to "Live Updates"
The reason for this change is that experienced... (6 Replies)
Hi, I wanted to select the text in gvim using mouse for coping. some times it works fine and full text will be selected and copied to clipboard if it is like shown in first fig. Paste of the copied text can be done by clicking the middle mouse button.
But some times the text will be selected as... (2 Replies)
Hi, Dummy here!
I have a file in my directory named "jest". I wonder why I couldn't save change by using Shift + z + z which I used to do. But it work fine with :wq! command.
The second thing is, after several time of accessing the file, I notice my directory appears many files named jest~,... (1 Reply)
Hi People,
Does gvim latest versions support tabs. I would like to open different files in tabs rather than new windows or split windows. I would like to whether the current version supports it, if it doesn't then how to add such feature.
Thanks,
:) (2 Replies)
Hello All,
I am using gvim ( redhat linux machine). backspace doesnot work properly. can some boby suggest a solution ?
i have checked with older version. backspace works in it.
Thanks
Shiv (1 Reply)
I need to be very careful to keep ^M characters out of files.
In gVim, I can change the file format to Unix easily enough, but is there any way to make Unix the default format?
I can see "startup options" in the menu, but this takes me to some meaningless config file. I believe my config value... (1 Reply)
Have you used gVim editor on Windows (xp)? I am talking about the GUI version of vim that you can click the icon on desktop and the gVim editor pops-up and you can create/edit files.
Here's my problem: When I use vim editor on cygwin to create/edit files the file creation mask is set to a... (3 Replies)
I have a linux Enterprise Server Version 3 (ES) . It does not have Gvim on it. Can someone tell me how I can get Gvim on it please. I have spent a fair bit of time researching this and have not figured it out. I am probably missing something simple.
Frank (1 Reply)