bombshell-dev / clack

Effortlessly build beautiful command-line apps
https://clack.cc
5.25k stars 88 forks source link

[Request] Ctrl-n to Down, Ctrl-p to Up #121

Open mindgitrwx opened 1 year ago

mindgitrwx commented 1 year ago

Is your feature request related to a problem? Please describe.

screenshot 2023-04-17 at 11 24 26 PM

I would like to add functionality to toggle up or down using the Ctrl-n or Ctrl-p keys.

Describe the solution you'd like

type KeyAlias = {
  key: string;
  ctrl: boolean;
};

const aliases = new Map<string | KeyAlias, string>([
  ['k', 'up'],
  ['j', 'down'],
  ['h', 'left'],
  ['l', 'right'],
  [{ key: 'n', ctrl: true }, 'down'],
  [{ key: 'p', ctrl: true }, 'up'],
]);

I believe this code is functioning correctly.

Additional context The Mac operating system universally employs this type of method for moving.