Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to break out of nano?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Gentree
Watchman
Watchman


Joined: 01 Jul 2003
Posts: 5350
Location: France, Old Europe

PostPosted: Tue May 05, 2015 9:28 am    Post subject: how to break out of nano? Reply with quote

Hi,

I have nano configured for autosave on exit but if I open a file to which I don't have write access it will happily make changes to the text that it can't save.

When I go to save or exit it shows a permissions error with a continue / cancel choice. That leaves me back in the editor with unsaved changes.

The only way out of this seems to be to close the terminal from which nano was run or use a separate terminal to kill that process.

Is there a clean way, from within nano, to tell it to abandon changes and quit anyway?

I can't find one.

TIA, Gentree. 8)
_________________
Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86
Back to top
View user's profile Send private message
cboldt
Veteran
Veteran


Joined: 24 Aug 2005
Posts: 1046

PostPosted: Tue May 05, 2015 11:33 am    Post subject: Reply with quote

I don't recall if this is standard, but nano here has Ctl-X bound to exit (Close the current file buffer / Exit from nano). When I edit a file that I lack permissions to write, and Ctl-X, nano asks ...

Code:
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?


... To which I answer "n" and nano quits.
Back to top
View user's profile Send private message
cboldt
Veteran
Veteran


Joined: 24 Aug 2005
Posts: 1046

PostPosted: Tue May 05, 2015 11:45 am    Post subject: Reply with quote

I just noticed that you have autosave on exit. I don't. I tried `nano -t` and got the same result you did. Was able to exit by saving the changed file in a temporary place, just prepended "/tmp/" and got out. Beats killing the nano process, but isn't as graceful as one might like.
Back to top
View user's profile Send private message
Gentree
Watchman
Watchman


Joined: 01 Jul 2003
Posts: 5350
Location: France, Old Europe

PostPosted: Tue May 05, 2015 12:00 pm    Post subject: Reply with quote

yes, thanks, at least it's a work around. I just wondered whether I was missing a command key or something. Maybe not.
_________________
Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86
Back to top
View user's profile Send private message
cboldt
Veteran
Veteran


Joined: 24 Aug 2005
Posts: 1046

PostPosted: Tue May 05, 2015 1:53 pm    Post subject: Reply with quote

I didn't care for writing the modified but not save-able file out to disk, and found out that changing the filename to /dev/null allows nano to dutifully bail out.
Back to top
View user's profile Send private message
Gentree
Watchman
Watchman


Joined: 01 Jul 2003
Posts: 5350
Location: France, Old Europe

PostPosted: Tue May 05, 2015 2:32 pm    Post subject: Reply with quote

/dev/null

smart.Thx
_________________
Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum