tuomas-p
tuomas-p

Reputation: 151

Nano - disable confirm on save?

I use nano every day and I really hate when it asks every time to "save modified buffer? (yes/no)". How can I disable this?

Upvotes: 11

Views: 2617

Answers (5)

LynXz
LynXz

Reputation: 68

In ~/.nanorc, for nano version higher 5.0:

set saveonexit

for version below 5.0:

set tempfile

Also, its a good idea to add:

set backup
set backupdir /home/user/.nano-backups

All files will be automatically backed up in this directory, and it is much better then confirmation.

Upvotes: 2

B Shmid
B Shmid

Reputation: 21

On RPI ctrl+s+ctrl+x works naturally

Upvotes: 0

wisbucky
wisbucky

Reputation: 37923

I didn't like setting tempfile because then it also doesn't prompt you when you exit with ctrl+X. In fact, it will silently save your changes when you exit! And you can't exit without saving!

Instead, I have added this keybinding for ctrl+S to my ~/.nanorc:

bind ^S savefile main

savefile will save the file without prompting you to confirm the filename, like other editors. But if you use ctrl+X, it will prompt you if you have changes.

Upvotes: 8

Sven Rojek
Sven Rojek

Reputation: 5838

You are looking for the tempfile setting.

If you want a permanent setting, edit your ~/.nanorc file (or create it) and add:

set tempfile

Alternatively, you can start nano with the -t parameter.

Upvotes: 1

interduo
interduo

Reputation: 401

You can specify the -t flag when starting nano. From the man page:

-t (--tempfile) Always save changed buffer without prompting. Same as Pico's -t option.

Upvotes: 2

Related Questions