Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify and clarify config loading #5636

Closed
wants to merge 225 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
225 commits
Select commit Hold shift + click to select a range
4e4873d
docs: add section about local config, written like the one for languages
AlexanderBrevig Jul 28, 2022
1e9bee3
fix: mistakes were made
AlexanderBrevig Jul 28, 2022
04da5ee
fix: cleaner code
AlexanderBrevig Aug 29, 2022
6ad3fb3
fix: after rebase, reinstate editor.security
AlexanderBrevig Aug 30, 2022
a53a008
fix: configuration book entry after rebase
AlexanderBrevig Aug 30, 2022
f93e2d1
fix: clippy from rebase
AlexanderBrevig Aug 30, 2022
e6e6ec3
fix: use reduce and not fold
AlexanderBrevig Sep 1, 2022
ed9aa60
fix: early exit
AlexanderBrevig Sep 1, 2022
3da3606
style: clippy ok
AlexanderBrevig Sep 1, 2022
9359c45
style: no need to else after early exit, golang style
AlexanderBrevig Sep 9, 2022
a0f80cd
fix: remove confirm_local_config
Sep 19, 2022
11aa418
fix: remove confirm option from book
AlexanderBrevig Sep 23, 2022
8acc1b9
style: merged an if statement
AlexanderBrevig Sep 23, 2022
0f31164
style: ...and early return
AlexanderBrevig Sep 24, 2022
43470cc
fix: default to loading configs
AlexanderBrevig Sep 26, 2022
671f297
Make stickiness configurable
bbodi Oct 9, 2022
84b4f12
docs: fix typos
AlexanderBrevig Nov 18, 2022
09ea56b
Add support for labels in custom menu keymaps
MattCheely Sep 24, 2022
608687d
Add support for labels on typable commands
MattCheely Sep 24, 2022
091b3f5
refactor keymap map visitor to reduce # of cases
MattCheely Sep 25, 2022
56d624e
Simplify labelled command pattern match
MattCheely Oct 4, 2022
3642213
Add some basic docs
MattCheely Oct 18, 2022
7804572
fix typos in menu label docs
MattCheely Nov 15, 2022
0e6c4af
return errors for ambiguous and unsupported labels in menus
MattCheely Nov 16, 2022
294d1a1
Generalised to multiple runtime directories with priorities
paul-scott Jan 5, 2023
b642e90
Removed AsRef usage to avoid binary growth
paul-scott Jan 11, 2023
c4620ff
Health displaying ;-separated runtime dirs
Jan 18, 2023
5a0a1db
Changed HELIX_RUNTIME build from src instructions
Jan 18, 2023
6d50d7f
remove one-liner solely used for a test
gibbz00 Dec 17, 2022
37f49f6
Inline helper fuction of singular reference
gibbz00 Dec 17, 2022
c748f7c
Remove order property of KeyTrie struct:
gibbz00 Dec 17, 2022
2c7c4d9
Infobox: Remove superflous command descripition pruning:
gibbz00 Dec 17, 2022
8d35e64
Keymap infobox: Use Vec in place of BTree:
gibbz00 Dec 17, 2022
f187f2d
Keymap infobox: Place in correct order from start:
gibbz00 Dec 17, 2022
2a0e9d2
Keymap infobox: Format body from start
gibbz00 Dec 17, 2022
faec827
keymap.rs file splitting, cleanup and descriptive naming:
gibbz00 Dec 26, 2022
d5520e8
Rename MappableCommand field doc to description:
gibbz00 Dec 26, 2022
aea10f7
Initial sorting of keymap info window
gibbz00 Dec 26, 2022
7f86d01
Infobox: Consistently place lowercase equivalents first
gibbz00 Dec 27, 2022
7935f77
Remove infobox optimization suggestion comment:
gibbz00 Dec 27, 2022
0482d09
keymap testing touchups
gibbz00 Dec 27, 2022
6b01af5
Exclude config no_op bindings in command palette.
gibbz00 Dec 27, 2022
7a8397c
Cleaner infobox join operation
gibbz00 Dec 27, 2022
546010b
use statement cleanups
gibbz00 Dec 28, 2022
036ce4a
Move Config related tests from keymap tests Config tests
gibbz00 Dec 28, 2022
ac98d82
Config test cleanup
gibbz00 Dec 28, 2022
109228b
Load keymap config consistently
gibbz00 Dec 29, 2022
527198a
Make use of new self context in keymap config load
gibbz00 Dec 29, 2022
917ca0d
Minor keymap module visibilyti cleanup
gibbz00 Dec 29, 2022
8b8fadb
Renamed the keymap! macro to keytrie!:
gibbz00 Dec 29, 2022
7747777
Fix failed cherry picks
gibbz00 Jan 19, 2023
342f794
Removed keymap::Keymap:
gibbz00 Dec 29, 2022
020c53a
Switched keymap::keymaps::Keymaps to keymap::Keymap
gibbz00 Dec 30, 2022
bda06bc
Re-implemented pre-defined orders in keytrie
gibbz00 Jan 20, 2023
87fc571
Add sort_infobox editor config option
gibbz00 Jan 21, 2023
ecf5d61
Refine sorting behavior
gibbz00 Jan 22, 2023
5e7f4a0
Removed warnings
gibbz00 Jan 22, 2023
c88a817
Use .join(", ") rather that own implementation
gibbz00 Jan 22, 2023
2f0fa30
Fix apply_trasaction rebase fail
gibbz00 Jan 22, 2023
f3de1fb
Configuration -> LanguageConfigurations
gibbz00 Jan 14, 2023
55fb3e1
user_lang_config -> merged_lang_config
gibbz00 Jan 14, 2023
34f4380
Enforce separation of concerns in config loading
gibbz00 Jan 14, 2023
e3ec215
Move --help message to separate file.
gibbz00 Jan 14, 2023
cab5aac
help.rs: use named parameters
gibbz00 Jan 14, 2023
88bd9cc
Fix error prone config setup in main
gibbz00 Jan 14, 2023
11248c1
Consistent exit handling
gibbz00 Jan 14, 2023
3cd0042
Missed dual config setup in main.
gibbz00 Jan 14, 2023
8c5700d
X Setup coherent config loading API
gibbz00 Jan 14, 2023
e6c49ad
Fix failing test
gibbz00 Jan 22, 2023
1dfe855
Merge remote-tracking branch 'myfork/keymap-presentation' into unify-…
gibbz00 Jan 22, 2023
3d52c7a
Fix failing test
gibbz00 Jan 22, 2023
55a64f8
Merge remote-tracking branch 'myfork/keymap-presentation' into unify-…
gibbz00 Jan 22, 2023
1eaaf2d
Fix failing test
gibbz00 Jan 22, 2023
6aec856
lib.rs cleanup
gibbz00 Jan 15, 2023
5331bb6
Unify tasks from xtask and helix_loader
gibbz00 Jan 17, 2023
3be034c
Use unified config loading in docgen and health
gibbz00 Jan 17, 2023
b9b916d
Merge remote-tracking branch 'brevig-local-config/feat-load-local-con…
gibbz00 Jan 23, 2023
d814356
Touchoups
gibbz00 Jan 23, 2023
ae6790c
Run cargo fmt
gibbz00 Jan 23, 2023
44ad646
Use description conistenly
gibbz00 Jan 23, 2023
eaea712
Accept +num flag for opening at line number
nabaco Jan 20, 2023
abf2f28
Fix undeterministic test failure
gibbz00 Jan 23, 2023
bae26ae
Merge remote-tracking branch 'myfork/keymap-presentation' into unify-…
gibbz00 Jan 23, 2023
eccda6e
Implement clippy tips
gibbz00 Jan 23, 2023
64cefce
Merge remote-tracking branch 'myfork/keymap-presentation' into unify-…
gibbz00 Jan 23, 2023
bcf3cb0
Implement clippy tips
gibbz00 Jan 23, 2023
2afcfcf
Make cargo fmt happy
gibbz00 Jan 23, 2023
b8affcc
Merge remote-tracking branch 'myfork/keymap-presentation' into unify-…
gibbz00 Jan 23, 2023
c617fd1
Make updated cargo clippy happy
gibbz00 Jan 24, 2023
3cac825
Merge remote-tracking branch 'myfork/keymap-presentation' into unify-…
gibbz00 Jan 24, 2023
7dbacf3
Merge branch 'master' into keymap-presentation
gibbz00 Jan 24, 2023
4d02459
Unblock #5656
gibbz00 Jan 24, 2023
e3dd261
Merge remote-tracking branch 'myfork/keymap-presentation' into unify-…
gibbz00 Jan 24, 2023
b4b82b4
Fight with cargo fmt round 3
gibbz00 Jan 24, 2023
8c1333a
Merge branch 'keymap-presentation' of https://github.com/gibbz00/heli…
gibbz00 Jan 24, 2023
58a9cad
Merge remote-tracking branch 'myfork/keymap-presentation' into unify-…
gibbz00 Jan 24, 2023
3f760f1
Run cargo fmt
gibbz00 Jan 24, 2023
90926bb
Merge #5411
gibbz00 Jan 24, 2023
2d463f1
make fmt and clippy happy
gibbz00 Jan 24, 2023
f2afd72
Use PathBuf::from("rel_path") rather than pathbuf::new().join("rel_pa…
gibbz00 Jan 24, 2023
1f966d7
Inline load_toml() introduced in #5411
gibbz00 Jan 24, 2023
0b9c2e8
Theme.rs
gibbz00 Jan 24, 2023
e7aee35
Create helix_loader::get_first_runtime_dir
gibbz00 Jan 24, 2023
c8dd563
remove one-liner solely used for a test
gibbz00 Dec 17, 2022
df49f60
Inline helper fuction of singular reference
gibbz00 Dec 17, 2022
69ed135
Remove order property of KeyTrie struct:
gibbz00 Dec 17, 2022
10151a9
Infobox: Remove superflous command descripition pruning:
gibbz00 Dec 17, 2022
465c0ef
Keymap infobox: Use Vec in place of BTree:
gibbz00 Dec 17, 2022
8768bf9
Keymap infobox: Place in correct order from start:
gibbz00 Dec 17, 2022
b50050b
Keymap infobox: Format body from start
gibbz00 Dec 17, 2022
eb50de1
keymap.rs file splitting, cleanup and descriptive naming:
gibbz00 Dec 26, 2022
d74be02
Rename MappableCommand field doc to description:
gibbz00 Dec 26, 2022
7192a4e
Initial sorting of keymap info window
gibbz00 Dec 26, 2022
26adc32
Infobox: Consistently place lowercase equivalents first
gibbz00 Dec 27, 2022
4fb58f7
Remove infobox optimization suggestion comment:
gibbz00 Dec 27, 2022
d33ff8b
keymap testing touchups
gibbz00 Dec 27, 2022
958e8bc
Exclude config no_op bindings in command palette.
gibbz00 Dec 27, 2022
d0f93ec
Cleaner infobox join operation
gibbz00 Dec 27, 2022
876885e
use statement cleanups
gibbz00 Dec 28, 2022
315fa89
Move Config related tests from keymap tests Config tests
gibbz00 Dec 28, 2022
fcf8e6b
Config test cleanup
gibbz00 Dec 28, 2022
e233a1b
Load keymap config consistently
gibbz00 Dec 29, 2022
4a188d2
Make use of new self context in keymap config load
gibbz00 Dec 29, 2022
baf8640
Minor keymap module visibilyti cleanup
gibbz00 Dec 29, 2022
3466209
Renamed the keymap! macro to keytrie!:
gibbz00 Dec 29, 2022
ff25380
Fix failed cherry picks
gibbz00 Jan 19, 2023
5c6c0ed
Removed keymap::Keymap:
gibbz00 Dec 29, 2022
ff6b53f
Switched keymap::keymaps::Keymaps to keymap::Keymap
gibbz00 Dec 30, 2022
aed2e90
Re-implemented pre-defined orders in keytrie
gibbz00 Jan 20, 2023
5edce2e
Add sort_infobox editor config option
gibbz00 Jan 21, 2023
0b08e38
Refine sorting behavior
gibbz00 Jan 22, 2023
5049e7c
Removed warnings
gibbz00 Jan 22, 2023
4f758ee
Use .join(", ") rather that own implementation
gibbz00 Jan 22, 2023
c224bf3
Fix apply_trasaction rebase fail
gibbz00 Jan 22, 2023
95a2b87
Fix failing test
gibbz00 Jan 22, 2023
941624b
Run cargo fmt
gibbz00 Jan 23, 2023
7735b34
Use description conistenly
gibbz00 Jan 23, 2023
8e1a3da
Fix undeterministic test failure
gibbz00 Jan 23, 2023
16e2d74
Implement clippy tips
gibbz00 Jan 23, 2023
dc8e463
Make cargo fmt happy
gibbz00 Jan 23, 2023
4bfa470
Make updated cargo clippy happy
gibbz00 Jan 24, 2023
03088b2
Fight with cargo fmt round 3
gibbz00 Jan 24, 2023
4bf9f82
Attempt race condition fix for RUNTIME dirs.
gibbz00 Jan 25, 2023
eaf883b
Merge branch 'keymap-presentation' of https://github.com/gibbz00/heli…
gibbz00 Jan 25, 2023
89936e1
Merge remote-tracking branch 'origin/master' into unify-config
gibbz00 Jan 25, 2023
816a9dd
Grammar fetch/build into OS data directory
gibbz00 Jan 25, 2023
eb31bd7
Proper runtime directory health diagnostics
gibbz00 Jan 25, 2023
fa615c2
Merge remote-tracking branch 'origin/master' into keymap-presentation
gibbz00 Jan 25, 2023
4af3d1d
Merge remote-tracking branch 'origin' into keymap-presentation
gibbz00 Jan 25, 2023
13a9f3e
merge escaped keymap test
gibbz00 Jan 25, 2023
b27f4a5
Merge branch 'keymap-presentation' into unify-config
gibbz00 Jan 25, 2023
c5e505e
cargo fmt
gibbz00 Jan 25, 2023
8dd2169
Initial alternative solution to #5203
gibbz00 Jan 25, 2023
b8e1ee4
Scrapped FromIterator<InfoboxRow> idea
gibbz00 Jan 25, 2023
375238f
Infobox: Typaple commands w/ arguments formatting
gibbz00 Jan 25, 2023
dc06713
health: add formatter binary
jzelinskie Jan 26, 2023
1e6c605
Add prefix position to file args
bheylin Feb 12, 2023
0a75108
Fix clippies
bheylin Feb 12, 2023
461e31f
Fix typos
bheylin Feb 12, 2023
22e491e
Fix typos
bheylin Feb 12, 2023
872f01f
Fix integration tests and split parse tests into fns
bheylin Feb 13, 2023
0622cdc
Rm assert_matches dep
bheylin Feb 13, 2023
34ab790
Rm file indexing in tests
bheylin Feb 13, 2023
e480a16
Rephrase PathBug instances in tests
bheylin Feb 13, 2023
8d4626c
Merge 'matt-cheely/labels-for-config-menus'
gibbz00 Feb 13, 2023
a7abb1f
Merge branch 'master' of https://github.com/helix-editor/helix into k…
gibbz00 Feb 13, 2023
395bfa6
Merge with master and keymap-refactoring
gibbz00 Feb 13, 2023
b06eb3f
fix clippy warnigs
gibbz00 Feb 13, 2023
0756dd5
Merge branch 'keymap-presentation' into unify-config
gibbz00 Feb 13, 2023
56189c9
fix cargo doc warnings
gibbz00 Feb 14, 2023
f44a348
Sorted infobox: place A- before C- bindings
gibbz00 Feb 14, 2023
b62d9a4
keyboard.rs: remove reduntant comments
gibbz00 Feb 14, 2023
9825ca0
Merge 'jzelinskie/formatter-health' w/ unify-config
gibbz00 Feb 14, 2023
044e344
merge 'nabaco/plus-goto-argument' & unify-config
gibbz00 Feb 14, 2023
fcbae4b
Merge 'bheylin/add-cli-file-pos-prefix'
gibbz00 Feb 14, 2023
b69a7d4
args.rs: remove reduntant comments
gibbz00 Feb 14, 2023
2665ae8
args.rs: move PositionRequest for file readability
gibbz00 Feb 14, 2023
7b5b268
load-local-config set to false by default
gibbz00 Feb 14, 2023
b609a02
Merge 'bbodi/sticky-config/sticky-config'
gibbz00 Feb 15, 2023
c36ba42
Merge branch 'keymap-presentation' into unify-config
gibbz00 Feb 15, 2023
72e1581
Sticky can now overwrite pre-defined sticky.
gibbz00 Feb 15, 2023
ad9bc2a
cargo fmt
gibbz00 Feb 15, 2023
34db341
Clarify sticky in remapping.md
gibbz00 Feb 15, 2023
2d9cea8
Add tests for user defined sticky
gibbz00 Feb 15, 2023
68c66ac
config.rs: clean up tests
gibbz00 Feb 15, 2023
6a81215
fix keytrie on default mappable command override bug
gibbz00 Feb 15, 2023
91d8d92
keytrie.rs: merge_keytrie() refactor
gibbz00 Feb 15, 2023
159150b
replace custom join with vec::join
gibbz00 Feb 15, 2023
683931a
revert some cleanup of use statements
gibbz00 Feb 15, 2023
ec76a96
Merge with 'keymap-presentation'
gibbz00 Feb 15, 2023
e98afd2
improve keymap deserialize error handlig
gibbz00 Feb 15, 2023
3a06115
Merge branch 'keymap-presentation'
gibbz00 Feb 15, 2023
27c45ba
fix refresh theme bug:
gibbz00 Feb 15, 2023
f3d102e
clippy lints
gibbz00 Feb 15, 2023
fcd8b31
unify theme loading pt. 1
gibbz00 Feb 15, 2023
9bcd089
unify theme loading pt. 2
gibbz00 Feb 15, 2023
9de7893
unify theme loading pt. 3
gibbz00 Feb 15, 2023
737b856
unify theme loading pt. 4
gibbz00 Feb 15, 2023
ba7520b
application.rs: Inline refresh_lang_config.
gibbz00 Feb 15, 2023
692d744
Remove lang_configs_loader field from Appliction
gibbz00 Feb 15, 2023
4ba73b3
Unwrap in terminal.size()
gibbz00 Feb 15, 2023
cf9fd51
Tweak usage of lang_configs_loader
gibbz00 Feb 15, 2023
ebe7ddf
Unify true_color detection
gibbz00 Feb 15, 2023
05d04f3
unify theme color support checking
gibbz00 Feb 15, 2023
1055cd2
Unify theme loading
gibbz00 Feb 15, 2023
dc1fa33
Theme::read_names API cleanup
gibbz00 Feb 16, 2023
6fde0e1
Place Impl blocks under stuct declarations
gibbz00 Feb 16, 2023
6335989
Theme::new/update(theme_name: String -> &str)
gibbz00 Feb 16, 2023
95b227a
Inline field definition in Editor::new
gibbz00 Feb 16, 2023
d1135f7
Unify logging
gibbz00 Feb 16, 2023
40a4e3d
Rename editor::Config to EditorConfig
gibbz00 Feb 16, 2023
9a2257b
add Theme::default
gibbz00 Feb 16, 2023
eceb19f
make true color support bool a static
gibbz00 Feb 16, 2023
08a1038
Merge Theme::update and new
gibbz00 Feb 16, 2023
73136a9
main.rs: generalize config load error prompt
gibbz00 Feb 16, 2023
134e8bf
main.rs: cleanup true color support setup
gibbz00 Feb 16, 2023
1678741
Remove Option wrapper for Config.theme
gibbz00 Feb 16, 2023
64eaf09
Theme::default impl comment
gibbz00 Feb 16, 2023
28b60a9
main.rs: inline theme and lang config load checks
gibbz00 Feb 16, 2023
b4076e5
remove unused function Tree:area()
gibbz00 Feb 16, 2023
d326827
fix clippy lints
gibbz00 Feb 16, 2023
a0d918a
custom description refinements
gibbz00 Feb 17, 2023
5ef96da
Merge 'keymap-presentation' into unify-config
gibbz00 Feb 17, 2023
95a7d26
Merge 'origin/master' into unify-config
gibbz00 Feb 17, 2023
31dc585
fix load default theme on startup if user fails
gibbz00 Feb 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion book/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ hidden = false
```

You may also specify a file to use for configuration with the `-c` or
`--config` CLI argument: `hx -c path/to/custom-config.toml`.
`--config` CLI argument: `hx -c path/to/custom-config.toml`.

Finally, you can have a `config.toml` local to a project by putting it under a `.helix` directory in your repository.
Its settings will be merged with the configuration directory `config.toml` and the built-in configuration,
if you have enabled the feature under `[editor.security]` in your global configuration.

It is also possible to trigger configuration file reloading by sending the `USR1`
signal to the helix process, e.g. via `pkill -USR1 hx`. This is only supported
Expand All @@ -50,9 +54,11 @@ on unix operating systems.
| `auto-completion` | Enable automatic pop up of auto-completion. | `true` |
| `auto-format` | Enable automatic formatting on save. | `true` |
| `auto-save` | Enable automatic saving on focus moving away from Helix. Requires [focus event support](https://github.com/helix-editor/helix/wiki/Terminal-Support) from your terminal. | `false` |
| `load-local-config` | Look for `$PWD/.helix/config.toml` and merge with default and user configuration if it exists. | `true` |
| `idle-timeout` | Time in milliseconds since last keypress before idle timers trigger. Used for autocompletion, set to 0 for instant. | `400` |
| `completion-trigger-len` | The min-length of word under cursor to trigger autocompletion | `2` |
| `auto-info` | Whether to display infoboxes | `true` |
| `sorted-infobox` | Sort infoboxes by key event category rather than by predefined command categories | `false` |
| `true-color` | Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative. | `false` |
| `rulers` | List of column positions at which to display the rulers. Can be overridden by language specific `rulers` in `languages.toml` file. | `[]` |
| `bufferline` | Renders a line at the top of the editor displaying open buffers. Can be `always`, `never` or `multiple` (only shown if more than one buffer is in use) | `never` |
Expand Down
10 changes: 3 additions & 7 deletions book/src/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ RUSTFLAGS="-C target-feature=-crt-static"


Helix also needs its runtime files so make sure to copy/symlink the `runtime/` directory into the
config directory (for example `~/.config/helix/runtime` on Linux/macOS). This location can be overridden
via the `HELIX_RUNTIME` environment variable.
config directory (for example `~/.config/helix/runtime` on Linux/macOS). An alternative runtime directory can
be used by setting the `HELIX_RUNTIME` environment variable. Both runtime directories can be used at the same
time, with the files residing under the config runtime directory given priority.

| OS | Command |
| -------------------- | ------------------------------------------------ |
Expand All @@ -134,11 +135,6 @@ cd %appdata%\helix
mklink /D runtime "<helix-repo>\runtime"
```

The runtime location can be overridden via the `HELIX_RUNTIME` environment variable.

> NOTE: if `HELIX_RUNTIME` is set prior to calling `cargo install --path helix-term --locked`,
> tree-sitter grammars will be built in `$HELIX_RUNTIME/grammars`.

If you plan on keeping the repo locally, an alternative to copying/symlinking
runtime files is to set `HELIX_RUNTIME=/path/to/helix/runtime`
(`HELIX_RUNTIME=$PWD/runtime` if you're in the helix repo directory).
Expand Down
28 changes: 28 additions & 0 deletions book/src/remapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,31 @@ c = ":run-shell-command cargo build"
t = ":run-shell-command cargo test"
```

## Custom descriptions

Remapping of singular typable commands or seqences of any commands, can be given a custom description for the keymap menus (infoboxes).
This is the text on each row that's paired together with each key event trigger.

```toml
[keys.normal]
A-k = { description = "Edit Config", exec = ":open ~/.config/helix/config.toml" }
# (Note that the example example above mostly for illustrative purposes, a :config-open is provided out of the box.)
"C-r" = { "description" = "Sort selection", "exec" = ["split_selection_on_newline", ":sort", "collapse_selection", "keep_primary_selection"] }
```

A custom descriptions can also be defined for sub-menus.
Aside from being them being shown in the parent-menu infobox,
sub-menu descriptions also act as infobox titles for the submenu itself.

```toml
# A submenu accessed though space->f in normal mode.
[keys.normal.space.f]
description = "File"
f = "file_picker"
s = { description = "Save", exec = ":write" }
c = { description = "Format", exec = ":format" }
```

## Special keys and modifiers

Ctrl, Shift and Alt modifiers are encoded respectively with the prefixes
Expand Down Expand Up @@ -76,5 +101,8 @@ Ctrl, Shift and Alt modifiers are encoded respectively with the prefixes

Keys can be disabled by binding them to the `no_op` command.

Making a mode "sticky" can be achieved by adding `sticky = true` to the mapping.
(Predefined sticky keytries can like wise be made unsticky with `sticky = false`.)

Commands can be found at [Keymap](https://docs.helix-editor.com/keymap.html) Commands.
> Commands can also be found in the source code at [`helix-term/src/commands.rs`](https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs) at the invocation of `static_commands!` macro and the `TypableCommandList`.
1 change: 1 addition & 0 deletions helix-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ integration = []
[dependencies]
helix-loader = { version = "0.6", path = "../helix-loader" }

anyhow = "1"
ropey = { version = "1.6.0", default-features = false, features = ["simd"] }
smallvec = "1.10"
smartstring = "1.0.1"
Expand Down
10 changes: 0 additions & 10 deletions helix-core/src/config.rs

This file was deleted.

1 change: 0 additions & 1 deletion helix-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pub use encoding_rs as encoding;
pub mod auto_pairs;
pub mod chars;
pub mod comment;
pub mod config;
pub mod diagnostic;
pub mod diff;
pub mod doc_formatter;
Expand Down
28 changes: 21 additions & 7 deletions helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{
};

use ahash::RandomState;
use anyhow;
use arc_swap::{ArcSwap, Guard};
use bitflags::bitflags;
use hashbrown::raw::RawTable;
Expand Down Expand Up @@ -60,13 +61,26 @@ fn default_timeout() -> u64 {
}

#[derive(Debug, Serialize, Deserialize)]
pub struct Configuration {
pub struct LanguageConfigurations {
pub language: Vec<LanguageConfiguration>,
}

impl Default for Configuration {
impl LanguageConfigurations {
// Local, user config, and system language configs
pub fn merged() -> Result<Self, anyhow::Error> {
let merged_lang_configs = helix_loader::merged_lang_config()?;
merged_lang_configs
.try_into()
.map_err(|error| anyhow::anyhow!("{}", error))
}
}

impl Default for LanguageConfigurations {
fn default() -> Self {
crate::config::default_syntax_loader()
toml::from_str(
&std::fs::read_to_string(helix_loader::repo_paths::default_lang_configs()).unwrap(),
)
.expect("Failed to deserialize built-in languages.toml")
}
}

Expand Down Expand Up @@ -561,7 +575,7 @@ pub struct Loader {
}

impl Loader {
pub fn new(config: Configuration) -> Self {
pub fn new(config: LanguageConfigurations) -> Self {
let mut loader = Self {
language_configs: Vec::new(),
language_config_ids_by_extension: HashMap::new(),
Expand Down Expand Up @@ -2272,7 +2286,7 @@ mod test {
"#,
);

let loader = Loader::new(Configuration { language: vec![] });
let loader = Loader::new(LanguageConfigurations { language: vec![] });
let language = get_language("rust").unwrap();

let query = Query::new(language, query_str).unwrap();
Expand Down Expand Up @@ -2331,7 +2345,7 @@ mod test {
.map(String::from)
.collect();

let loader = Loader::new(Configuration { language: vec![] });
let loader = Loader::new(LanguageConfigurations { language: vec![] });

let language = get_language("rust").unwrap();
let config = HighlightConfiguration::new(
Expand Down Expand Up @@ -2434,7 +2448,7 @@ mod test {
) {
let source = Rope::from_str(source);

let loader = Loader::new(Configuration { language: vec![] });
let loader = Loader::new(LanguageConfigurations { language: vec![] });
let language = get_language(language_name).unwrap();

let config = HighlightConfiguration::new(language, "", "", "").unwrap();
Expand Down
21 changes: 11 additions & 10 deletions helix-loader/src/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ pub fn get_language(name: &str) -> Result<Language> {
#[cfg(not(target_arch = "wasm32"))]
pub fn get_language(name: &str) -> Result<Language> {
use libloading::{Library, Symbol};
let mut library_path = crate::runtime_dir().join("grammars").join(name);
library_path.set_extension(DYLIB_EXTENSION);
let mut rel_library_path = PathBuf::from("grammars").join(name);
rel_library_path.set_extension(DYLIB_EXTENSION);
let library_path = crate::get_runtime_file(&rel_library_path);

let library = unsafe { Library::new(&library_path) }
.with_context(|| format!("Error opening dynamic library {:?}", library_path))?;
Expand Down Expand Up @@ -191,7 +192,7 @@ pub fn build_grammars(target: Option<String>) -> Result<()> {
// merged. The `grammar_selection` key of the config is then used to filter
// down all grammars into a subset of the user's choosing.
fn get_grammar_configs() -> Result<Vec<GrammarConfiguration>> {
let config: Configuration = crate::config::user_lang_config()
let config: Configuration = crate::merged_lang_config()
.context("Could not parse languages.toml")?
.try_into()?;

Expand Down Expand Up @@ -252,7 +253,7 @@ fn fetch_grammar(grammar: GrammarConfiguration) -> Result<FetchStatus> {
remote, revision, ..
} = grammar.source
{
let grammar_dir = crate::runtime_dir()
let grammar_dir = crate::get_first_runtime_dir()
.join("grammars")
.join("sources")
.join(&grammar.grammar_id);
Expand Down Expand Up @@ -350,7 +351,7 @@ fn build_grammar(grammar: GrammarConfiguration, target: Option<&str>) -> Result<
let grammar_dir = if let GrammarSource::Local { path } = &grammar.source {
PathBuf::from(&path)
} else {
crate::runtime_dir()
crate::get_first_runtime_dir()
.join("grammars")
.join("sources")
.join(&grammar.grammar_id)
Expand Down Expand Up @@ -401,7 +402,10 @@ fn build_tree_sitter_library(
None
}
};
let parser_lib_path = crate::runtime_dir().join("grammars");
let parser_lib_path = crate::get_runtime_dirs()
.first()
.expect("No runtime directories provided") // guaranteed by post-condition
.join("grammars");
let mut library_path = parser_lib_path.join(&grammar.grammar_id);
library_path.set_extension(DYLIB_EXTENSION);

Expand Down Expand Up @@ -511,9 +515,6 @@ fn mtime(path: &Path) -> Result<SystemTime> {
/// Gives the contents of a file from a language's `runtime/queries/<lang>`
/// directory
pub fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io::Error> {
let path = crate::RUNTIME_DIR
.join("queries")
.join(language)
.join(filename);
let path = crate::get_runtime_file(&PathBuf::from("queries").join(language).join(filename));
std::fs::read_to_string(path)
}