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.
This commit is contained in:
parent
7591924f85
commit
3d0c19f8fb
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user