From 4532cb43fa5692dbec0c30388db880b59f776cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Wed, 23 Oct 2024 12:35:07 -0300 Subject: [PATCH] kakoune: add pint as formatter --- scripts/default.nix | 1 + scripts/pint-fmt | 7 +++++++ user/kakoune/default.nix | 1 + user/kakoune/filetypes.kak | 4 ++++ 4 files changed, 13 insertions(+) create mode 100755 scripts/pint-fmt diff --git a/scripts/default.nix b/scripts/default.nix index 99b6635..79fe4c6 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -124,6 +124,7 @@ zbar wl-clipboard ]; + pint-fmt = [ ]; powerplay-led-idle = [ bash libinput diff --git a/scripts/pint-fmt b/scripts/pint-fmt new file mode 100755 index 0000000..85ea6cd --- /dev/null +++ b/scripts/pint-fmt @@ -0,0 +1,7 @@ +#!/bin/sh + +file="$(mktemp --tmpdir=/dev/shm).php" +cat - >"$file" +./vendor/bin/pint --quiet "$file" +cat "$file" +rm "$file" diff --git a/user/kakoune/default.nix b/user/kakoune/default.nix index 337e007..9963f26 100644 --- a/user/kakoune/default.nix +++ b/user/kakoune/default.nix @@ -133,6 +133,7 @@ in emmet-cli nodePackages.prettier + pint-fmt aspell aspellDicts.en diff --git a/user/kakoune/filetypes.kak b/user/kakoune/filetypes.kak index fd0b87c..293293c 100644 --- a/user/kakoune/filetypes.kak +++ b/user/kakoune/filetypes.kak @@ -30,6 +30,10 @@ hook global WinSetOption filetype=angular %[ add-highlighter buffer/angular ref html ] +hook global BufCreate .*\.php %{ + set buffer formatcmd 'pint-fmt' +} + hook global BufCreate .*\.js %{ set buffer formatcmd 'prettier --parser babel' }