aboutsummaryrefslogtreecommitdiff
path: root/book/src
diff options
context:
space:
mode:
authorJason Hansen2021-11-15 15:32:58 +0000
committerGitHub2021-11-15 15:32:58 +0000
commit6cb35d28a878470ef742b813e1e8d412d09e6b52 (patch)
tree40b3ee4e697f3b41f22b0bdff1b87569eed8c644 /book/src
parent46d9ae2b62f5b8494c527e0f8475509ce5fad095 (diff)
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
Diffstat (limited to 'book/src')
-rw-r--r--book/src/keymap.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/book/src/keymap.md b/book/src/keymap.md
index 7a896035..335e393b 100644
--- a/book/src/keymap.md
+++ b/book/src/keymap.md
@@ -72,6 +72,8 @@
| `=` | Format selection (**LSP**) | `format_selections` |
| `d` | Delete selection | `delete_selection` |
| `c` | Change selection (delete and enter insert mode) | `change_selection` |
+| `Ctrl-a` | Increment object (number) under cursor | `increment` |
+| `Ctrl-x` | Decrement object (number) under cursor | `decrement` |
#### Shell