Merge remote-tracking branch 'somasis/master'
This commit is contained in:
commit
8abd99522f
|
@ -2,11 +2,12 @@ decl str formatcmd ""
|
||||||
def format -docstring "Format the entire buffer with an external utility" %{
|
def format -docstring "Format the entire buffer with an external utility" %{
|
||||||
%sh{
|
%sh{
|
||||||
if [ ! -z "${kak_opt_formatcmd}" ]; then
|
if [ ! -z "${kak_opt_formatcmd}" ]; then
|
||||||
|
readonly kak_opt_formatcmd=$(printf '%s' "${kak_opt_formatcmd}" | sed 's/ /<space>/g')
|
||||||
## Save the current position of the cursor
|
## Save the current position of the cursor
|
||||||
readonly x=$((kak_cursor_column - 1))
|
readonly x=$((kak_cursor_column - 1))
|
||||||
readonly y="${kak_cursor_line}"
|
readonly y="${kak_cursor_line}"
|
||||||
|
|
||||||
printf %s\\n "exec -draft %{%|${kak_opt_formatcmd// /<space>}<ret>}"
|
printf %s\\n "exec -draft %{%|${kak_opt_formatcmd}<ret>}"
|
||||||
## Try to restore the position of the cursor as it was prior to formatting
|
## Try to restore the position of the cursor as it was prior to formatting
|
||||||
printf %s\\n "exec gg ${y}g ${x}l"
|
printf %s\\n "exec gg ${y}g ${x}l"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user