Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use serde::Deserialize;

use crate::keymap::Keymaps;

#[derive(Debug, Default, Clone, PartialEq, Deserialize)]
pub struct Config {
    pub theme: Option<String>,
    #[serde(default)]
    pub lsp: LspConfig,
    #[serde(default)]
    pub keys: Keymaps,
    #[serde(default)]
    pub editor: helix_view::editor::Config,
}

#[derive(Debug, Default, Clone, PartialEq, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct LspConfig {
    pub display_messages: bool,
}

#[test]
fn parsing_keymaps_config_file() {
    use crate::keymap;
    use crate::keymap::Keymap;
    use helix_core::hashmap;
    use helix_view::document::Mode;

    let sample_keymaps = r#"
            [keys.insert]
            y = "move_line_down"
            S-C-a = "delete_selection"

            [keys.normal]
            A-F12 = "move_next_word_end"
        "#;

    assert_eq!(
        toml::from_str::<Config>(sample_keymaps).unwrap(),
        Config {
            keys: Keymaps(hashmap! {
                Mode::Insert => Keymap::new(keymap!({ "Insert mode"
                    "y" => move_line_down,
                    "S-C-a" => delete_selection,
                })),
                Mode::Normal => Keymap::new(keymap!({ "Normal mode"
                    "A-F12" => move_next_word_end,
                })),
            }),
            ..Default::default()
        }
    );
}
);">
SSH
Open with VS Code
Kirawi Add Monokai theme (#628)
44a0512 · 2021-08-25 6588Commits
.envrc
-rw-r--r--
129
.github
d---------
.gitignore
-rw-r--r--
87
.gitmodules
-rw-r--r--
4558
CHANGELOG.md
-rw-r--r--
8653
Cargo.lock
-rw-r--r--
28566
Cargo.toml
-rw-r--r--
304
LICENSE
-rw-r--r--
16725
README.md
-rw-r--r--
3369
TODO.md
-rw-r--r--
1047
book
d---------
contrib
d---------
docs
d---------
flake.lock
-rw-r--r--
2558
flake.nix
-rw-r--r--
3377
helix-core
d---------
helix-lsp
d---------
helix-syntax
d---------
helix-term
d---------
helix-tui
d---------
helix-view
d---------
languages.toml
-rw-r--r--
4871
runtime
d---------
rustfmt.toml
-rw-r--r--
0
screenshot.png
-rw-r--r--
168152
shell.nix
-rw-r--r--
324
theme.toml
-rw-r--r--
2084
README.md