:e! How exactly does this work?

This is a discussion on :e! How exactly does this work? within the Editors forums in Theory and Concepts category; In vim if you edit another file with :e! file then :bnext! does the first file retain its edits in the buffer or not? I played around with this and it seems like sometimes they were kept and sometimes they were lost. How exactly does this work? CMM...

Go Back   Application Development Forum > Theory and Concepts > Editors

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-31-2008, 10:57 PM
Charles M
Guest
 
Default :e! How exactly does this work?

In vim if you edit another file with

:e! file
then
:bnext!

does the first file retain its edits in the buffer or not?
I played around with this and it seems like sometimes they
were kept and sometimes they were lost. How exactly does this work?


CMM
Reply With Quote
  #2  
Old 09-01-2008, 05:24 PM
Tony Mechelynck
Guest
 
Default Re: :e! How exactly does this work?

On 01/09/08 04:57, Charles M wrote:
> In vim if you edit another file with
>
> :e! file
> then
> :bnext!
>
> does the first file retain its edits in the buffer or not?
> I played around with this and it seems like sometimes they
> were kept and sometimes they were lost. How exactly does this work?
>
>
> CMM


If the file is modified (which is usually shown by [+] on the status
line) then going to a different file with an exclamation mark, or
closing the window with an exclamation mark, will lose all changes since
last save.

If 'autowriteall' is set, then going to a different file _without_ an
exclamation mark, or closing the window _without_ an exclamation mark,
will save the changes first (unless the file is unnamed or read-only, in
which cases there will be an error). If, instead, 'hidden' is set, the
modified buffer will not be written but it will be retained in Vim
memory even though it is not displayed. (However, the local 'bufhidden'
option can alter for one buffer the behaviour of the global 'hidden'
option.)

If 'autowriteall', 'autowrite' and 'hidden' are off (which is the
default), then closing the window or going to another file in the same
window (but without an exclamation mark) is an error if the file is
'modified'.

The commands ":w[rite]" and ":wq[uit]" will write the buffer, modified
or not, if it has a name. For an unnamed buffer they give an error. An
exclamation mark is required if the file is 'readonly' in Vim, or if the
disk file exists and is read-only.

":up[date]", ":wqa[ll]", ":exi[t]", ":x[it]", ":xa[ll]" will write the
file(s) if modified, provided that they have a name. Unnamed modified
files, or, without an exclamation mark, read-only files, give an error.

See also
:help abandon
:help E37
:help :hide
and the help for the various ex-commands and options mentioned above.

Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
155. You forget to eat because you're too busy surfing the net.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 07:20 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.