Skip to content
Bruno Heridet edited this page Apr 18, 2019 · 5 revisions

https://en.wikipedia.org/wiki/Bc_(programming_language)

Incrementing / decrementing numbers

define-command -hidden -params 2 inc %{
  evaluate-commands %sh{
    if [ "$1" = 0 ]
    then
	count=1
    else
	count="$1"
    fi
    printf '%s%s\n' 'exec h"_/\d<ret><a-i>na' "$2($count)<esc>|bc<ret>h"
  }
}
map global normal <c-a> ':inc %val{count} +<ret>'
map global normal <c-x> ':inc %val{count} -<ret>'

See plugin https://gitlab.com/Screwtapello/kakoune-inc-dec

Creating a quick math prompt

map global normal = ':prompt math: %{exec "a%val{text}<lt>esc>|bc<lt>ret>"}<ret>'

See plugin https://github.com/alexherbo2/bc.kak

You can’t perform that action at this time.