* feat(commands): command palette
Add new command to display command pallete that can be used
to discover and execute available commands.
Fixes: https://github.com/helix-editor/helix/issues/559
* Make picker take the whole context, not just editor
* Bind command pallete
* Typable commands also in the palette
* Show key bindings for commands
* Fix tests, small refactor
* Refactor keymap mapping, fix typo
* Ignore sequence key bindings for now
* Apply suggestions
* Fix lint issues in tests
* Fix after rebase
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
This code:
let start = ensure_grapheme_boundary_next(text, text.byte_to_char(start));
let end = ensure_grapheme_boundary_next(text, text.byte_to_char(end));
Would convert byte to char index, but then internally immediately convert back
to byte index, operate on it, then convert it to char index.
This change reduces the amount of time spent in ensure_grapheme_boundary from
29% to 2%.
* feat(ui): file encoding in statusline
Display file encoding in statusline if the encoding
isn't UTF-8.
* Re-export encoding_rs from core
From there it can be imported by other mods
that rely on it.
* Macros WIP
`helix_term::compositor::Callback` changed to take a `&mut Context` as
a parameter for use by `play_macro`
* Default to `@` register for macros
* Import `KeyEvent`
* Special-case shift-tab -> backtab in `KeyEvent` conversion
* Move key recording to the compositor
* Add comment
* Add persistent display of macro recording status
When macro recording is active, the pending keys display will be shifted
3 characters left, and the register being recorded to will be displayed
between brackets — e.g., `[@]` — right of the pending keys display.
* Fix/add documentation
1. pressing o on a line with no indentation will open a new line as
expected, but esc will then delete the line altogether
2. the kill_line behavior happens after insert mode changes are already
commited to history, and the change isn't commited. pressing u after
this will break highlighting & undo history
This reverts commit c08d2fae58.
Tree sitter returns an index referring to the position of the scope in
the scopes array. We can use that same index to avoid a hashmap lookup
and instead store the styles in an array.
This currently stores the styles in both a map and an array because the
UI still uses hashmap lookups, but it's a reasonable tradeoff.
* restore indent when press esc right after open a new line
* add comment for restore_indent
* fix, and make kill to line end behaves like emacs
* update comment
* fix comment
* adjust cancel restore_indent situation
* check esc logic in mode transaction
* improve comment
* add more check for dedent
* update comment
* use matches to check for last_cmd
* no need to introduct CommandFun type
* Jump to end char of surrounding pair from any cursor pos
* Separate bracket matching into exact and fuzzy search
* Add constants for bracket chars
* Abort early if char under cursor is not a bracket
* Simplify bracket char validation
* Refactor node search and unify find methods
* Remove bracket constants
* 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`
* Improve statusline
* Change diagnostic count display to show counts of individual
diagnostic types next to their corresponding gutter dots.
* Add selection count to the statusline.
* Do not display info or hint count in statusline
* Reduce padding
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Reduce padding
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Use `Span::styled`
* Reduce padding
* Use `Style::patch`
* Remove unnecessary `Cow` creation
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>