Commit Graph

964 Commits (411f522e5d6c271343aa93dee5395f8f7958a496)

Author SHA1 Message Date
Blaž Hrastnik dd98727bad fix: editor.close now takes only a single parameter 3 years ago
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
Bob 46d9ae2b62
Readline style insert mode (#1039)
* readline style insert mode

* update keymap.md

* don't save change history in insert mode

* Revert "don't save change history in insert mode"

This reverts commit cb47f946d7.

* don't affect register and history in insert mode

* add insert_register

* don't call exit_select_mode in insert mode

* avoid set_selection

* avoid duplicated current!
3 years ago
Cole Helbling c638b6b60e
helix-term/commands: implement buffer-close (bc, bclose) (#1035)
* helix-view/view: impl method to remove document from jumps

* helix-view/editor: impl close_document

* helix-view/editor: remove close_buffer argument from `close`

According to archseer, this was never implemented or used properly. Now
that we have a proper "buffer close" function, we can get rid of this.

* helix-term/commands: implement buffer-close (bc, bclose)

This behaves the same as Kakoune's `delete-buffer` / `db` command:

* With 3 files opened by the user with `:o ab`, `:o cd`, and `:o ef`:
  * `buffer-close` once closes `ef` and switches to `cd`
  * `buffer-close` again closes `cd` and switches to `ab`
  * `buffer-close` again closes `ab` and switches to a scratch buffer
* With 3 files opened from the command line with `hx -- ab cd ef`:
  * `buffer-close` once closes `ab` and switches to `cd`
  * `buffer-close` again closes `cd` and switches to `ef`
  * `buffer-close` again closes `ef` and switches to a scratch buffer
* With 1 file opened (`ab`):
  * `buffer-close` once closes `ab` and switches to a scratch buffer
  * `buffer-close` again closes the scratch buffer and switches to a new
    scratch buffer

* helix-term/commands: implement buffer-close! (bclose!, bc!)

Namely, if you have a document open in multiple splits, all the splits
will  be closed at the same time, leaving only splits without that
document focused (or a scratch buffer if they were all focused on that
buffer).

* helix-view/tree: reset focus if Tree is empty
3 years ago
Cole Helbling 87e61a0894
helix-term/commands: implement cquit (#1096)
This allows you to exit helix with an exit code, e.g. `:cq 2`.
3 years ago
Blaž Hrastnik f5e070e808 minor: Remove leftover log line 3 years ago
Blaž Hrastnik e128a8702e Implement MarkedString rendering
Solves typescript and python documentation rendering
3 years ago
Ivan Tham b7c3877e94
Add movement shortcut for history (#1088)
alt-u and alt-U
3 years ago
ath3 6fa76d9fe7
Add trim_selections command (#1092) 3 years ago
Ebbe Steenhoudt edc976b6bb
Added workspace_symbol_picker (#1041)
* Added workspace_symbol_picker

* Moved truncation of the symbol pickers to the end.

* Fixed typo
3 years ago
ath3 35c974c9c4
Implement "Goto last modification" command (#1067) 3 years ago
Gygaxis Vainhardt 0949a0de7f
Add commit hash to version info, if present (#957)
* Add commit hash to version info, if present

* Rename GIT_HASH to indicate that it includes version, fix linter error

* Add whitespace after use statement

Co-authored-by: Ivan Tham <pickfire@riseup.net>

Co-authored-by: Ivan Tham <pickfire@riseup.net>
3 years ago
Cole Helbling b74912ea78 helix-term/editor: display scratch buffer name in status bar 3 years ago
Cole Helbling b824e091a9
helix-term/commands: move SCRATCH_BUFFER_NAME to helix-view/document (#1091)
This way, the name is accessible everywhere `Document` and related types
are.
3 years ago
Omnikar 6d4409c00f
Make prompts consistent (#1080) 3 years ago
Blaž Hrastnik d3def16584 fix: shift-tab mappings broken after efc2b4c7 3 years ago
NexiNov 187197afb1
Add arrow keys to view mode (#987)
* Add arrow keys to view mode

* Drop C-up and C-down

* Update docs for #987

* Format correctly

* Drop other keymaps

* Correct keymap.md

* Add arrow keys to view mode

Drop C-up and C-down

Update docs for #987

Format correctly

Drop other keymaps

Correct keymap.md

Rebase

Co-authored-by: Rust & Python <nexinov@localhost.gud-o15>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
3 years ago
Omnikar bf95a9ed04
Add `remove_selections` command (#1065)
* Add `remove_selections` command

* Document `remove_selections`

* Update helix-term/src/keymap.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
3 years ago
Ivan Tham 9d591427be
Fix earlier/later missing changeset update (#1069)
Fix #1059
3 years ago
Omnikar d131a9dd0e
Allow keys to be mapped to sequences of commands (#589)
* Allow keys to be mapped to sequences of commands

* Handle `Sequence` at the start of `Keymap::get`

* Use `"[Multiple commands]"` as command sequence doc

* Add command sequence example to `remapping.md`
3 years ago
Cole Helbling bf70cfd050
helix-term/command: make scratch buffer name consistent (#1071) 3 years ago
Omnikar ebc14d9d20
Add `m` textobject for pair under cursor (#961) 3 years ago
Bob 4d22454386
add wonly -- window only (#1057)
* add wonly

* Update book/src/keymap.md

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* add `wonly` to space w mode too

* remove the TODO

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
3 years ago
ath3 c7cb7527be
Fix moving with arrow keys in prompt (#1070) 3 years ago
Gokul Soumya efc2b4c77b
Refactor keyevent handling using key, ctrl macros (#1058)
Adds ctrl! and alt! macros (which existed before the big keymap
refactor) and uses them in event handling of Components. Note
that this converts crossterm's KeyEvent to our own KeyEvent on
each invocation of handle_event in Components.
3 years ago
Gokul Soumya e863e3b62d
Ensure that identical keymaps stay in sync (#1056)
Space mode and view mode are duplicated on two different
keybinds, and they tend to get out of sync by contributers
forgetting to update both of them. This commit adds a test
that explicitly checks that they are identical. Prevents
issues like #1050.
3 years ago
Gokul Soumya f9e9efb3ec Check for duplicate keys in default keymap 3 years ago
Gokul Soumya 80036b8bd3 Change page keybinds in view mode
b which was assigned to page_up conflicts with
align to bottom, so this commit replaces page up,
down, etc keybinds to use normal mode keybinds
(C-f, C-b, etc) in view mode too.
3 years ago
Omnikar 5654909135
Update `space w` window mode (#1050) 3 years ago
Jason Hansen cf831b1a65
Allow piping from stdin into a buffer on startup (#996)
* Allow piping from stdin into a buffer on startup

* Refactor

* Don't allow piping into new buffer on macOS

* Update helix-term/src/application.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* Update helix-term/src/application.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* Fix

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
3 years ago
CossonLeo 68224232af
buffer picker add is_modifier flag (#1020) 3 years ago
Ivan Tham 97893cca64
Restore screen position when abort search (#1047) 3 years ago
Bob 7c9f620236
add <C-h>, <C-u>, <C-d>, Delete in prompt mode (#1034) 3 years ago
CossonLeo a69caff450
search_impl will only align cursor center when it isn't in view (#959) 3 years ago
Omnikar a424ef4e20
Use default `languages.toml` if user's is invalid (#994) 3 years ago
CossonLeo 29e6849413
Add LSP rename_symbol (space-r) (#1011)
improve apply_workspace_edit
3 years ago
Omnikar a252ecd8c8
Add WORD textobject (#991)
* Add WORD textobject

* Document WORD textobject
3 years ago
Omnikar ed23057ff8
Launch with defaults upon invalid config/theme (#982)
* Launch with defaults upon invalid config/theme

* Startup message if there is a problematic config
* Statusline error if trying to switch to an invalid theme

* Use serde `deny_unknown_fields` for config
3 years ago
Blaž Hrastnik 2c1313c064 Specify vector capacity on surround_add 3 years ago
Blaž Hrastnik 1a1685acf7 Simplify current!(..).1 into doc!() 3 years ago
Blaž Hrastnik 0f4cd73000 Simplify goto_*_diagnostic commands 3 years ago
Blaž Hrastnik f659e1178a minor: view!(..).doc is slightly more efficient than current!(..).1.id() 3 years ago
Blaž Hrastnik 4c1321b3b6 minor: Extend search was decclared twice in the keymap 3 years ago
Blaž Hrastnik b81a554424 Retain range direction on search
Co-authored-by: CossonLeo <20379044+cossonleo@users.noreply.github.com>
3 years ago
Blaž Hrastnik 6431b26a6a Implement Selection::replace to replace a single range
Fixes #985

Co-authored-by: Daniel S Poulin <crimsonmage+github@gmail.com>
3 years ago
Gygaxis Vainhardt 911b9b3276
Add reverse search functionality (#958)
* Add reverse search functionality

* Change keybindings for extend to be in select mode, incorporate Movement and Direction enums

* Fix accidental revert of #948 in rebase

* Add reverse search to docs, clean up mismatched whitespace

* Reverse search optimization

* More optimization via github feedback
3 years ago
Omnikar cfc8285867
Allow infoboxes to be disabled (#972)
* Allow infoboxes to be disabled

* Document `infoboxes` default value

* Rename `infoboxes` to `auto_info`

* Document `auto-info`

* Fix incomplete rename
3 years ago
Omnikar 51b4d35dce
Inform when reaching undo/redo bounds (#981)
* Inform when reaching undo/redo bounds

* `Already at oldest change` when undo fails
* `Already at newest change` when redo fails

* Add missing `the`
3 years ago
Blaž Hrastnik 7b65a6d687 Rewrite goto_buffer 3 years ago
ath3 78c68fae91 Implement "Goto next buffer / Goto previous buffer" commands 3 years ago