AutoYADM commit: 2025-05-15 22:11:23
This commit is contained in:
parent
b171583d3d
commit
02106a54e3
2 changed files with 23 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
hook global WinSetOption filetype=go %{
|
||||
set-option window lsp_fmt true
|
||||
# hook -group go-auto-format window BufWritePre .* lsp-formatting
|
||||
hook -group go-auto-format window BufWritePre .* format
|
||||
}
|
||||
|
|
|
@ -1,15 +1,35 @@
|
|||
declare-option -docstring "shell command used for the 'format-selections' and 'format-buffer' commands" \
|
||||
str formatcmd
|
||||
declare-option -docstring "whether the LSP should be preferred for formatting" lsp_fmt bool false
|
||||
declare-option -docstring "whether the LSP should be preferred for formatting" bool lsp_fmt false
|
||||
|
||||
define-command format-buffer -docstring "Format the contents of the buffer" %{
|
||||
evaluate-commands %sh{
|
||||
if [ "$kak_opt_lsp_fmt" == "false" ]; then
|
||||
echo "format-buffer-pipe"
|
||||
else
|
||||
echo "lsp-formatting"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
define-command format-selections -docstring "Format the selections individually" %{
|
||||
evaluate-commands %sh{
|
||||
if [ "${kak_opt_lsp_fmt}" == "false" ]; then
|
||||
echo "format-selections-pipe"
|
||||
else
|
||||
echo "lsp-range-formatting"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
define-command format-buffer-pipe -hidden -docstring "Format the contents of the buffer using pipe" %{
|
||||
evaluate-commands -draft %{
|
||||
execute-keys '%'
|
||||
format-selections
|
||||
}
|
||||
}
|
||||
|
||||
define-command format-selections -docstring "Format the selections individually" %{
|
||||
define-command format-selections-pipe -docstring "Format the selections individually using pipe" %{
|
||||
evaluate-commands %sh{
|
||||
if [ -z "${kak_opt_formatcmd}" ]; then
|
||||
echo "fail 'The option ''formatcmd'' must be set'"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue