Add keyboard shortcuts for toggling scan settings

This commit is contained in:
Kovid Goyal 2025-07-11 07:14:07 +05:30
parent 5149f98936
commit 3134941a84
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 21 additions and 0 deletions

View file

@ -400,6 +400,23 @@ func (h *Handler) dispatch_action(name, args string) (err error) {
return h.finish_selection()
}
return h.draw_screen()
case "toggle":
switch args {
case "dotfiles":
h.state.show_hidden = !h.state.show_hidden
h.result_manager.set_show_hidden()
return h.draw_screen()
case "ignorefiles":
h.state.respect_ignores = !h.state.respect_ignores
h.result_manager.set_respect_ignores()
return h.draw_screen()
case "sort_by_dates":
h.state.sort_by_last_modified = !h.state.sort_by_last_modified
h.result_manager.set_sort_by_last_modified()
return h.draw_screen()
default:
h.lp.Beep()
}
case "cd":
switch args {
case "current":

View file

@ -65,6 +65,10 @@
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 sorting by dates', 'toggle_sort_by_dates alt+d toggle sort_by_dates')
egr() # }}}
def main(args: list[str]) -> None: