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

Add "Replace with next/prev value" keys #967

Closed
NNBnh opened this issue Nov 3, 2021 · 0 comments · Fixed by #1027
Closed

Add "Replace with next/prev value" keys #967

NNBnh opened this issue Nov 3, 2021 · 0 comments · Fixed by #1027
Labels
A-keymap Area: Keymap and keybindings C-enhancement Category: Improvements E-good-first-issue Call for participation: Issues suitable for new contributors

Comments

@NNBnh
Copy link
Contributor

NNBnh commented Nov 3, 2021

  • In Vim the number under the cursor will increment or decrement when you hit Ctrl + A or Ctrl + X (respectively).
  • Kakoune user can install kakoune-inc-dec plugin to achieve the similar feature.
  • The best implementation of this feature is probably from VScode:

From "Key Bindings for Visual Studio Code":

Replace with Next Value: Ctrl + Shift + .
Replace with Previous Value: Ctrl + Shift + ,

From some Stackoverflow answers:

If I press the shortcut after highlighting an integer or float literal (16 or 5.2 for example) it subtracts 1 from it.
Strangely, Replace with Previous Value adds 1 to the value while Replace with Next Value subtracts 1.

If you use it on a boolean, it toggles between true and false.

I guess we could implement this via tree-sitter.

@NNBnh NNBnh added the C-enhancement Category: Improvements label Nov 3, 2021
@kirawi kirawi added A-keymap Area: Keymap and keybindings E-good-first-issue Call for participation: Issues suitable for new contributors labels Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-keymap Area: Keymap and keybindings C-enhancement Category: Improvements E-good-first-issue Call for participation: Issues suitable for new contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants