mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Allow specifying no base keymap (#9471)
This PR is a bit of a shot in the dark. I'm not sure if this will be acceptable and I understand if it gets rejected. I've been trying to integrate Zed as my daily driver and the key bindings have been a major hurdle for me. Mostly due to the windows/linux keybindings being messed up, but also me wanting to have more chained key bindings similar to helix or common in custom neovim configurations. I think having a `None` base keymap would allow someone to more easily implement a new base keymap (#4642) and would make my daily use of Zed a little nicer 😅. Also I am aware that there would need to be a little more work done in this PR for the other base keymaps such as 'atom' since they assume the 'default' (vscode) base keymaps are loaded. I'm happy to do that work if a 'none' base keymap is acceptable. Release Notes: - Added ability to specify no base keymap which allows for full keybinding customization
This commit is contained in:
parent
5602c48136
commit
9b0949b6fb
@ -15,6 +15,7 @@ pub enum BaseKeymap {
|
||||
SublimeText,
|
||||
Atom,
|
||||
TextMate,
|
||||
None,
|
||||
}
|
||||
|
||||
impl Display for BaseKeymap {
|
||||
@ -25,6 +26,7 @@ impl Display for BaseKeymap {
|
||||
BaseKeymap::SublimeText => write!(f, "Sublime Text"),
|
||||
BaseKeymap::Atom => write!(f, "Atom"),
|
||||
BaseKeymap::TextMate => write!(f, "TextMate"),
|
||||
BaseKeymap::None => write!(f, "None"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -45,6 +47,7 @@ impl BaseKeymap {
|
||||
BaseKeymap::Atom => Some("keymaps/atom.json"),
|
||||
BaseKeymap::TextMate => Some("keymaps/textmate.json"),
|
||||
BaseKeymap::VSCode => None,
|
||||
BaseKeymap::None => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -641,12 +641,17 @@ fn reload_keymaps(cx: &mut AppContext, keymap_content: &KeymapFile) {
|
||||
}
|
||||
|
||||
pub fn load_default_keymap(cx: &mut AppContext) {
|
||||
let base_keymap = *BaseKeymap::get_global(cx);
|
||||
if base_keymap == BaseKeymap::None {
|
||||
return;
|
||||
}
|
||||
|
||||
KeymapFile::load_asset(DEFAULT_KEYMAP_PATH, cx).unwrap();
|
||||
if VimModeSetting::get_global(cx).0 {
|
||||
KeymapFile::load_asset("keymaps/vim.json", cx).unwrap();
|
||||
}
|
||||
|
||||
if let Some(asset_path) = BaseKeymap::get_global(cx).asset_path() {
|
||||
if let Some(asset_path) = base_keymap.asset_path() {
|
||||
KeymapFile::load_asset(asset_path, cx).unwrap();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user