diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-09-25 21:07:56 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-09-25 21:07:56 +0200 |
| commit | 4457e657255ba071497b30356676a42f6f184cdf (patch) | |
| tree | 5d82e7c3a56b6ba31ee7dd0d4a2571614f66a3ad /after/plugin | |
| parent | c39162ed9d98f877eba72a36cc2dccb7451feb7c (diff) | |
| download | nvim-conf-4457e657255ba071497b30356676a42f6f184cdf.tar.gz nvim-conf-4457e657255ba071497b30356676a42f6f184cdf.zip | |
add new php query to highlight json decode and implement custom neotest php-unit
Diffstat (limited to 'after/plugin')
| -rw-r--r-- | after/plugin/neotest.lua | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/after/plugin/neotest.lua b/after/plugin/neotest.lua index 583084a..c43e74c 100644 --- a/after/plugin/neotest.lua +++ b/after/plugin/neotest.lua @@ -1,17 +1,33 @@ local ok, neotest = pcall(require, "neotest") if not ok then - return + return end +local composer = require("composer") + neotest.setup({ - adapters = { - require("neotest-go"), - require("neotest-rust"), - require("neotest-plenary"), - require("neotest-vim-test")({ - ignore_file_types = { "go", "lua", "rust" }, - }), - }, + adapters = { + require("neotest-go"), + require("neotest-rust"), + require("neotest-plenary"), + require("neotest-vim-test")({ + ignore_file_types = { "go", "lua", "rust", "php" }, + }), + require("neotest-phpunit")({ + phpunit_cmd = function() + if composer.query({ "require-dev", "laravel/sail" }) ~= nil then + return { "vendor/bin/sail", "phpunit" } + end + return "vendor/bin/phpunit" + end, + path_mapping = function () + if composer.query({"require-dev", "laravel/sali"}) ~= nil then + return { ["/app"] = vim.fn.getcwd() } + end + return { ["/var/www/html"] = vim.fn.getcwd() } + end + }), + }, }) local hydra = require("hydra") @@ -23,27 +39,27 @@ local hint = [[ ]] hydra({ - name = "neotest", + name = "neotest", hint = hint, - mode = "n", + mode = "n", config = { color = "teal", invoke_on_body = true, hint = { border = "rounded", position = "bottom", - } + }, + }, + body = "<C-t>", + heads = { + { "n", neotest.run.run }, + { + "f", + function() + neotest.run.run(vim.fn.expand("%")) + end, + }, + { "s", neotest.summary.toggle }, + { "<Esc>", nil, { exit = true } }, }, - body = "<C-t>", - heads = { - { "n", neotest.run.run }, - { - "f", - function() - neotest.run.run(vim.fn.expand("%")) - end, - }, - { "s", neotest.summary.toggle }, - { '<Esc>', nil, { exit = true } } - }, }) |