summaryrefslogtreecommitdiff
path: root/rc/prelude.sh
blob: c7dead6859d254d57388e193a5aadf96552488fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
kak_escape() {
  for text do
    printf "'"
    while true; do
      case "$text" in
        *"'"*)
          head=${text%%"'"*}
          tail=${text#*"'"}
          printf "%s''" "$head"
          text=$tail
          ;;
        *)
          printf "%s' " "$text"
          break
          ;;
      esac
    done
  done
  printf "${KAK_ESCAPE_EOF:-\n}"
}

kak_escape_partial() {
  KAK_ESCAPE_EOF=' ' kak_escape "$@"
}