You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
helix/helix-core/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
3 years ago
..
auto_pairs.rs Document more of helix-core (#904) 3 years ago
chars.rs Document more of helix-core (#904) 3 years ago
comment.rs Specify capacity on toggle_line_comments 3 years ago
diagnostic.rs Make sure document diagnostics are sorted 3 years ago
diff.rs Remove ExactSizeIterator requirement on Transaction::change 3 years ago
graphemes.rs Add hyperlinks to fix `cargo doc` warn (#931) 3 years ago
history.rs Add movement shortcut for history (#1088) 3 years ago
indent.rs Detect filetype from shebang line (#1001) 3 years ago
lib.rs Add command to inc/dec number under cursor (#1027) 3 years ago
line_ending.rs Mark a few functions as `const` 3 years ago
macros.rs Split parts of helix-term into helix-view. 4 years ago
match_brackets.rs Adds single and double quotes to matching pairs (#995) 3 years ago
movement.rs Add trim_selections command (#1092) 3 years ago
numbers.rs Add command to inc/dec number under cursor (#1027) 3 years ago
object.rs select smaller range on some case 3 years ago
path.rs Move path util functions from helix-term to helix-core (#650) 3 years ago
position.rs Ensure coords in screen depends on char width (#885) 3 years ago
register.rs Mark a few functions as `const` 3 years ago
search.rs Switch to a cleaner range-head moving abstraction. 3 years ago
selection.rs Add `remove_selections` command (#1065) 3 years ago
state.rs Reduce State use a bit further 3 years ago
surround.rs Fix buggy surround behavior from #376. 3 years ago
syntax.rs Use default `languages.toml` if user's is invalid (#994) 3 years ago
textobject.rs Add WORD textobject (#991) 3 years ago
transaction.rs completion: fully revert state before apply & insertText common prefix 3 years ago