Skip to content
Vladimir Bauer edited this page Sep 15, 2018 · 10 revisions

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

Incrementing / decrementing numbers

def -hidden -params 2 inc %{
  eval %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>'

Creating a quick math prompt

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