Skip to content

Commit 966f2cb

Browse files
committed
Basic documentation for the choose files kitten
1 parent 9fa603a commit 966f2cb

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

docs/kittens/choose-files.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,35 @@ Simply run it as::
2525
kitten choose-files
2626

2727
to select a single file from the tree rooted at the current working directory.
28+
Type a few letters from the filename and once it becomes the top selection,
29+
press :kbd:`Enter`. You can change the current directory by instead selecting a
30+
directory and pressing the :kbd:`Tab` key. :kbd:`Shift+Tab` goes up one
31+
directory level.
32+
33+
Creating shortcuts to favorite/frequently used directories
34+
------------------------------------------------------------
35+
36+
You can create keyboard shortcuts to quickly switch to any directory in
37+
:file:`choose-files.conf`. For example:
38+
39+
.. code-block:: conf
40+
41+
map ctrl+t cd /tmp
42+
map alt+p cd ~/my/project
43+
44+
Selecting multiple files
45+
-----------------------------
46+
47+
When you wish to select multiple files, start the kitten with :option:`--mode
48+
<kitty +kitten choose_files --mode>`:code:`=files`. Then instead of pressing
49+
:kbd:`Enter`, press :kbd:`Shift+Enter` instead and the file will be added to the list
50+
of selections. You can also hold the :kbd:`Ctrl` key and click on files to add
51+
them to the selections. Similarly, you can hold the :kbd:`Alt` key and click to
52+
select ranges of files (similar to using :kbd:`Shift+click` in a GUI app).
53+
Press :kbd:`Enter` on the last selected file to finish. The list of selected
54+
files is displayed at the bottom of the kitten and you can click on them
55+
to deselect a file. Similarly, pressing :kbd:`Shift+Enter` will un-select a
56+
previously selected file.
2857

2958
Configuration
3059
------------------------

kittens/choose_files/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,9 @@ func (h *Handler) dispatch_action(name, args string) (err error) {
492492
}
493493
case "cd":
494494
switch args {
495-
case "current":
495+
case ".":
496496
return h.change_to_current_dir_if_possible()
497-
case "up":
497+
case "..":
498498
curr := h.state.CurrentDir()
499499
switch curr {
500500
case "/":
@@ -517,10 +517,11 @@ func (h *Handler) dispatch_action(name, args string) (err error) {
517517
if absp, err := filepath.Abs(args); err == nil {
518518
h.change_current_dir(absp)
519519
return h.draw_screen()
520+
} else {
521+
h.lp.Beep()
522+
return nil
520523
}
521-
522524
}
523-
524525
}
525526
return
526527
}

kittens/choose_files/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
map('First result', 'first_result_on_screen ctrl+home next first')
6868
map('Last result', 'last_result_on_screen ctrl+end next last')
6969

70-
map('Change to currently selected dir', 'cd_current tab cd current')
71-
map('Change to parent directory', 'cd_parent shift+tab cd up')
70+
map('Change to currently selected dir', 'cd_current tab cd .')
71+
map('Change to parent directory', 'cd_parent shift+tab cd ..')
7272
map('Change to root directory', 'cd_root ctrl+/ cd /')
7373
map('Change to home directory', 'cd_home ctrl+~ cd ~')
7474
map('Change to home directory', 'cd_home ctrl+` cd ~')
@@ -79,7 +79,7 @@
7979
map('Previous filter', 'prev_filter alt+f -1')
8080

8181
map('Toggle showing dotfiles', 'toggle_dotfiles alt+h toggle dotfiles')
82-
map('Toggle showing ignored files', 'toggle_ignorefiles alt+d toggle ignorefiles')
82+
map('Toggle showing ignored files', 'toggle_ignorefiles alt+i toggle ignorefiles')
8383
map('Toggle sorting by dates', 'toggle_sort_by_dates alt+d toggle sort_by_dates')
8484

8585
egr() # }}}

0 commit comments

Comments
 (0)