You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm an Emacs user, and I'm familiar with the schema to bind functions to keys. I'm looking for something like bind(Normal, '<', 'beginning-of-page'). This would allow me to swap keys like r and R and much more.
Currently, I've scripted this:
constcommands={};commands.import=function(name,keymap,key){constks=KeyboardUtils.encodeKeystroke(key);letcmd=keymap.mappings.find(ks);if(!cmd){throw`${key} (${ks}) not defined in keymap`;}cmd={ ...cmd.meta};deletecmd.word;cmd.name=name;this[name]=cmd;}commands.import('beginning-of-page',Normal,'gg');commands.import('end-of-page',Normal,'G');commands.import('half-page-up',Normal,'e');// …functionbind(keymap,key,command){if(typeofcommand==='string'){command=commands[command];if(!command){throw`Surfingkeys command ${command} not defined`;}}constks=KeyboardUtils.encodeKeystroke(key);keymap.mappings.remove(ks);keymap.mappings.add(ks,{ ...command});}bind(Normal,'<','beginning-of-page');bind(Normal,'>','end-of-page');bind(Normal,'w','half-page-up');bind(Normal,'d','half-page-down');
I would pretty much like to drop my code and remove it with something from the API. But how is it possible?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm an Emacs user, and I'm familiar with the schema to bind functions to keys. I'm looking for something like
bind(Normal, '<', 'beginning-of-page')
. This would allow me to swap keys liker
andR
and much more.Currently, I've scripted this:
I would pretty much like to drop my code and remove it with something from the API. But how is it possible?
Beta Was this translation helpful? Give feedback.
All reactions