xonsh / xontrib-template

Full-featured template for building extension (xontrib) for the xonsh shell.
MIT License
42 stars 12 forks source link

Idea: fish-like CD to previous/next dir in history with keybinds and "inline" prompt updates #28

Closed eugenesvk closed 1 year ago

eugenesvk commented 1 year ago

Fish has this very nice trick of a functionality that allows you to CD to previous/next dir in history with / WITHOUT creating any new prompts, so the existing prompt just gets updated in the background

In xonsh it's also possible to update the exising prompts, see the gist below for a sample xontrib that CDs up one folder on ⎈z and updates all 3 prompts (if they exist) "inline", i.e., without generating a new line like the carriage return workaround does

https://gist.github.com/eugenesvk/fb8078d7388fc4d722f2c4b88f63cda1

This xontrib would rely on this, but add env vars to allow changing keybinds and use os-relevant defaults (I think temrinals on Macs map / to Send ^[ [1;5H Send ^[ [1;5F)

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

eugenesvk commented 1 year ago

I've added this as an improvement to the existing xontrib https://github.com/jnoortheen/xontrib-hist-navigator/pull/1