Skip to content

Instantly share code, notes, and snippets.

@eikenb
Last active July 3, 2020 00:29
Show Gist options
  • Save eikenb/79e9d18ede852b7122f36bda1c6401ff to your computer and use it in GitHub Desktop.
Save eikenb/79e9d18ede852b7122f36bda1c6401ff to your computer and use it in GitHub Desktop.
initial, not very good version of map based auto-pair
define-command -params 1 maybematch %{
execute-keys "<a-l>"
evaluate-commands %sh{
if [ "$kak_selection_length" -lt 2 ] && [ "$kak_cursor_column" -gt 2 ]
then
printf "execute-keys i${1}<esc>"
fi
}
execute-keys "<a-;>;h"
}
map global insert "[" "[<esc>:maybematch ']'<ret>i"
map global insert "(" "(<esc>:maybematch ')'<ret>i"
map global insert "{" "{<esc>:maybematch '}'<ret>i"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment