helix-mods/helix-term/src
Jason Hansen 6cb35d28a8
Add command to inc/dec number under cursor (#1027)
* Add command to inc/dec number under cursor

With the cursor over a number in normal mode, Ctrl + A will increment the
number and Ctrl + X will decrement the number. It works with binary, octal,
decimal, and hexidecimal numbers. Here are some examples.

0b01110100
0o1734
-24234
0x1F245

If the number isn't over a number it will try to find a number after the
cursor on the same line.

* Move several functions to helix-core

* Change to work based on word under selection

* It no longer finds the next number if the cursor isn't already over
  a number.
* It only matches numbers that are part of words with other characters
  like "foo123bar".
* It now works with multiple selections.

* Add some unit tests

* Fix for clippy

* Simplify some things

* Keep previous selection after incrementing

* Use short word instead of long word

This change requires us to manually handle minus sign.

* Don't pad decimal numbers if no leading zeros

* Handle numbers with `_` separators

* Refactor and add tests

* Move most of the code into core
* Add tests for the incremented output

* Use correct range

* Formatting

* Rename increment functions

* Make docs more specific

* This is easier to read

* This is clearer

* Type can be inferred
2021-11-16 00:32:58 +09:00
..
ui Readline style insert mode (#1039) 2021-11-16 00:31:20 +09:00
application.rs helix-term/commands: implement cquit (#1096) 2021-11-15 13:06:12 +09:00
args.rs Implement hx --tutor and :tutor to load tutor.txt (#898) 2021-10-28 10:23:46 +09:00
commands.rs Add command to inc/dec number under cursor (#1027) 2021-11-16 00:32:58 +09:00
compositor.rs Fix doctest broken on 2021 edition 2021-10-22 12:47:02 +09:00
config.rs Launch with defaults upon invalid config/theme (#982) 2021-11-07 00:57:14 +09:00
job.rs Drop some &mut bounds where & would have sufficed 2021-09-06 15:25:46 +09:00
keymap.rs Add command to inc/dec number under cursor (#1027) 2021-11-16 00:32:58 +09:00
lib.rs Remove #[allow(unused)] from helix-term, and fix unused imports. 2021-07-01 19:06:52 -07:00
main.rs helix-term/commands: implement cquit (#1096) 2021-11-15 13:06:12 +09:00