bew / dotfiles

All my dotfiles in one place!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Global custom ~vim-like (input) mappings for any app is ❤️, formalize it, make it cross-platform!

bew opened this issue · comments

I've been using for months now a set of AutoHotKey mappings (on Wind{ows,aube}) at work, that allows my to get some vim-like keybindings (with Alt pressed) for navigating here and there in a text input area or in the program.

I already ported some bindings on my zsh, nvim (very few, for insert mode short movements) configs, but not yet to my Linux machine / WM (hlwm right now).

NOTE: My ahk scripts are stored in a private repo (work-related), but a dump of the current ~vim-like mappings are:
(at date: 20210522)

; * (Modifier) Fire the hotkey even if extra modifiers (e.g: Shift) are being held down.
; ! is Alt
; ^ is Ctrl
; + is Shift

; --- Word movement

; Alt+{b,w} -> Ctrl+{Left,Right}
*!b::Send ^{Left}
*!w::Send ^{Right}

; --- Begin/End

; Alt+g -> Home (Begin)
; NOTE: I need Alt+^ for Home as well (used in a line, not in a doc)
!g::Send {Home}

; Alt+Shift+g -> End
; Alt+$ -> End
!+g::Send {End}
!$::Send {End}

; --- Arrows

; Alt+{h,j,k,l} -> {Left,Down,Up,Right}
*!h::Send {Left}
*!j::Send {Down}
*!k::Send {Up}
*!l::Send {Right}

; --- Quick retry that line

; Ctrl+u -> Shift+Home (select) then Backspace (delete)
^u::
  Send +{Home}
  Sleep 100 ; 100ms, for minimal visual feedback
  Send {Backspace}
  return

implementation
For Linux, something like #43 could help, TODO: write what might be missing.