key bindings
2022.01.31
key bindings on mac and windows
#optimization
use client /components/post/reExport key bindings 2022.01.31 optimization key bindings on mac and windows }
<Lnk path= >Karabiner-Elements</Lnk> key binding app
for Mac
</li>
<li>
Modify its configuration json file at <Code>code ~/.config/karabiner/karabiner.json</Code>
</li>
<li>
Here is the example of my file where I added arrow keys shortcuts for <kbd>i</kbd>{ }
<kbd>k</kbd> <kbd>j</kbd> <kbd>l</kbd> keys
</li>
</ul>
<Code block json>{ machine_specific krbn-cee609c8-9b7f-430a-b018-9b91e0d62d3e enable_multitouch_extension : [
{
: [
{
: {
: true,
: 834,
: 1452
},
: false
}
],
Default profile : true,
: {
},
: {
: [
{
Play/pause button should only control iTunes. manipulators : {
},
: [
{
osascript -e to playpause
}
],
}
]
},
{
Change caps_lock to HYPER key manipulators description HYPER key in browsers (no Esc on single press) : {
,
: {
]
}
},
: [
{
left_control left_command left_option conditions frontmost_application_if bundle_identifiers ^com.apple.Safari ^com.google.Chrome ^org.mozilla.firefox ^com.microsoft.edgemac ^com.brave.Browser ^com.operasoftware.Opera
},
{
HYPER key in other apps (Esc on single press) : {
,
: {
]
}
},
: [
{
left_control left_command left_option to_if_alone
}
],
: [
{
frontmost_application_unless bundle_identifiers ^org.vim.MacVim ^org.neovim.Neovim ^com.apple.Terminal ^com.googlecode.iterm2 ^org.alacritty ^net.kovidgoyal.kitty ^com.jetbrains.* ^com.tinyapp.VimR ^com.apple.Safari ^com.google.Chrome ^org.mozilla.firefox ^com.microsoft.edgemac ^com.brave.Browser ^com.operasoftware.Opera
}
]
},
{
CapsLock to Control (Vim only) manipulators ,
: {
,
: {
]
}
},
: [
{
left_control to_if_alone
}
],
: [
{
frontmost_application_if bundle_identifiers ^org.vim.MacVim ^org.neovim.Neovim ^com.apple.Terminal ^com.googlecode.iterm2 ^org.alacritty ^net.kovidgoyal.kitty ^com.jetbrains.* ^com.tinyapp.VimR description Mouse cursor control (Fn + hjkl) manipulators description Fn + K = Cursor UP ,
: {
,
: {
]
}
},
: [
{
: {
: -368
}
}
]
},
{
Fn + H = Cursor LEFT ,
: {
,
: {
]
}
},
: [
{
: {
: -368
}
}
]
},
{
Fn + J = Cursor DOWN ,
: {
,
: {
]
}
},
: [
{
: {
: 368
}
}
]
},
{
Fn + L = Cursor RIGHT ,
: {
,
: {
]
}
},
: [
{
: {
: 368
}
}
]
},
{
Fn + Cmd + K = Cursor UP (Fast) ,
: {
,
: {
left_command : [
{
: {
: -1536
}
}
]
},
{
Fn + Cmd + H = Cursor LEFT (Fast) ,
: {
,
: {
left_command : [
{
: {
: -1536
}
}
]
},
{
Fn + Cmd + J = Cursor DOWN (Fast) ,
: {
,
: {
left_command : [
{
: {
: 1536
}
}
]
},
{
Fn + Cmd + L = Cursor RIGHT (Fast) ,
: {
,
: {
left_command : [
{
: {
: 1536
}
}
]
}
]
},
{
Mouse clicks (Fn + m, Fn + comma) manipulators description Fn + m to left-click ,
: {
,
: {
]
}
},
: [
{
}
]
},
{
Fn + , to right-click ,
: {
,
: {
]
}
},
: [
{
}
]
}
]
},
{
Vim-style navigation (Hyper + hjkl) manipulators description ,
,
: {
,
: {
left_control left_command left_option ]
}
},
: [
{
}
]
},
{
LEFT (Vim) ,
: {
,
: {
left_control left_command left_option ]
}
},
: [
{
left_arrow description DOWN (Vim) ,
: {
,
: {
left_control left_command left_option ]
}
},
: [
{
down_arrow description RIGHT (Vim) ,
: {
,
: {
left_control left_command left_option ]
}
},
: [
{
right_arrow description Delete operations (Hyper + u, o, i) manipulators description Delete backspace ,
: {
,
: {
left_control left_command left_option ]
}
},
: [
{
delete_or_backspace description Delete forward ,
: {
,
: {
left_control left_command left_option ]
}
},
: [
{
delete_forward description Delete word under cursor (own binding) ,
: {
,
: {
left_control left_command left_option ]
}
},
: [
{
left_arrow ]
},
{
right_arrow ]
},
{
delete_or_backspace description Swedish characters (Hyper + ;, ,
: [
{
,
,
: {
,
: {
left_control left_command left_option : [
{
,
right_option
}
]
},
{
,
,
: {
,
: {
left_control left_option left_command left_shift : [
{
,
right_option ,
left_shift description ,
,
: {
,
: {
left_control left_command left_option : [
{
,
left_option
}
]
},
{
,
,
: {
,
: {
left_control left_command left_option left_shift : [
{
,
left_option ,
left_shift description ,
,
: {
open_bracket : {
left_control left_command left_option : [
{
,
left_option description ,
,
: {
open_bracket : {
left_control left_command left_option left_shift : [
{
,
left_option left_shift description Password insertion (Hyper + p) manipulators description Hyper + P to insert a secret ,
: {
,
: {
left_control left_command left_option ]
}
},
: [
{
| pbcopy && osascript -e System Events\\ using command down
}
]
}
]
}
]
}
}
]
}
}
<Lnk path= >
here
</Lnk>
.
</p>
<p>
Also user generated key bindings community can be found{ }
<Lnk path= >here</Lnk>, which can be uploaded via
in <i>Complex modifications</i> tab.
</p>
<LazyImg path= />
<H>AutoHotkey app for Win</H>
<ul>
<li>
Download and install <Lnk path= >AutoHotkey</Lnk> key binding
app for Windows.{ }
</li>
<li>
{ }
Create a file with <code>.ahk</code> extension, put following code inside and launch it.{ }
</li>
</ul>
<Code block none>{ )
j::Left
k::Down
i::Up
l::Right
h::Home
ö::End
u::Send, {BackSpace}
o::Send, {Delete}
; Disable Alt+Space
!Space::Return
#If
*CapsLock::
KeyWait, CapsLock
}
<Code>C:\Users\John\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup</Code>,
folder can be opened by <kbd>Win</kbd>+<kbd>R</kbd> and <code>shell:startup</code>
</p>
<H>Key bindings in VSCode</H>
<Code block json>{ ,
cursorMove editorTextFocus : {
,
,
: 10
}
},
{
,
cursorMove editorTextFocus : {
,
,
: 10
}
},
// #endregion
//#region prevent quitting on cmd+q
{
,
-workbench.action.quit ctrl+shift+i ctrl+shift+c editor.action.insertSnippet editorTextFocus : { // shortcut for a snippet
// javascript code block ctrl+shift+backspace editor.action.deleteLines textInputFocus && !editorReadonly shift+alt+backspace deleteInsideWord ctrl+shift+o ctrl+shift+r ,
},
editorTextFocus ,
editor.action.commentLine editorTextFocus && !editorReadonly ,
editor.action.commentLine editorTextFocus && !editorReadonly ctrl+shift+b ctrl+shift+s bracketeer.swapBrackets ctrl+shift+b ctrl+shift+r bracketeer.removeBrackets ctrl+shift+b ctrl+shift+a bracketeer.selectBracketContent ctrl+shift+q ctrl+shift+r bracketeer.removeQuotes ctrl+shift+q ctrl+shift+s bracketeer.swapQuotes ctrl+shift+q ctrl+shift+a bracketeer.selectQuotesContent ctrl+shift+t ctrl+shift+a editor.emmet.action.balanceOut ctrl+shift+t ctrl+shift+w extension.htmlTagWrap editorTextFocus ctrl+shift+t ctrl+shift+r editor.emmet.action.removeTag ,
editor.action.smartSelect.expand editorTextFocus ,
editor.action.smartSelect.expand editorTextFocus shift+ctrl+a editor.action.selectAll editorTextFocus shift+cmd+a editor.action.selectAll editorTextFocus ctrl+shift+u cursorUndo textInputFocus ctrl+shift+p ctrl+shift+h editor.action.insertSnippet editorTextFocus : { // shortcut for a snippet
javascript placeholder ctrl+shift+b ctrl+shift+t editor.action.insertSnippet editorTextFocus : { // shortcut for a snippet
// javascript // snippet name
}
},
//#endregion
//#region console
{
ctrl+shift+c ctrl+shift+l editor.action.insertSnippet editorTextFocus : { // shortcut for a snippet
javascript console.log ctrl+shift+t ctrl+shift+l editor.action.insertSnippet editorTextFocus : { // shortcut for a snippet
javascript template literals \ // snippet name
}
},
//#endregion
//#region prettier
{
ctrl+shift+p ctrl+shift+a editor.action.formatDocument editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor ctrl+shift+p ctrl+shift+s editor.action.formatSelection editorHasDocumentSelectionFormattingProvider && editorTextFocus && !editorReadonly ctrl+shift+n extension.advancedNewFile !terminalFocus ,
workbench.action.showCommands ,
// cursorWordPartRight textInputFocus && !inSnippetMode && !editorHasSelection ,
// cursorWordPartLeft textInputFocus && !inSnippetMode && !editorHasSelection ,
,
// editorTextFocus && !editorHasMultipleSelections && !inSnippetMode && !inlineSuggestionVisible && !suggestWidgetVisible editorTextFocus && !editorHasMultipleSelections && !inSnippetMode && !inlineSuggestionVisible ,
-acceptSelectedSuggestion suggestWidgetVisible && textInputFocus ,
-insertSnippet editorTextFocus && hasSnippetCompletions && !editorTabMovesFocus && !inSnippetMode ,
editor.action.triggerSuggest editorHasCompletionItemProvider && textInputFocus && !editorReadonly ctrl+space editor.action.triggerSuggest editorHasCompletionItemProvider && textInputFocus && !editorReadonly shift+enter acceptSelectedSuggestion suggestWidgetVisible && textInputFocus shift+enter insertSnippet editorTextFocus && hasSnippetCompletions && !editorTabMovesFocus && !inSnippetMode ctrl+space acceptSelectedSuggestion suggestWidgetVisible && textInputFocus ctrl+space insertSnippet editorTextFocus && hasSnippetCompletions && !editorTabMovesFocus && !inSnippetMode ,
acceptSelectedSuggestion suggestWidgetVisible && textInputFocus ,
insertSnippet editorTextFocus && hasSnippetCompletions && !editorTabMovesFocus && !inSnippetMode ,
acceptSelectedSuggestion suggestWidgetVisible && textInputFocus ,
insertSnippet editorTextFocus && hasSnippetCompletions && !editorTabMovesFocus && !inSnippetMode ,
-editor.emmet.action.expandAbbreviation config.emmet.triggerExpansionOnTab && editorTextFocus && !editorReadonly && !editorTabMovesFocus shift+ctrl+enter editor.emmet.action.expandAbbreviation config.emmet.triggerExpansionOnTab && editorTextFocus && !editorReadonly && !editorTabMovesFocus ctrl+alt+right editor.action.indentLines editorTextFocus && !editorReadonly ctrl+alt+left editor.action.outdentLines editorTextFocus && !editorReadonly ctrl+oem_5 editor.action.commentLine editorTextFocus && !editorReadonly ctrl+oem_2 editor.action.commentLine editorTextFocus && !editorReadonly ,
editor.action.commentLine editorTextFocus && !editorReadonly ctrl+shift+t ctrl+shift+n workbench.action.terminal.new terminalProcessSupported || terminalWebExtensionContributedProfile ctrl+shift+oem_3 -workbench.action.terminal.new terminalProcessSupported || terminalWebExtensionContributedProfile ctrl+shift+f ctrl+shift+t terminal.focus ,
-workbench.files.action.focusOpenEditorsView workbench.explorer.openEditorsView.active ctrl+shift+f ctrl+shift+e workbench.action.focusActiveEditorGroup ctrl+shift+f ctrl+shift+s workbench.view.search.focus ,
workbench.action.findInFiles ctrl+shift+f -workbench.action.findInFiles ,
workbench.action.findInFiles ctrl+shift+f -workbench.action.findInFiles ,
settings.action.search inSettingsEditor ctrl+shift+t workbench.action.reopenClosedEditor }</Code>
<H>Hammerspoon</H>
<ul>
<li>
<Lnk path= >https://www.hammerspoon.org/</Lnk>
</li>
<li>
<Code>code ~/.hammerspoon/init.lua</Code>
</li>
</ul>
<Code block jsx>{ )
overlay:show()
end
local function hideOverlay()
if overlay then
overlay:delete()
overlay = nil
end
end
-- === Timeout Logic ===
local function resetNavTimeout()
if navTimeoutTimer then
navTimeoutTimer:stop()
end
navTimeoutTimer = hs.timer.doAfter(navTimeoutSeconds, function()
navMode:exit()
end)
end
-- === Mode Entry/Exit ===
function navMode:entered()
navModeActive = true
showOverlay()
resetNavTimeout()
end
function navMode:exited()
navModeActive = false
hideOverlay()
if navTimeoutTimer then
navTimeoutTimer:stop()
navTimeoutTimer = nil
end
end
-- === Toggle Key ===
hs.hotkey.bind({ , function()
if navModeActive then
navMode:exit()
else
navMode:enter()
end
end)
-- === Bindings (with timeout reset) ===
local function navKey(key, modifiers)
return function()
hs.eventtap.keyStroke(modifiers or {}, key)
resetNavTimeout()
end
end
navMode:bind({}, ))
navMode:bind({}, ))
navMode:bind({}, ))
navMode:bind({}, ))
navMode:bind({}, ))
navMode:bind({}, forwarddelete }))
navMode:bind({ }))
navMode:bind({ }))
navMode:bind({ forwarddelete }))