Basic documentation for the choose files kitten

This commit is contained in:
Kovid Goyal
2025-07-16 13:15:27 +05:30
parent 9fa603aa5d
commit 966f2cb700
3 changed files with 37 additions and 7 deletions

View File

@@ -25,6 +25,35 @@ Simply run it as::
kitten choose-files
to select a single file from the tree rooted at the current working directory.
Type a few letters from the filename and once it becomes the top selection,
press :kbd:`Enter`. You can change the current directory by instead selecting a
directory and pressing the :kbd:`Tab` key. :kbd:`Shift+Tab` goes up one
directory level.
Creating shortcuts to favorite/frequently used directories
------------------------------------------------------------
You can create keyboard shortcuts to quickly switch to any directory in
:file:`choose-files.conf`. For example:
.. code-block:: conf
map ctrl+t cd /tmp
map alt+p cd ~/my/project
Selecting multiple files
-----------------------------
When you wish to select multiple files, start the kitten with :option:`--mode
<kitty +kitten choose_files --mode>`:code:`=files`. Then instead of pressing
:kbd:`Enter`, press :kbd:`Shift+Enter` instead and the file will be added to the list
of selections. You can also hold the :kbd:`Ctrl` key and click on files to add
them to the selections. Similarly, you can hold the :kbd:`Alt` key and click to
select ranges of files (similar to using :kbd:`Shift+click` in a GUI app).
Press :kbd:`Enter` on the last selected file to finish. The list of selected
files is displayed at the bottom of the kitten and you can click on them
to deselect a file. Similarly, pressing :kbd:`Shift+Enter` will un-select a
previously selected file.
Configuration
------------------------

View File

@@ -492,9 +492,9 @@ func (h *Handler) dispatch_action(name, args string) (err error) {
}
case "cd":
switch args {
case "current":
case ".":
return h.change_to_current_dir_if_possible()
case "up":
case "..":
curr := h.state.CurrentDir()
switch curr {
case "/":
@@ -517,10 +517,11 @@ func (h *Handler) dispatch_action(name, args string) (err error) {
if absp, err := filepath.Abs(args); err == nil {
h.change_current_dir(absp)
return h.draw_screen()
} else {
h.lp.Beep()
return nil
}
}
}
return
}

View File

@@ -67,8 +67,8 @@ map('Last result on screen', 'last_result_on_screen end next last_on_screen')
map('First result', 'first_result_on_screen ctrl+home next first')
map('Last result', 'last_result_on_screen ctrl+end next last')
map('Change to currently selected dir', 'cd_current tab cd current')
map('Change to parent directory', 'cd_parent shift+tab cd up')
map('Change to currently selected dir', 'cd_current tab cd .')
map('Change to parent directory', 'cd_parent shift+tab cd ..')
map('Change to root directory', 'cd_root ctrl+/ cd /')
map('Change to home directory', 'cd_home ctrl+~ cd ~')
map('Change to home directory', 'cd_home ctrl+` cd ~')
@@ -79,7 +79,7 @@ map('Next filter', 'next_filter ctrl+f 1')
map('Previous filter', 'prev_filter alt+f -1')
map('Toggle showing dotfiles', 'toggle_dotfiles alt+h toggle dotfiles')
map('Toggle showing ignored files', 'toggle_ignorefiles alt+d toggle ignorefiles')
map('Toggle showing ignored files', 'toggle_ignorefiles alt+i toggle ignorefiles')
map('Toggle sorting by dates', 'toggle_sort_by_dates alt+d toggle sort_by_dates')
egr() # }}}