Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing and broken vi mode balance match for {brace} and [bracket]. #550

Open
miltieIV2 opened this issue Jan 6, 2025 · 1 comment
Open
Labels
bug NYI/NewFeat Not yet implemented or New Feature

Comments

@miltieIV2
Copy link

$ ble summary

ble summary
GNU bash, version 5.2.37(1)-release (aarch64-apple-darwin23.4.0)
ble.sh, version 0.4.0-nightly+3d8f626 (noarch) [git 2.47.1, GNU Make 4.3, GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)]
bash-completion, version 2.16.0 (hash:480ffcc6a751e55621ec526eb5dea7a0d86d9e72, 17877 bytes) (noarch)
fzf key-bindings, (hash:c4dce3ba5bfafecbc6c47695f89ef02c305b984e, 5524 bytes) (noarch)
WARNING: fzf integration "integration/fzf-key-bindings" is not activated.
fzf completion, (hash:db84e06a1ee5fb43bc6ad1aaeec6657cad79c917, 14523 bytes) (noarch) (integration: on)
bash-preexec (.iterm2_shell_integration.bash), (hash:f860a1934587f8b5a23170c68a63e55ba5b2dfaf, 24470 bytes) (noarch)
starship, version 1.21.1 (rustc 1.81.0 (eeb90cda1 2024-09-04) (Homebrew), 2024-10-18 16:27:23 +00:00)
atuin, version 18.4.0 (/opt/homebrew/bin/atuin)
locale: LANG=en_US.UTF-8 LC_TERMINAL=iTerm2 LC_TERMINAL_VERSION=3.5.12beta1
terminal: TERM=xterm-256color wcwidth=15.0-west/16.0-2+ri, xterm:2500 (64;2500;0)
options: -emacs +ignoreeof +notify +vi +extglob +histappend -hostcomplete +inherit_errexit +login_shell

vi mode supports cursor movement to the matching parentheses with the "%" command (put the cursor on either open or close parentheses and type % to move to the matching)

echo 'Test of parentheses ((test paren)) {{test brace}} [[test bracket]] <<test ltgt>> matching'

The percent command works great for () - jumps to the first "(", then to the match, yay!
but does not work for {}, [] , or <>.
When the next open is "{" or "[" "<", nothing happens (not even a beep).
When the "%" command is typed on a closing "}" or "]" (not ">"), the cursor jumps back to the sort-of matching "(", then gets trapped there.

Match failures with "%" - where there is no balance match - does not beep.

Not very many vi-mode-things recognize <> as a balance matching thing.

@akinomyoga
Copy link
Owner

Ah, OK. This is a typo here:

ble.sh/lib/keymap.vi.sh

Lines 4554 to 4555 in 3d8f626

if [[ $ch1 == ["$open"] ]]; then
local i=${open%%"$ch"*}; i=${#i}

"$ch" should be "$ch1".

@akinomyoga akinomyoga added bug NYI/NewFeat Not yet implemented or New Feature labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug NYI/NewFeat Not yet implemented or New Feature
Projects
None yet
Development

No branches or pull requests

2 participants