From 3ec0cbd07aeb2d8f8d61f4cf86beaca63bb105ed Mon Sep 17 00:00:00 2001 From: Kylie McClain Date: Wed, 21 Sep 2016 19:54:17 -0400 Subject: [PATCH] formatter.kak: Use sed rather than ${variable//string/replacement} Using ${variable//string/replacement} is a bash extension, it is not part of POSIX shell scripting. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 --- rc/core/formatter.kak | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rc/core/formatter.kak b/rc/core/formatter.kak index 8dbbf42f..2af8eef2 100644 --- a/rc/core/formatter.kak +++ b/rc/core/formatter.kak @@ -2,11 +2,12 @@ decl str formatcmd "" def format -docstring "Format the entire buffer with an external utility" %{ %sh{ if [ ! -z "${kak_opt_formatcmd}" ]; then + readonly kak_opt_formatcmd=$(printf '%s' "${kak_opt_formatcmd}" | sed 's/ //g') ## Save the current position of the cursor readonly x=$((kak_cursor_column - 1)) readonly y="${kak_cursor_line}" - printf %s\\n "exec -draft %{%|${kak_opt_formatcmd// /}}" + printf %s\\n "exec -draft %{%|${kak_opt_formatcmd}}" ## Try to restore the position of the cursor as it was prior to formatting printf %s\\n "exec gg ${y}g ${x}l" fi