[FR] Emacs keymappings #25
Replies: 4 comments 2 replies
-
I have considered adding a "holy" mode option that changes the default keymappings to Emacs style haha but as a non-emacs user myself I'd rather it be maintained outside of Glide for now at least. If you start remapping please share it here! I'm sure others will find it useful :) |
Beta Was this translation helpful? Give feedback.
-
Here's the config I edited and came up with so far. // Config docs:
//
// https://glide-browser.app/config
//
// API reference:
//
// https://glide-browser.app/api
//
// Default config files can be found here:
//
// https://github.com/glide-browser/glide/tree/main/src/glide/browser/base/content/plugins
//
// Most default keymappings are defined here:
//
// https://github.com/glide-browser/glide/blob/main/src/glide/browser/base/content/plugins/keymaps.mts
//
// Try typing `glide.` and see what you can do!
// Disabled default (vim) keybindings ;-}
const defaultKeymaps = glide.keymaps.list();
defaultKeymaps.forEach(keymap => {
glide.keymaps.del(keymap.mode, keymap.lhs); // Delete keymap by its mode and lhs
});
glide.o.hint_size = "18px";
glide.g.mapleader = "C-c"
glide.keymaps.set("normal", "<leader>r", "config_reload");
glide.keymaps.set("normal", "<leader>r", "reload");
glide.keymaps.set("normal", "<leader>R", "reload_hard");
glide.keymaps.set("normal", "<leader><leader>", "commandline_show tab ");
glide.keymaps.set("normal", "<C-x>b", "commandline_show tab ");
glide.keymaps.set("normal", "<C-x><C-f>", "commandline_show tab_new ");
glide.keymaps.set("normal", "<C-x><C-c>", "quit");
glide.keymaps.set("normal", "<A-[>", "scroll_top");
glide.keymaps.set("normal", "<A-]>", "scroll_bottom");
glide.keymaps.set(["normal"], "<C-v>", "scroll_page_down");
glide.keymaps.set(["normal"], "<A-v>", "scroll_page_up");
// ignore mode
glide.keymaps.set(["normal", "insert", "visual"], "<C-g>", "mode_change ignore");
glide.keymaps.set("ignore", "<C-g>", "mode_change normal");
// history
glide.keymaps.set(["normal"], "l", "back");
glide.keymaps.set(["normal"], "r", "forward");
// hint mode
glide.keymaps.set("normal", "<C-.>", "hint");
glide.keymaps.set("normal", "<A-.>", "hint --action=newtab-click");
glide.keymaps.set("normal", "<A-;>", "hint --location=browser-ui");
glide.keymaps.set("hint", "<C-g>", "hints_remove");
// page navigation
glide.keymaps.set("normal", "<C-x>i", "focusinput last");
// command mode
glide.keymaps.set("command", "<C-g>", "commandline_toggle");
glide.keymaps.set("command", "<Tab>", "commandline_focus_next");
glide.keymaps.set("command", "<S-Tab>", "commandline_focus_back");
glide.keymaps.set("command", "<C-n>", "commandline_focus_next");
glide.keymaps.set("command", "<C-p>", "commandline_focus_back");
glide.keymaps.set("command", "<Enter>", "commandline_accept");
glide.keymaps.set("command", "<C-d>", "commandline_delete");
// tabs
glide.keymaps.set("normal", "<C-x>k", "tab_close");
glide.keymaps.set(["normal", "insert"], "<C-j>", "tab_next");
glide.keymaps.set(["normal", "insert"], "<C-k>", "tab_prev");
glide.keymaps.set(["normal", "insert"], "<C-x>tn", "tab_next");
glide.keymaps.set(["normal", "insert"], "<C-x>tp", "tab_prev");
glide.keymaps.set("normal", "<C-x>z", "repeat");
glide.keymaps.set("normal", "<A-x>", "commandline_toggle");
glide.keymaps.set("normal", ":", );
glide.keymaps.set("normal", "<C-h>t", "tutor");
glide.keymaps.set("normal", "<C-h>h", "help");
glide.keymaps.set("normal", "<C-h>m", "map");
glide.keymaps.set(["insert", "visual", "op-pending"], "<C-g>", "mode_change normal");
glide.keymaps.set("normal", "i", "mode_change insert --automove=left");
glide.keymaps.set("normal", "a", "mode_change insert");
glide.keymaps.set("normal", "A", "mode_change insert --automove=endline");
glide.keymaps.set("normal", "<C-x>u", "undo");
glide.keymaps.set("normal", "<C-/>", "undo");
// TODO(glide-motions): more general support for numbers like this
glide.keymaps.set(["normal", "insert"], "<C-a>", "motion 0");
glide.keymaps.set(["normal", "insert"], "<C-e>", "motion $");
glide.keymaps.set(["normal", "insert"], "<C-b>", "caret_move left");
glide.keymaps.set(["normal", "insert"], "<C-f>", "caret_move right"); // NOTE: Conflicts with firefox find command
glide.keymaps.set(["normal", "insert"], "<C-n>", "caret_move down");
glide.keymaps.set(["normal", "insert"], "<C-p>", "caret_move up");
glide.keymaps.set("normal", "<A-w>", "url_yank");
// jumplist
// note: unlike Vim, we define these keymaps in insert mode as well
// as it can be jarring when switching tabs, for the jumplist
// to stop working just because you had an input element
// focused in a particular tab
glide.keymaps.set(["normal", "insert"], "<C-o>", "jumplist_back");
glide.keymaps.set(["normal", "insert"], "<C-i>", "jumplist_forward");
// note sure what they do
glide.keymaps.set("normal", "d", "mode_change op-pending --operator=d", { retain_key_display: true });
glide.keymaps.set("normal", "c", "mode_change op-pending --operator=c", { retain_key_display: true });
glide.keymaps.set(["normal", "visual"], "<A-f>", "motion w");
glide.keymaps.set(["normal", "visual"], "<A-b>", "motion W");
glide.keymaps.set("normal", "e", "motion e");
glide.keymaps.set("normal", "b", "motion b");
glide.keymaps.set("normal", "B", "motion B");
glide.keymaps.set("normal", "x", "motion x");
glide.keymaps.set("normal", "X", "motion X");
glide.keymaps.set("normal", "o", "motion o");
glide.keymaps.set("normal", "{", "motion {");
glide.keymaps.set("normal", "}", "motion }");
glide.keymaps.set("normal", "r", "r");
glide.keymaps.set("normal", "s", "motion s");
// visual motions
glide.keymaps.set("normal", "v", "motion v");
glide.keymaps.set("visual", "h", "motion vh");
glide.keymaps.set("visual", "l", "motion vl");
glide.keymaps.set("visual", "d", "motion vd");
glide.keymaps.set("visual", "c", "motion vc");
glide.keymaps.set("visual", "y", "visual_selection_copy");
|
Beta Was this translation helpful? Give feedback.
-
I thought to comment on #19 Since glide main USP is keyboard-centric, would it be possible to unbind everything via a config option? I mean, there can be lot of conflicts with firefox default keybinding, and many users might want to customize all keybindings to their preference... Imo a toggle to disable all CUA/firefox keybindings eg qutebrowser allows to not load any default config via: Ik this is early stage of project, so I'm just pointing it as "Notes" Since Emacs users might use C-v, C-c for other keymaps, we miss copy and paste option. You can ignore if it sounds like too much of re-writes... Since I came from qutebrowser and same USP follows, I thought it'd make sense to offer complete keybind controls |
Beta Was this translation helpful? Give feedback.
-
Hi robert, I was able to (hack) re-map some to firefox native to bind glide.keymaps.set(["normal", "insert"], "<C-x><C-f>", () => glide.keys.send('<C-l>'));
glide.keymaps.set(["normal", "insert", "ignore"], "<C-s>", () => glide.keys.send('<C-f>')); 1st one works, to map that to basically tab bar focus But i'm not able to bind any key to emulate glide.keymaps.set(["normal"], "<C-n>", () => glide.keys.send("<Down>"));
glide.keymaps.set(["normal"], "<C-p>", () => glide.keys.send("<Up>")); May I please know if I'm missing anything, or how you'd think to acheive this? Again what I mean, basically CUA keybindings defined to Keychords with modifiers. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Thanks for developing glide, I'm already hooked on this.
I'm opening this issue/discussion for people to contribute config addition for re-mapping all bindings to Emacs style (no holy war...)
In Qutebrowser we can use emacs binding config via:
This could be a feature in glide itself to support either Vim or Emacs or CUA (maybe) as option
or this could just be resource/wiki content for people to adapt config to get Emacs style mappings.
Finally I can hit C-x C-s, M-x with freedom !!!
Beta Was this translation helpful? Give feedback.
All reactions