Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change default key bindings / hotkeys or assign new bindings #1415

Open
shitcoding opened this issue Aug 30, 2023 · 4 comments
Open
Labels

Comments

@shitcoding
Copy link

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!

@j-bennet
Copy link
Contributor

Hi @shitcoding ,

There's no easy way to modify or add new keybindings. We have an open issue that discusses this:

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.

@lelit
Copy link
Contributor

lelit commented Aug 31, 2023

That should be better done at the prompt-toolkit layer, IMO.

@j-bennet
Copy link
Contributor

j-bennet commented Sep 1, 2023

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:

#760 (comment)

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

@shitcoding
Copy link
Author

Thanks for your help! Got to try these approaches, hope it will relieve my vim nerd pain ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants