Commit Graph

2131 Commits (136704b3fbe96c81748c42ff533c4d704f9ebf64)

Author SHA1 Message Date
Michael Davis 136704b3fb
WIP explore more commands on generic types 1 year ago
Michael Davis 71b6cc4d17
Implement a Component command for closing a buffer picker buffer
This is a basic example of a remappable command specific to a single
Component. It could be remapped like so:

    ```toml
    [keys.buffer-picker]
    C-d = "close_buffer_in_buffer_picker"
    ```

This has some rough edges:

* Can we namespace the commands so they don't all have to be very long
  and specific about which component they work for?
* How can we make this work for generics?
    * We can't define commands that operate on a `Picker<_>` for
      example. This example only works because we're using a
      `Picker<BufferMeta>`.
    * For Pickers and Menus we could use a `Vec<Box<dyn Item>>` and drop
      the generics but that would lose static dispatch.
    * Could we separate the part that needs generics into a different
      struct and have the functions operate on that?
1 year ago
Michael Davis 5ca3ed3ef8
Expose IDs to be used for parsing component names
This is just the picker for now but could be expanded to other
components.
1 year ago
Michael Davis 21169c77fd
keymap: Allow looking up by Component ID
Previously we only split key tries by editor Mode. This commit changes
that to allow other "domain"s like Component IDs. We'll use the
Component IDs later so that a Component like a Picker can look up
keybindings for itself.

The naming is a bit of a placeholder. The hashmap could just use
`&'static str` and we could add a From for Mode. But I'd like the key to
have some sort of formal name to it.
1 year ago
Michael Davis d6fc6a54b2
Move Keymaps from EditorView to Context structs
We'll need this value when attempting to execute keymaps for other
Components. Previously it was only scoped to the EditorView.
1 year ago
Pascal Kuthe a0359f7f22 make TS matching fallback to plaintext 1 year ago
Michael Davis 9690e0b733
Fix Component implementations for Picker (#7382) 1 year ago
Gokul Soumya f18acadbd0
Completely remove old Picker and rename FilePicker to Picker 1 year ago
Michael Davis 545acfda88
Make file preview callback optional
When Picker and FilePicker are merged, not all Pickers will be able to
show a preview.

Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
1 year ago
Gokul Soumya fc111213b5
Move FilePicker struct def closer to impl block 1 year ago
Gokul Soumya 15cc09fc81
Render the preview in FilePicker 1 year ago
Gokul Soumya 34c8f9ab73
Move Picker::render into FilePicker::render 1 year ago
Gokul Soumya 49fbf8df53
Move Component methods except render() to FilePicker 1 year ago
Gokul Soumya 1e66e9198c
Move handle_event methods from Picker to FilePicker 1 year ago
Gokul Soumya 8516f43837
Move navigation methods from Picker to FilePicker 1 year ago
Gokul Soumya 7a058c7361
Move scoring functions from Picker to FilePicker 1 year ago
Gokul Soumya 104036bd7f
Copy struct fields and new() from Picker to FilePicker 1 year ago
Gokul Soumya 40916dff63
Move FilePicker::render from Component impl to normal impl
Merges the code for the Picker and FilePicker into a single Picker that
can show a file preview if a preview callback is provided. This change
was mainly made to facilitate refactoring out a simple skeleton of a
picker that does not do any filtering to be reused in a normal Picker
and a DynamicPicker (see #5714; in particular [mikes-comment] and
[gokuls-comment]).

The crux of the issue is that a picker maintains a list of predefined
options (eg. list of files in the directory) and (re-)filters them every
time the picker prompt changes, while a dynamic picker (eg. interactive
global search, #4687) recalculates the full list of options on every
prompt change. Using a filtering picker to drive a dynamic picker hence
does duplicate work of filtering thousands of matches for no reason. It
could also cause problems like interfering with the regex pattern in the
global search.

I tried to directly extract a PickerBase to be reused in Picker and
FilePicker and DynamicPicker, but the problem is that DynamicPicker is
actually a DynamicFilePicker (i.e. it can preview file contents) which
means we would need PickerBase, Picker, FilePicker, DynamicPicker and
DynamicFilePicker and then another way of sharing the previewing code
between a FilePicker and a DynamicFilePicker. By merging Picker and
FilePicker into Picker, we only need PickerBase, Picker and
DynamicPicker.

[gokuls-comment]: https://github.com/helix-editor/helix/issues/5714#issuecomment-1410949578
[mikes-comment]: https://github.com/helix-editor/helix/issues/5714#issuecomment-1407451963
1 year ago
spectre256 d8b7232a47
Add yank_joined command (#7195)
Resolves issue #6888 by adding a command to join all selections and yank
them to the specified register. The typed command takes an argument as
the separator to use when joining the selections.
1 year ago
Alex 3fb9fafb2a
Add config for default line ending (#5621) 1 year ago
A-Walrus 4d8c9a394e
Preview scratch buffers in jumplist picker (#7331) 1 year ago
Zisulin Morbrot fbd22afe29
Add rl and rla aliasses for reload and reload-all commands (#7158) 1 year ago
Robert 015c079acc
Add reverse_selection_contents (#7329) 1 year ago
dependabot[bot] 0e42e4e193
build(deps): bump libc from 0.2.145 to 0.2.146 (#7327)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 year ago
dependabot[bot] 0d998c99d4
build(deps): bump tempfile from 3.5.0 to 3.6.0 (#7326)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 year ago
Philipp Mildenberger 2a11fb485d
Fix underflow when repeating a completion that has a negative shift position (#7322) 1 year ago
0xHiro / ヒロ 8c6eb88c6a
fix: add file argument in help text (#7307) 1 year ago
Luca Schlecker dbd248fdfa add config option for instant completion entry preview (defaulting to true).
Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
1 year ago
spectre256 00b152facd
Add register statusline element (#7222) 1 year ago
Alex 993c68ad6f
Auto indent on `insert_at_line_start` (#5837) 1 year ago
Michael Davis d4427125eb
Bail if no language servers support workspace symbols (#7286) 1 year ago
vwkd 352d1574a6
add move_prev_long_word_end and extend_prev_long_word_end (#6905) 1 year ago
Michael Davis b3949979ae Propagate the count and register to command palette commands
Previously a count or register selection would be lost while opening
the command palette. This change allows using a register selection or
count in any command chosen from the command palette.
1 year ago
Michael Davis 0e083497a5 Persist register selection in pending keymaps
Previously the register selection (via `"`) would be lost in the middle
of any key sequence longer than one key. For example, `<space>f` would
clear the register selection after the `<space>` making it inaccessible
for the `file_picker` command.

This behavior does not currently have any effect in the default keymap
but might affect custom keymaps. This change aligns the behavior of the
register with count. Making this change allows propagating the register
to the `command_palette` (see the child commit) or other pickers should
we decide to use registers in those in the future. (Interactive global
search for example.)
1 year ago
Alex Vinyals 204bac1706
commands(toggle): use pattern matching on the Value enum (#7240) 1 year ago
gibbz00 9926c2d292 Remove Keymap(KeyTrie) and simply use KeyTrie. 1 year ago
gibbz00 b8563685ec Move `keymap.reverse_keymap()` to `Keytrie`:
The plan is let `Keymaps` simply store `KeyTrie`s, as the `Keymap(Keytrie)` wrapping serves little to no purpose.
1 year ago
gibbz00 eda4c79f2f Remove pub keymap.name();
`keymap.name` is only used internally.
1 year ago
gibbz00 3d0bc72099 Place `Info::from_keymap()` contents in `keymap.infobox()`:
This makes it easier later control the order in which the key events
are presented.
1 year ago
gibbz00 19326d23d1 Keymap infobox: Idiomatic body tuple.
Does not change any behavior other than making the tuple slightly
more idiomatic.  Keymap infobox shows key events, then the respective
description. This commit makes sure that order is used from the get go,
rather than flipping it midway.
1 year ago
gibbz00 3a0892f793 Exclude config no_op bindings in command palette. 1 year ago
gibbz00 39773e48d3 Remove superfluous command description pruning for keymap infobox:
Exist under the wrong (possibly just outdated) assumption that command
descriptions are written with their `KeyTrie` name prefixed
1 year ago
gibbz00 d20c1632a7 `helix_term::keymap`: Remove one-liner solely used for a test. 1 year ago
gibbz00 f7df53c948 Make `Keymap` a tuple struct. 1 year ago
gibbz00 daea97a89f keymap: Rename KeyTrie::Leaf -> KeyTrie::MapppableCommand
The variant Sequence is technically also a leaf.
1 year ago
gibbz00 a56af221d7 keymap: Derive `Default` for KeyTrieNode 1 year ago
dependabot[bot] 6deb0e4ef7
build(deps): bump once_cell from 1.17.2 to 1.18.0 (#7248)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 year ago
dependabot[bot] cd01dc886a
build(deps): bump libc from 0.2.144 to 0.2.145 (#7244)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 year ago
Alex Vinyals a2b8cfdb8c
feat(core): add plaintext matching fallback to tree-sitter matching (#4288) 1 year ago
Michael Davis 428d33ab50
Exit gracefully on termination signals (#7236) 1 year ago