help-nano
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Choosing directory to save file to, inside nano


From: Benno Schulenberg
Subject: Re: Choosing directory to save file to, inside nano
Date: Tue, 6 Jun 2023 16:56:36 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0


Op 05-06-2023 om 17:18 schreef Find Marbles:
^O opens save menu and ^T the file browser, I navigate to the directory I want and then what?

Ah.  I see what you mean.  The file browser is a /file/ browser:
it only allows selecting an existing file, not to fill the prompt
with the name of a chosen directory.

Okay, then you could use the power of the <Tab> key.  Probably
you don't want to save your files all over your file system, but
just in a relatively small subtree.  Then I would first do:

  sudo ln -s  home/yourusername/path/to/the/subtree  /texts

Then, in nano, when you're ready to save a new file, you type:

  ^O /te <Tab><Tab>

Nano will show you the names of the files and directories in
your subtree.  If you have named the subdirectories of that
subtree cleverly, you can probably just type one or two letters
followed by <Tab>, and nano will complete the name of the subdir.
Then you type the name for the new file and <Enter>.


Or, if that is still too much typing, and you only have one or
two handfuls of target directories where you save your files,
then you could put in your .nanorc something like:

  bind M-1 "{writeout}{cut}~/path/to/first/folder/{tab}" main
  bind M-2 "{writeout}{cut}~/path/to/second/folder/{tab}" main
  ...

The {cut} is for when you already saved the buffer under some
name and then decide you want to store the file somewhere else.
The {tab} shows you which files are already present in the folder,
so that it's easier to choose a non-existing name.

Then, when you're ready to save a file, you just type Alt+1 or
Alt+2 or whatever key you bound, followed by the name of the
file and <Enter>.  Done.  It does require that you remember
which keystroke saves where.

You need nano-7.0 or higher for the above binds to work.


Benno

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]