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

Keymap presentation refinements and underlying restructuring #5635

Closed
wants to merge 113 commits into from
Closed
Show file tree
Hide file tree
Changes from 108 commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
671f297
Make stickiness configurable
bbodi Oct 9, 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
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
1eaaf2d
Fix failing test
gibbz00 Jan 22, 2023
ae6790c
Run cargo fmt
gibbz00 Jan 23, 2023
44ad646
Use description conistenly
gibbz00 Jan 23, 2023
abf2f28
Fix undeterministic test failure
gibbz00 Jan 23, 2023
eccda6e
Implement clippy tips
gibbz00 Jan 23, 2023
2afcfcf
Make cargo fmt happy
gibbz00 Jan 23, 2023
c617fd1
Make updated cargo clippy happy
gibbz00 Jan 24, 2023
7dbacf3
Merge branch 'master' into keymap-presentation
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
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
eaf883b
Merge branch 'keymap-presentation' of https://github.com/gibbz00/heli…
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
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
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
b06eb3f
fix clippy warnigs
gibbz00 Feb 13, 2023
f44a348
Sorted infobox: place A- before C- bindings
gibbz00 Feb 14, 2023
b62d9a4
keyboard.rs: remove reduntant comments
gibbz00 Feb 14, 2023
b609a02
Merge 'bbodi/sticky-config/sticky-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
e98afd2
improve keymap deserialize error handlig
gibbz00 Feb 15, 2023
d326827
fix clippy lints
gibbz00 Feb 16, 2023
a0d918a
custom description refinements
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 book/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ on unix operating systems.
| `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
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: 0 additions & 1 deletion helix-term/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ helix-loader = { version = "0.6", path = "../helix-loader" }

anyhow = "1"
once_cell = "1.17"

which = "4.4"

tokio = { version = "1", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot"] }
Expand Down
45 changes: 21 additions & 24 deletions helix-term/src/application.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
use crate::{
args::Args,
commands::apply_workspace_edit,
compositor::{Compositor, Event},
config::Config,
job::Jobs,
keymap::Keymap,
ui::{self, overlay::overlayed},
};
use anyhow::{Context, Error};
use arc_swap::{access::Map, ArcSwap};
use crossterm::{
event::{
DisableBracketedPaste, DisableFocusChange, DisableMouseCapture, EnableBracketedPaste,
EnableFocusChange, EnableMouseCapture, Event as CrosstermEvent,
},
execute, terminal,
tty::IsTty,
};
use futures_util::Stream;
use helix_core::{
diagnostic::{DiagnosticTag, NumberOrString},
Expand All @@ -15,36 +33,15 @@ use helix_view::{
tree::Layout,
Align, Editor,
};
use serde_json::json;
use tui::backend::Backend;

use crate::{
args::Args,
commands::apply_workspace_edit,
compositor::{Compositor, Event},
config::Config,
job::Jobs,
keymap::Keymaps,
ui::{self, overlay::overlayed},
};

use log::{debug, error, warn};
use serde_json::json;
use std::{
io::{stdin, stdout, Write},
sync::Arc,
time::{Duration, Instant},
};
use tui::backend::Backend;

use anyhow::{Context, Error};

use crossterm::{
event::{
DisableBracketedPaste, DisableFocusChange, DisableMouseCapture, EnableBracketedPaste,
EnableFocusChange, EnableMouseCapture, Event as CrosstermEvent,
},
execute, terminal,
tty::IsTty,
};
#[cfg(not(windows))]
use {
signal_hook::{consts::signal, low_level},
Expand Down Expand Up @@ -180,7 +177,7 @@ impl Application {
let keys = Box::new(Map::new(Arc::clone(&config), |config: &Config| {
&config.keys
}));
let editor_view = Box::new(ui::EditorView::new(Keymaps::new(keys)));
let editor_view = Box::new(ui::EditorView::new(Keymap::new(keys)));
compositor.push(editor_view);

if args.load_tutor {
Expand Down