"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: J and K keybindings for diff view
To:
Mikhail <mp39590@gmail.com>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 19 Jul 2022 19:53:22 +1000

Download raw body.

Thread
On 22-07-17 09:23pm, Mikhail wrote:
> This patch adds J and K bindings for diff view to move to the next and
> previous commits respectively. It mimics keybindings which are found in
> mutt while you're in mail view. I've found it very convenient, because
> you can scroll diff with j/k and when you're done, don't move hands to
> another part of a keyboard to see next/previous commit.

I like this. I use it in mutt too and it will be nice to have that
consistency between apps in frequent use.

> diff /home/misha/work/got
> commit - d6267a62d388995cbc79bb58ce9db7946fda0554
> path + /home/misha/work/got
> blob - 4ec26b8962b911a5c478faf7aebc3d0686931d6e
> file + tog/tog.1
> --- tog/tog.1
> +++ tog/tog.1
> @@ -292,7 +292,7 @@ Scroll to the bottom of the view.
>  Reduce diff context by N lines (default: 1).
>  .It Cm \&]
>  Increase diff context by N lines (default: 1).
> -.It Cm <, Comma
> +.It Cm <, Comma, K
>  If the
>  .Cm diff
>  view was opened via the
> @@ -302,7 +302,7 @@ If the diff was opened via the
>  .Cm blame
>  view, move to the Nth previous line and load the corresponding commit
>  (default: 1).
> -.It Cm >, Full stop
> +.It Cm >, Full stop, J
>  If the
>  .Cm diff
>  view was opened via the
> blob - 97ac0690a9232815bb10bc4a237246e2ec53e069
> file + tog/tog.c
> --- tog/tog.c
> +++ tog/tog.c
> @@ -4805,10 +4805,12 @@ input_diff_view(struct tog_view **new_view, struct tog
>  		break;
>  	case '<':
>  	case ',':
> +	case 'K':
>  		up = 1;
>  		/* FALL THROUGH */
>  	case '>':
>  	case '.':
> +	case 'J':
>  		if (s->parent_view == NULL) {
>  			view->count = 0;
>  			break;
> 
> 

-- 
Mark Jamsek <fnc.bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68