From 7249dc0978fac1259352548e2ef1bbf428e3f271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Tue, 21 Jan 2025 09:39:31 +0100 Subject: [PATCH] Fix Terminal and add Twig formatting --- install.sh | 1 + lua/editor/terminal.lua | 2 +- lua/toolchain/php.lua | 15 +++++++++++++++ lua/toolchain/web.lua | 4 +--- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index ea9194c..78ef55c 100755 --- a/install.sh +++ b/install.sh @@ -25,6 +25,7 @@ command -v phpcs &>/dev/null || composer global require "squizlabs/php_codesniff command -v phpstan &>/dev/null || composer global require "phpstan/phpstan=*" -n command -v php-cs-fixer &>/dev/null || composer global require "friendsofphp/php-cs-fixer=*" -n command -v twigcs &>/dev/null || composer global require "friendsoftwig/twigcs=*" -n +command -v ludtwig &>/dev/null || cargo install ludtwig # Rust command -v cargo-clippy &>/dev/null || rustup component add clippy diff --git a/lua/editor/terminal.lua b/lua/editor/terminal.lua index 3c3f7df..658c50e 100644 --- a/lua/editor/terminal.lua +++ b/lua/editor/terminal.lua @@ -4,7 +4,7 @@ return { 'akinsho/toggleterm.nvim', config = function() local terminal = require('toggleterm') - terminal.setup() + terminal.setup({shell = '/usr/bin/zsh'}) vim.keymap.set( K.TOGGLE_TERMINAL.mode, diff --git a/lua/toolchain/php.lua b/lua/toolchain/php.lua index df340c4..0ea5a82 100644 --- a/lua/toolchain/php.lua +++ b/lua/toolchain/php.lua @@ -13,6 +13,21 @@ function M.setup() prefer_local = 'vendor/bin/php-cs-fixer', args = { 'fix', '--allow-risky=yes', '$FILENAME' }, }), + { + name = 'ludtwig', + method = null_ls.methods.FORMATTING, + filetypes = { 'twig' }, + generator = require('null-ls.helpers').formatter_factory({ + command = 'ludtwig', + args = { + '--fix', + '$FILENAME', + }, + to_temp_file = true, + from_temp_file = true, + to_stdin = false, + }), + }, } end) diff --git a/lua/toolchain/web.lua b/lua/toolchain/web.lua index 3f498f4..9a4a808 100644 --- a/lua/toolchain/web.lua +++ b/lua/toolchain/web.lua @@ -15,9 +15,7 @@ function M.setup() -- Diagnostics null_ls.builtins.diagnostics.stylelint, -- Formatter - null_ls.builtins.formatting.prettier.with({ - command = 'prettierd', - }), + null_ls.builtins.formatting.prettierd, } end)