Fix Terminal and add Twig formatting

This commit is contained in:
Dominik Säume 2025-01-21 09:39:31 +01:00
parent 52934decf2
commit 7249dc0978
4 changed files with 18 additions and 4 deletions

View file

@ -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

View file

@ -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,

View file

@ -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)

View file

@ -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)