From 3d0c19f8fb6ed8ef62edf4ef9b83d8d2c15455b2 Mon Sep 17 00:00:00 2001 From: Tim Allen Date: Fri, 1 Jun 2018 20:22:08 +1000 Subject: [PATCH] Prevent the :format command from triggering hooks. The :format command is often called from a BufWritePre hook to format the current buffer, however the :format command itself calls `:write` to store the buffer in a temporary location, potentially causing an infinite recursion. If we disable hooks while running :format, there's no danger of that occurring. --- rc/core/formatter.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/core/formatter.kak b/rc/core/formatter.kak index 2439bd4a..d84318dd 100644 --- a/rc/core/formatter.kak +++ b/rc/core/formatter.kak @@ -1,7 +1,7 @@ declare-option -docstring "shell command to which the contents of the current buffer is piped" \ str formatcmd -define-command format -docstring "Format the contents of the current buffer" %{ evaluate-commands -draft %{ +define-command format -docstring "Format the contents of the current buffer" %{ evaluate-commands -draft -no-hooks %{ %sh{ if [ -n "${kak_opt_formatcmd}" ]; then path_file_tmp=$(mktemp "${TMPDIR:-/tmp}"/kak-formatter-XXXXXX)