-   Linux - Newbie (
-   -   no write since last change,add ! to override! (

e3399 11-27-2010 10:10 AM

no write since last change,add ! to override!
But I want to open another file instead of quit the vim!
I tried

:o anotherfile
I get the warning :
no write since last change,add ! to override!

so I tried
:o! anotherfile
It didn't work

But I just don't want to
It will quit vim and then I must enter vim again.

sycamorex 11-27-2010 10:29 AM

You can save the changes first and then open another one:

:o another_file

jschiwal 11-27-2010 10:59 AM

You can open vim with the names of the two files.
:buffers will list the buffers
:files will list the files

You can also split the window into two and start another buffer.
:next file2

Enter ":set hidden" to enable hidden buffers. Now you can go from one buffer to another without needing to save first:
:set hidden
:bN (buffer next)
:bp (previous buffer)
:b3 (buffer #1)

You can start editing one file. Enter ":hidden" and then ":n file2". Now you can switch between the two buffers, without needing to write the displayed buffer.
>vim file1
:set hidden
:n file2
:bp (display previous buffer)
:bN (dispaly next buffer
:b2 (display buffer #2)
:b1 (display buffer #1)

barriehie 11-27-2010 12:18 PM

You can put multiple commands on the same line by seperating with the '|' symbol, eg.:

:sav | e ~/somefile

e3399 11-27-2010 07:35 PM

Than you!

All times are GMT -5. The time now is 01:53 PM.