pgcli
pgcli copied to clipboard
How to change default key bindings / hotkeys or assign new bindings
Hi! First of all, thanks for an amazing tool that helps a lot!
I have a small question: Are there any ways to change default key bindings, or assign new ones? For example, use ctrl-j / ctrl-k to navigate up / down dropdown autocompletion list (instead of default tab / shift-tab)
I looked for a solution in pgcli docs, googled for a while, but didn't find anything.
Thanks in advance!
Hi @shitcoding ,
There's no easy way to modify or add new keybindings. We have an open issue that discusses this:
- https://github.com/dbcli/pgcli/issues/760
For now, people resort to patch their local pgcli/key_bindings.py. I agree that this is not ideal. I'll take a look and see what it takes to add custom keybinding functionality to pgcli; you're not the first person to need this.
That should be better done at the prompt-toolkit layer, IMO.
That should be better done at the prompt-toolkit layer, IMO.
Yes, we thought so too. But in the meantime, we could take the same approach as ptpython, like @jonathanslenders advised here:
https://github.com/dbcli/pgcli/issues/760#issuecomment-618016523
Eventually, python_prompt_toolkit may support .inputrc, and we could switch the approach:
https://python-prompt-toolkit.readthedocs.io/en/stable/pages/advanced_topics/key_bindings.html#processing-inputrc
Thanks for your help! Got to try these approaches, hope it will relieve my vim nerd pain ;)