nushell / nushell/reedline

Vi Normal movement key rebind break the visual/select mode.

Open
#1,007 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
817
Forks
247
Avg merge
4d 14h
Merged PRs (30d)
30

Description

Platform and Terminal


fastfetch
                  -`                     ***@***
                 .o+`                    ------------------------
                `ooo/                    OS: Arch Linux x86_64
               `+oooo:                   Kernel: Linux 6.18.5-arch1-1
              `+oooooo:                  Uptime: 5 hours
              -+oooooo+:                 Packages: 1591 (pacman), 5 (flatpak-system), 10 (flatpak-user)
            `/:-:++oooo+:                Shell: nushell 0.109.1
           `/++++/+++++++:               Display (LC49G95T): 5120x1440 in 49", 240 Hz [External]
          `/++++++++++++++:              DE: COSMIC 1.0.0
         `/+++ooooooooooooo/`            WM: cosmic-comp (Wayland)
        ./ooosssso++osssssso+`           Cursor: Adwaita
       .oossssso-````/ossssss+`          Terminal: cosmic-term 0.1.0
      -osssssso.      :ssssssso.         Terminal Font: Noto Sans Mono (14px)
     :osssssss/        osssso+++.        CPU: AMD Ryzen 5 7600X (12) @ 5.46 GHz
    /ossssssss/        +ssssooo/-        GPU 1: AMD Radeon RX 7900 XTX [Discrete]
  `/ossssso+/:-        -:/+osssso+-      GPU 2: AMD Raphael [Integrated]
 `+sso+:-`                 `.-/+oso:     Memory: 12.96 GiB / 30.50 GiB (42%)
`++:.                           `-/+/    Swap: 20.00 KiB / 15.25 GiB (0%)
.`                                 `/    Disk (/): 57.02 GiB / 97.87 GiB (58%) - ext4
                                         Disk (/home): 478.00 GiB / 1.69 TiB (28%) - ext4
                                         Disk (/run/media/***/***): 43.93 MiB / 14.70 GiB (0%) - vfat [External]
                                         Local IP (eno1): ***.***.***.***/24
                                         Locale: en_US.UTF-8



When rebinding the vi-normal mode movement keys (hjkl) to (ijkl), the "visual mode" does not work anymore.
Indeed pressing v and then moving left and right does not select anymore.

Steps to reproduce

In your config.nu, use these keybindings.

Keybindings


$env.config.keybindings ++= [{
  name: Vi_Insert
  modifier: none
  keycode: char_h
  mode: vi_normal
  event: {
    send: vichangemode
    mode: insert
  }
}]
$env.config.keybindings ++= [{
  name: Vi_Insert_Line_Start
  modifier: shift
  keycode: char_h
  mode: vi_normal
  event: [{
    edit: movetolinestart
  }
  {
    send: vichangemode
    mode: insert
  }]
}]
$env.config.keybindings ++= [{
  name: moveUp
  modifier: none
  keycode: char_i
  mode: vi_normal
  event: {
    send: up
  }
}]
$env.config.keybindings ++= [{
  name: moveDown
  modifier: none
  keycode: char_k
  mode: vi_normal
  event: {
    send: down
  }
}]
$env.config.keybindings ++= [{
  name: moveLeft
  modifier: none
  keycode: char_j
  mode: vi_normal
  event: {
    edit: moveleft
  }
}]
$env.config.keybindings ++= [{
  name: moveRight
  modifier: none
  keycode: char_l
  mode: vi_normal
  event: {
    edit: moveright
  }
}]

I went through the docs and did not find anything about v or the visual mode.
By the way, the ViChangeMode mode: insert was also something I had to guess. I also did not find it in the docs.

Am I missing something?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

First reproduce the issue with the provided config.nu keybindings by entering vi-normal mode, pressing v, and moving left or right. Then trace Reedline's vi-normal and visual-mode keybinding handling, including the documented or undocumented mode-change events; done means rebinding hjkl to ijkl still selects text in visual mode and the relevant v and mode-change behavior is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.