LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-08-2010, 11:48 AM   #1
OR13
Member
 
Registered: Jun 2006
Distribution: Fedora 14
Posts: 51

Rep: Reputation: 15
Vim - How can I stop :bn and :bp from saying "No write since last change"?


Hello all,

I'm using vim quite extensively for editing code segments.
Two of the most common commands I use are :bn (next buffer) and :bp (previous buffer).

However, using :bn, navigating away from a file I'm editing, shows the message "No write since last change (add ! to override)", and only :bn! or :w and then :bn works.

I know there's a way to stop this from happening - probably something in the .vimrc file...
Does anyone know what I can do?

Thanks!
 
Old 10-08-2010, 01:27 PM   #2
penguiniator
Member
 
Registered: Feb 2004
Location: Olympia, WA
Distribution: SolydK
Posts: 442
Blog Entries: 3

Rep: Reputation: 60
set autowrite
set autowriteall

Either of those will eliminate the problem.
 
Old 05-07-2011, 05:21 AM   #3
OR13
Member
 
Registered: Jun 2006
Distribution: Fedora 14
Posts: 51

Original Poster
Rep: Reputation: 15
Smile

I used this way (autowrite) for a few months,
but it wasn't perfect for me - because when working with code (especially scripting languages such as python), saving open buffers in mid-work is dangerous (for example, if I have a cron that runs my code, and I'm in the middle of editing it, I might get syntax errors, name errors, etc.).

Now I've found a far better option, for me:
:set hidden (Saves all open buffers in the background, instead of closing them and re-opening on demand)
in conjunction with (the default, on my machine at-least):
:set confirm (Demands confirmation before closing unsaved buffers)
Credit must be given to all the commentators here.

Hope this helps others...
 
  


Reply

Tags
buffer, configuration, vim


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
"HOWTO Change Colour of Comments in VIM editor" manikantha Linux - General 8 07-16-2013 03:36 AM
How to stop bash from replacing "~/" with "/home/username"? daihard Linux - Software 8 08-22-2010 02:32 PM
How to write a bash script to replace all "KH" to "K" in file ABC??? cqmyg5 Slackware 4 07-24-2007 09:00 AM
chrooted user: "write" and "talk" don't work. ldp Linux - Software 2 04-12-2005 02:05 AM
How do I change "fstab" to Write/Edit Mode? sharathkv Linux - Newbie 4 07-29-2003 07:52 AM


All times are GMT -5. The time now is 07:46 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration