Skip to content

Commit

Permalink
Renamed config option to unbind-default-keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Lindenk committed Jun 10, 2022
1 parent 2a362a5 commit cd3dc9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion book/src/remapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Control, Shift and Alt modifiers are encoded respectively with the prefixes

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

To remove the default bindings for all modes defined by the user, `unbind_defaults = true` can be added to the top level configuration.
To remove the default bindings for all modes defined by the user, `unbind-default-keys = true` can be added to the top level configuration.

Commands can be found at [Keymap](https://docs.helix-editor.com/keymap.html) Commands.

Expand Down
8 changes: 4 additions & 4 deletions helix-term/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use toml::de::Error as TomlError;
pub struct Config {
pub theme: Option<String>,
#[serde(default)]
pub unbind_defaults: bool,
pub unbind_default_keys: bool,
#[serde(default)]
pub keys: HashMap<Mode, Keymap>,
#[serde(default)]
Expand Down Expand Up @@ -40,15 +40,15 @@ impl Config {
pub fn new() -> Self {
Config {
theme: None,
unbind_defaults: false,
unbind_default_keys: false,
keys: Default::default(),
editor: Default::default(),
}
}
pub fn with_default_keys() -> Self {
Config {
theme: None,
unbind_defaults: false,
unbind_default_keys: false,
keys: default_keys(),
editor: helix_view::editor::Config::default(),
}
Expand Down Expand Up @@ -90,7 +90,7 @@ impl Config {
pub fn load(config_path: PathBuf) -> Result<Config, ConfigLoadError> {
match std::fs::read_to_string(config_path) {
Ok(config) => match toml::from_str::<Config>(&config) {
Ok(config) if config.unbind_defaults => {
Ok(config) if config.unbind_default_keys => {
Ok(config.replace_into_keys(Config::with_default_keys()))
}
Ok(config) => Ok(config.merge_into_keys(Config::with_default_keys())),
Expand Down

0 comments on commit cd3dc9c

Please sign in to comment.