ArthurSonzogni/json-tui

Keybindings

andys8 opened this issue ยท 7 comments

Hey there, found the tool just yet and it looks pretty nice. Would like to use it :)

I've some questions regarding keybindings?

  • Are they documented somewhere? If not, it would be cool to have them in a complete table view in the README and either showing up with --help or inside the tool (? or h). Just ideas.
  • Functionality: I can list what I tried (and at the same time it would be cool if some of these were added)
    • Arrow left (or h) to close
    • Arrow right (or l) to open
    • Jump to bottom (e.g. G like Vim)
    • Jump to top (e.g. gg like Vim)
    • Copy (e.g. yy like Vim) #10

I know this ticket is too broad. Depending on the answer it could either be refined or split up into several issues.

Thanks for opening this issue!

The keys are currently the ones inherited from the FTXUI library default components. We use the arrow keys, tab, reverse-tab, pagedown and pageup. The vim keys are supported: h,j,k,l. We also support the mouse, including the mouse's wheel.

I believe I like all your ideas without exceptions. It just require someone to do the work.

If you wish to implement some of it, please met me know. Otherwise, I will do it at some point in time.

I started working on:

  • Add some documentation about the keybinding.
  • Add support for 'G' and 'gg"

That's cool. I'm wondering about h and l and left / right arrows. They don't seem to close and open nested structures, but are supposed to work/exist. Do they have different functionality or are they currently missing?

https://github.com/ArthurSonzogni/json-tui/pull/24/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R61-R62

The arrow key left/right and the vim h/k keys are used to navigate left and right. This is useful when you have both the "button" to expand JSON and the button to display the array view.
See:

test-2022-09-27_23.02.42.mp4

I added '+' and '-' to expand/collapse all elements.

I think this issue has been fixed, outside of the copy/paste feature, which is tracked elsewhere.

ู…ุฑุญุจู‹ุงุŒ ู„ู‚ุฏ ูˆุฌุฏุช ุงู„ุฃุฏุงุฉ ุญุชู‰ ุงู„ุขู† ูˆู‡ูŠ ุชุจุฏูˆ ุฌู…ูŠู„ุฉ ุฌุฏู‹ุง. ุฃุฑุบุจ ููŠ ุงุณุชุฎุฏุงู…ู‡ :)

ู„ุฏูŠ ุจุนุถ ุงู„ุฃุณุฆู„ุฉ ุจุฎุตูˆุต ุฑูˆุงุจุท ุงู„ู…ูุงุชูŠุญุŸ

  • ู‡ู„ ุชู… ุชูˆุซูŠู‚ู‡ู… ููŠ ู…ูƒุงู† ู…ุงุŸ ุฅุฐุง ู„ู… ูŠูƒู† ุงู„ุฃู…ุฑ ูƒุฐู„ูƒุŒ ูุณูŠูƒูˆู† ู…ู† ุงู„ุฑุงุฆุน ุนุฑุถู‡ุง ููŠ ุนุฑุถ ุฌุฏูˆู„ ูƒุงู…ู„ ููŠ ู…ู„ู README ูˆุฅู…ุง ุฃู† ุชุธู‡ุฑ ู…ุน --helpุงู„ุฃุฏุงุฉ ุฃูˆ ุฏุงุฎู„ู‡ุง ( ?ุฃูˆ h). ู…ุฌุฑุฏ ุฃููƒุงุฑ.

  • ุงู„ูˆุธูŠูุฉ: ูŠู…ูƒู†ู†ูŠ ุณุฑุฏ โ€‹โ€‹ู…ุง ุฌุฑุจุชู‡ (ูˆููŠ ู†ูุณ ุงู„ูˆู‚ุช ุณูŠูƒูˆู† ุฑุงุฆุนู‹ุง ุฅุฐุง ุชู…ุช ุฅุถุงูุฉ ุจุนุถ ู‡ุฐู‡ ุงู„ุฃุดูŠุงุก)

ุฃุนู„ู… ุฃู† ู‡ุฐู‡ ุงู„ุชุฐูƒุฑุฉ ูˆุงุณุนุฉ ุฌุฏู‹ุง. ุงุนุชู…ุงุฏู‹ุง ุนู„ู‰ ุงู„ุฅุฌุงุจุฉุŒ ูŠู…ูƒู† ุชู†ู‚ูŠุญู‡ุง ุฃูˆ ุชู‚ุณูŠู…ู‡ุง ุฅู„ู‰ ุนุฏุฉ ู…ุดูƒู„ุงุช.

Hi @SaadAlahmad053843

The json-tui help says you can use -k, --key, or --keybinding to get the information:

json-tui -h
  json-tui [file] {OPTIONS}

    A JSON terminal UI

  OPTIONS:

      file                              A JSON file. Omit to read from stdin.
      -h, --help                        Display this help menu.
      -v, --version                     Print version.
      -k, --key, --keybinding           Display key binding.
      -f, --fullscreen                  Display the JSON in fullscreen, in an
                                        alternate buffer
      "--" can be used to terminate flag options and force all following
      arguments to be treated as positional options

    If no file is given, json-tui reads JSON from the standard input
    Please report bugs to:https://github.com/ArthurSonzogni/json-tui/issues

The keybinding are described by:

json-tui --keybinding
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚keys       โ”‚action          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚Navigate   โ”‚โ† โ†‘ โ†“ โ†’         โ”‚
โ”‚           โ”‚h j k l         โ”‚
โ”‚           โ”‚Mouse::WheelUp  โ”‚
โ”‚           โ”‚Mouse::WheelDownโ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚Toggle     โ”‚enter           โ”‚
โ”‚           โ”‚Mouse::Left     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚Deep       โ”‚                โ”‚
โ”‚ - Expand  โ”‚+               โ”‚
โ”‚ - Collapseโ”‚-               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚Exit       โ”‚Escape          โ”‚
โ”‚           โ”‚q               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚Navigate   โ”‚                โ”‚
โ”‚ - first   โ”‚page-up         โ”‚
โ”‚ - last    โ”‚page-down       โ”‚
โ”‚ - top     โ”‚gg              โ”‚
โ”‚ - bottom  โ”‚G               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜