Wednesday, May 23, 2012

Re: If in OldFile I :write NewFile, do I need to manually reload NewFile and close OldFile?

On Wed, May 23, 2012 at 03:08:33PM -0700, sfosparky wrote:
> For GVIM 7.3, IF I open OldFilename, AND use :write to write its buffer as NewFileName, THEN is there a way to not have to keep thinking about OldFileName?

> That is, I want GVIM to simply begin editing NewFile, period — I don't want to have to manually use :edit to load NewFile, use :rew to position back to OldFile, and use :bdel to close OldFile.

> STEPS:

> 1. In GVIM, edit OldFile.

> 2. Type :files GVIM displays:
> 1 %a "OldFile" line nn

> 3. Type :write NewFile.txt. GVIM displays:
> "NewFile" [unix] 10l 100c written

> 4. Type :files GVIM displays:
> 1 %a "OldFile" line nn

> RESULT: After using :write to write the file under a new name, GVIM creates NewFile in the target directory, but continues to edit only OldFile.

> 5. Type :edit Newfile GVIM displays:
> "NewFile" [unix] 10l 100c

> I'd really rather not have to perform step 5, above, to start editing NewFile.

> 6. Type :files GVIM displays two lines:
> 1 # "OldFile" line 10
> 2 %a "NewFile" line 1

> GVIM now has two buffers: (1) An alternate buffer (#, OldFile). and (2) an active/current buffer (%a, NewFile).

> 7. Use :rew to make OldFile the active buffer, then use :bdel (buffer delete) to close it.

> I'd really rather not have to perform the :rew and :bdel steps. Having saved a file as NewFile, I don't want to have GVIM holding on to OldFile.

> Are all these steps really necessary? Can some please tell me some more straightforward way to simply write a file under a new name and begin editing it without all the additional :edit / :rew / :bdel / steps?

i think what you're looking for is 'saveas' -- see

:h :sav

sc

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

No comments: