Merge branch 'helix-editor:master' into pull-diagnostics

This commit is contained in:
SofusA 2024-07-25 11:09:07 +02:00 committed by GitHub
commit 33860d73a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 45 additions and 25 deletions

View File

@ -10,6 +10,7 @@ # Summary
- [Surround](./surround.md) - [Surround](./surround.md)
- [Textobjects](./textobjects.md) - [Textobjects](./textobjects.md)
- [Syntax aware motions](./syntax-aware-motions.md) - [Syntax aware motions](./syntax-aware-motions.md)
- [Pickers](./pickers.md)
- [Keymap](./keymap.md) - [Keymap](./keymap.md)
- [Commands](./commands.md) - [Commands](./commands.md)
- [Language support](./lang-support.md) - [Language support](./lang-support.md)

View File

@ -436,6 +436,8 @@ ## Select / extend mode
## Picker ## Picker
Keys to use within picker. Remapping currently not supported. Keys to use within picker. Remapping currently not supported.
See the documentation page on [pickers](./pickers.md) for more info.
[Prompt](#prompt) keybinds also work in pickers, except where they conflict with picker keybinds.
| Key | Description | | Key | Description |
| ----- | ------------- | | ----- | ------------- |

11
book/src/pickers.md Normal file
View File

@ -0,0 +1,11 @@
## Using pickers
Helix has a variety of pickers, which are interactive windows used to select various kinds of items. These include a file picker, global search picker, and more. Most pickers are accessed via keybindings in [space mode](./keymap.md#space-mode). Pickers have their own [keymap](./keymap.md#picker) for navigation.
### Filtering Picker Results
Most pickers perform fuzzy matching using [fzf syntax](https://github.com/junegunn/fzf?tab=readme-ov-file#search-syntax). Two exceptions are the global search picker, which uses regex, and the workspace symbol picker, which passes search terms to the LSP. Note that OR operations (`|`) are not currently supported.
If a picker shows multiple columns, you may apply the filter to a specific column by prefixing the column name with `%`. Column names can be shortened to any prefix, so `%p`, `%pa` or `%pat` all mean the same as `%path`. For example, a query of `helix %p .toml$ !lang` in the global search picker searches for the term "helix" within files with paths ending in ".toml" but not including "lang".
You can insert the contents of a [register](./registers.md) using `Ctrl-r` followed by a register name. For example, one could insert the currently selected text using `Ctrl-r`-`.`, or the directory of the current file using `Ctrl-r`-`%` followed by `Ctrl-w` to remove the last path section. The global search picker will use the contents of the [search register](./registers.md#default-registers) if you press `Enter` without typing a filter. For example, pressing `*`-`Space-/`-`Enter` will start a global search for the currently selected text.

View File

@ -2,23 +2,31 @@
# Bash completion script for Helix editor # Bash completion script for Helix editor
_hx() { _hx() {
# $1 command name local cur prev languages
# $2 word being completed COMPREPLY=()
# $3 word preceding cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD - 1]}"
case "$3" in case "$prev" in
-g | --grammar) -g | --grammar)
COMPREPLY="$(compgen -W 'fetch build' -- $2)" COMPREPLY=($(compgen -W 'fetch build' -- "$cur"))
return 0
;; ;;
--health) --health)
local languages=$(hx --health |tail -n '+7' |awk '{print $1}' |sed 's/\x1b\[[0-9;]*m//g') languages=$(hx --health | tail -n '+7' | awk '{print $1}' | sed 's/\x1b\[[0-9;]*m//g')
COMPREPLY="$(compgen -W """$languages""" -- $2)" COMPREPLY=($(compgen -W """$languages""" -- "$cur"))
;; return 0
*)
COMPREPLY="$(compgen -fd -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -c --config --log" -- """$2""")"
;; ;;
esac esac
local IFS=$'\n' case "$2" in
COMPREPLY=($COMPREPLY) -*)
COMPREPLY=($(compgen -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -c --config --log" -- """$2"""))
return 0
;;
*)
COMPREPLY=($(compgen -fd -- """$2"""))
return 0
;;
esac
} && complete -o filenames -F _hx hx } && complete -o filenames -F _hx hx

View File

@ -284,10 +284,8 @@ fn find_completion_range(text: RopeSlice, replace_mode: bool, cursor: usize) ->
if replace_mode { if replace_mode {
end += text end += text
.chars_at(cursor) .chars_at(cursor)
.skip(1)
.take_while(|ch| chars::char_is_word(*ch)) .take_while(|ch| chars::char_is_word(*ch))
.count() .count();
+ 1;
} }
(start, end) (start, end)
} }

View File

@ -3073,7 +3073,7 @@ source = { git = "https://github.com/lefp/tree-sitter-opencl", rev = "8e1d24a570
[[language]] [[language]]
name = "just" name = "just"
scope = "source.just" scope = "source.just"
file-types = [{ glob = "justfile" }, { glob = "Justfile" }, { glob = ".justfile" }, { glob = ".Justfile" }] file-types = ["just", { glob = "justfile" }, { glob = "Justfile" }, { glob = ".justfile" }, { glob = ".Justfile" }]
injection-regex = "just" injection-regex = "just"
comment-token = "#" comment-token = "#"
indent = { tab-width = 4, unit = " " } indent = { tab-width = 4, unit = " " }

View File

@ -997,12 +997,12 @@ lines.
of 2 highlighted characters to jump to the corresponding label, of 2 highlighted characters to jump to the corresponding label,
or use ESC to drop the labels. or use ESC to drop the labels.
The 2-character labels allow to quickly jump to any location The 2-character labels allow you to quickly jump to any location
in the viewable selection. in the viewable selection.
1. Move the cursor to the start of the line marked '-->' below. 1. Move the cursor to the start of the line marked '-->' below.
2. Press gw to enable the 2-character labels, and then the two 2. Press gw to enable the 2-character labels, and then the two
characters that replace the two leters he at the start of characters that replace the two letters he at the start of
here to jump to the corresponding word. here to jump to the corresponding word.
--> This is just a simple line of text. --> This is just a simple line of text.
@ -1023,8 +1023,8 @@ lines.
* Press Ctrl-i and Ctrl-o to go forward and backward in the * Press Ctrl-i and Ctrl-o to go forward and backward in the
jumplist. jumplist.
* Type gw to enable 2-characters labels, and any 2 characters * Type gw to enable 2-character labels, and any 2 characters to
to jump to the corresponding label, or ESC to drop the labels. jump to the corresponding label, or ESC to drop the labels.