Lock usermode from inside mode

The following will add a <ret> mapping to any existing user mode, which locks the mode itself. Reduces the pressure on mappable keys. For example

usermode-lock-add buffers

Whereas before you had “,b” to enter buffers mode and “,B” to keep it locked, afterwards you can use “,b” and “,b<ret>”. So:

def -override -params 1 usermode-lock-add %{ eval -draft %sh{
  printf 'map -docstring %s -- global %s <ret> %s\n' \
    '"lock mode"' "$1" "': enter-user-mode -lock $1<ret>'"
} } -shell-script-candidates %{
printf '%s\n' $kak_user_modes
} -docstring %{
  Add <ret>=lock to any usermode
}
4 Likes

:heart_eyes:

Works well AlMr check it out, referenced and all.

git clone https://bitbucket.org/snippets/KJ_Duncan/KrGkBa/grep-bufferkak.git

Thanks buddy. :upside_down_face: