Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 10-08-2010, 12:48 PM   #1
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?

Old 10-08-2010, 02:27 PM   #2
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, 06:21 AM   #3
Registered: Jun 2006
Distribution: Fedora 14
Posts: 51

Original Poster
Rep: Reputation: 15

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


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

All times are GMT -5. The time now is 06:39 AM.

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