Put "set multibuffer" into ~/.nanorc or start nano with -F. Toggle this inside nano with alt-F. You can now read files into their own buffer with ctrl-R.
Use alt-comma and alt-period to go forward and backward in the file list.
سؤال
In emacs
, you can open new files with Ctrl+X, Ctrl+F
And go to the previous file with Ctrl+B, and go to the next file with Ctrl+N.
How to do this in nano
text editor? While nano
is launched, and then open new files, and how to switch between the opened files in the nano
text editor?
المحلول
Put "set multibuffer" into ~/.nanorc or start nano with -F. Toggle this inside nano with alt-F. You can now read files into their own buffer with ctrl-R.
Use alt-comma and alt-period to go forward and backward in the file list.
نصائح أخرى
To switch between open files in nano
alt+. -- move forward one file
alt+, -- move back one file
Open as many files as you want by listing them as separate arguments to nano
, like so:
nano file1.txt file2.log file3.c file4.js file5.py
The first file is opened, e.g. file1.txt
. Use the keyboard shortcuts below to switch between the files.
alt+. -- move forward one file
alt+, -- move back one file
nano --version
GNU nano, version 2.9.3
If you've already got nano open and you want to open a new file it's quite simple when you've figured out the keys...
Steps:
Building off of the other answers, here's my take on it:
Switch between open buffers with alt+left arrow and alt+right arrow. Nano will tell you which buffer you are in (the name of the file and the buffer number).
To open multiple files when you're starting up nano, do exactly what activedecay said (type such as nano file1.txt file2.txt file3.txt
). Note you can also do such as nano *.txt
to open all the txt files that are in the current directory, each in its own buffer.
To open a new and empty buffer after nano is already open, follow these steps:
If you already have an open buffer, and want to open a file into a new buffer, do what Lenny's answer says:
As to how to how to open multiple buffers at once from already existing files when you're already in nano, I'm not sure, yet.
Ctrl+x closes the current buffer.
I tested these things on nano 5.5 in Termux 0.106 (and nano 6.3 on Termux 0.118.0) on Android 10, with a bluetooth keyboard. I mention the version because shortcuts in at least some previous versions, if not all of them, aren't the same.