icl icon indicating copy to clipboard operation
icl copied to clipboard

Allow multipage navigation

Open lidorshimoni opened this issue 2 years ago • 1 comments

what if I want a page for bash commands and another for docker and another for git? I already implemented this, I added right and left arrows to switch between cheatsheets. also added page-down, page-up, end and home keys support. also made the search smarter. ill probably make a merge request soon.

lidorshimoni avatar May 18 '22 18:05 lidorshimoni

Hi @lidorshimoni. Interesting you mentioned this as it something I thought about as a potential improvement the day I wrote icl.

A possible solution would be to allow the user to place an arbitrary number of text files on ~/.config/icl and accept the filename as a command line argument when launching icl. Of course, this flies a bit in the face of the snappiness of just using keybindings. Which is the core idea behind this tool: reducing the amount of key presses to the bare minimum, and do away with as much manual text input as possible.

Perhaps am option such as -a/--all would load all the files with commands, while the first non dashed command line argument would be used to specify a specific file. The user could organize their library in files such as docker.txt, 'git.txt', etc. Or maybe a predefined default file, commands.txt for example, should load by default. This should probably be controlled via the provided shell scripts for each shell, so a user can easily customize the default behavior without touching the python program.

Anyways, I think your idea of browsing through other sections with arrow keys makes most sense. I certainly would use it. We can latter add some visual feedback indicating which page we are at. Perhaps just displaying the name on the bottom left with distinct colors. A popup menu to pick the page from a list would also provide intuitiveness and discoverability. But this probably is for a next iteration. I'll open a ticket to gather thoughts about it.

You are welcome to submit pull requests. The keybindings you mentioned can probably be merged right away. Changes on the search could be their own discussion. So please submit separate pull requests.

plainas avatar May 18 '22 22:05 plainas