3

When using Nano, if I press Ctrl+O the editor will ask me to press Enter to confirm overwriting the file. This is annoying.

Is there a keyboard shortcut to save file as it is usual in other applications -- to overwrite it immediately without any additional questions?

| improve this question | | | | |
5

Edit the file ~/.nanorc and add this:

bind ^S savefile main

Now ctrl+s will save your file to the same filename without prompts.

However, use this feature with caution. It will not inform you if something else has modified the file since your last save. If that's not a possible issue for you, this should work good!

| improve this answer | | | | |
  • Is there a built-in shortcut for this, so that I don't need to edit config on each server? – warvariuc Nov 14 '16 at 8:53
  • I do not think so. You could use the -t flag on nano to have it so your work is automatically saved when you do ctrl+x, but this is probably worse of a solution than doing an edit to your nanorc. – Iskar Nov 14 '16 at 8:57
1

Since at least Nano v3, the native Ctrl+S shortcut will directly save the file. Ctrl+O is the "Save As…" feature.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.