I have no problems when open+change+save a file if I write nano filename
on the terminal.
But if I open nano and open the File Browser and open a file and try to save it, there is no default file name!:

- 30,963
- 73
- 183
- 303
-
4What's the question? This looks like a feature request. – Daniel Lyons Oct 09 '17 at 17:22
-
@DanielLyons the question is: is possible to get by default the name of the file I have just edited? At this moment I have to write it. – tirenweb Oct 09 '17 at 17:26
-
2Seems like a feature request to me; I don't see any documentation about this, there's no real completion here. Personally, I would probably spend this time and energy learning a more capable editor than wishing for better features from nano. Nano was made to be tiny, not powerful. – Daniel Lyons Oct 09 '17 at 18:51
3 Answers
I have tried your problem and indeed found that nano unable to "remember" the filename. My suspicion is that, when you open the editor just by typing "nano" in the command line, it only reads the content of that file, and paste it to the current buffer (without also making a new buffer for opening that file).
So try to do this:
1. Open nano just by typing nano in terminal
2. Then type alt + F to enable nano to open file into separate buffer
3. Read your file of interest from nano by ctrl + R, then ctrl + T
4. Make some modification to the file, and try to save it, It should know the filename of the original file now!

- 447
- 2
- 9
As far as I know, nano
doesn't have a default file name feature when invoked with no arguments, if that is what you are asking for.
However, you can set up a shell alias like below to achieve what you're going for. Random hex string to nearly guarantee a unique file wherever it is invoked. You can probably get fancier with a shell function, adding a filename test conditional and invoking custom arguments if they were actually specified.
alias nanod='nano $(head -c16 < /dev/urandom | xxd -pu)'
Single quotes are important; double quotes will result in the subshell being evaluated then the result aliased.

- 1,665
- 14
- 23
Unfortunately what you are asking for is not implemented or maybe it is a bug. You are doing everything right, it's just that nano doesn't "remember" what file you just opened when using the builtin browser feature.

- 1,214
- 8
- 15