dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
22.74k stars 380 forks source link

🚀 hjkl key bindings as arrow keys #1581

Closed cizmazia closed 9 months ago

cizmazia commented 9 months ago

Please could you add support for h and l for moving left and right?

Delta already supports j and k for for moving one line down and up when viewing diffs (and some other vim-like bindings). Vim users tend to use hjkl instead of arrow keys to keep their fingertips on the home row to avoid the need for glancing on the keyboard.

The only problem is that h is currently taken for Help but l is available.

dandavison commented 9 months ago

Hi @cizmazia, it's all less. delta doesn't have any keybindings; when you send key and mouse events they're being received by the less process that delta has invoked. (same as how bat works). So, you can do anything you can do with less.

cizmazia commented 9 months ago

Thanks for the response! I managed to configure less according to this post.

Steps (click to expand) Created a `.lesskey` file: ``` #command h left-scroll l right-scroll ``` Generated the `~/.less` file: ``` lesskey -o ~/.less .lesskey ```