LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-27-2010, 11:10 AM   #1
e3399
Member
 
Registered: Nov 2010
Location: China
Distribution: Fedora12
Posts: 54

Rep: Reputation: 0
Question 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
:q!
It will quit vim and then I must enter vim again.

Last edited by e3399; 11-27-2010 at 11:11 AM.
 
Old 11-27-2010, 11:29 AM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
You can save the changes first and then open another one:
Code:
:w
:o another_file
 
Old 11-27-2010, 11:59 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
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.
:split
: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)
 
1 members found this post helpful.
Old 11-27-2010, 01:18 PM   #4
barriehie
Member
 
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
You can put multiple commands on the same line by seperating with the '|' symbol, eg.:
Code:
:sav | e ~/somefile
 
Old 11-27-2010, 08:35 PM   #5
e3399
Member
 
Registered: Nov 2010
Location: China
Distribution: Fedora12
Posts: 54

Original Poster
Rep: Reputation: 0
Than you!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
trying to change write to /data not enough permissions gonus Linux - General 1 10-21-2005 09:47 PM
No write since last change (add ! to override) sailajabhandaru Linux - Software 2 07-08-2005 06:51 AM
NTPD - add to rc.local or write a script downinthemine Linux - Software 0 04-21-2004 10:52 AM
Cannot Change GNOME Menu Items to add/change Item for Mozilla 1.2 After Upgrade metoome General 0 03-27-2004 01:19 AM
Cannot Change GNOME Menu Items to add/change Item for Mozilla 1.3 After Upgrade SForsgren Linux - General 4 03-27-2004 12:43 AM


All times are GMT -5. The time now is 10:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration