diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-10-04 08:44:32 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-10-04 08:44:32 +0200 |
| commit | b0807c67e416fbd37f70ee2565f4462305d181fa (patch) | |
| tree | 5f972cc1b2d56bfb39a44df212827ab827cb7006 | |
| parent | bc7ded2a1cebcd4bbf5e549b107c7e11a5f32535 (diff) | |
| download | nvim-conf-b0807c67e416fbd37f70ee2565f4462305d181fa.tar.gz nvim-conf-b0807c67e416fbd37f70ee2565f4462305d181fa.zip | |
feat: small changes and improvementes
| -rw-r--r-- | after/plugin/floatterm.lua | 2 | ||||
| -rw-r--r-- | after/plugin/lsp.lua | 27 | ||||
| -rw-r--r-- | after/plugin/neotest.lua | 17 | ||||
| -rw-r--r-- | lua/alpha/snips/ft/php.lua | 16 | ||||
| -rw-r--r-- | queries/php/highlights.scm | 5 |
5 files changed, 45 insertions, 22 deletions
diff --git a/after/plugin/floatterm.lua b/after/plugin/floatterm.lua index 6b3c59b..ca4f9b4 100644 --- a/after/plugin/floatterm.lua +++ b/after/plugin/floatterm.lua @@ -1,3 +1,3 @@ -vim.keymap.set('n', '``', function () +vim.keymap.set({ "n", "t" }, "``", function() vim.cmd([[FloatermToggle]]) end, {}) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index cf37881..cdf0e69 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -60,11 +60,6 @@ local function on_attach(client, bufnr) local filetype = vim.api.nvim_buf_get_option(0, "filetype") -- keymaps for lsp vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = 0 }) - vim.keymap.set("n", "<c-]>", vim.lsp.buf.definition, { buffer = 0 }) - vim.keymap.set("n", "<leader><c-]>", function() - vim.cmd("vsp") - vim.lsp.buf.definition() - end, { buffer = 0 }) vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, { buffer = 0 }) vim.keymap.set("i", "<c-h>", vim.lsp.buf.signature_help, { buffer = 0 }) vim.keymap.set("n", "<leader>vo", ":LspRestart<cr>", { noremap = true }) @@ -72,6 +67,7 @@ local function on_attach(client, bufnr) telescope_mapper("gr", "lsp_references", nil, true) telescope_mapper("<leader>pv", "find_symbol", nil, true) telescope_mapper("<leader>pd", "lsp_document_symbols", nil, true) + telescope_mapper("<c-]>", "lsp_definitions", nil, true) vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc" @@ -184,3 +180,24 @@ require("lspconfig")["sumneko_lua"].setup({ }, }, }) + +local lspconfig = require("lspconfig") +local configs = require("lspconfig.configs") + +configs.blade = { + default_config = { + cmd = { "laravel-dev-tools", "lsp" }, + filetypes = { "blade" }, + root_dir = function(fname) + return lspconfig.util.find_git_ancestor(fname) + end, + settings = {}, + }, +} +-- Set it up +lspconfig.blade.setup({ + -- Capabilities is specific to my setup. + capabilities = capabilities, + on_attach = on_attach, + flags = lsp_flags, +}) diff --git a/after/plugin/neotest.lua b/after/plugin/neotest.lua index c43e74c..c1b55c4 100644 --- a/after/plugin/neotest.lua +++ b/after/plugin/neotest.lua @@ -3,8 +3,6 @@ if not ok then return end -local composer = require("composer") - neotest.setup({ adapters = { require("neotest-go"), @@ -13,20 +11,7 @@ neotest.setup({ 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 - }), + require("laravel.neotest"), }, }) diff --git a/lua/alpha/snips/ft/php.lua b/lua/alpha/snips/ft/php.lua index 5ca63f6..decee10 100644 --- a/lua/alpha/snips/ft/php.lua +++ b/lua/alpha/snips/ft/php.lua @@ -102,6 +102,12 @@ M.pro = fmt([[{} {} ${},]], { end, { 2 }), }) +M.rpro = fmt([[{} readonly {} ${},]], { + visibility(1, "public"), + i(2, "int"), + i(3, ""), +}) + M._c = fmt( [[{} function __construct({}) {{ {} @@ -150,4 +156,14 @@ M["then"] = fmt([[->then(function ({}) {{ {} }})]], {i(1, ""), i(2, "")}) +M.test = fmt([[/** + * @test + */ +public function it_{}(): void +{{ + {} +}} +]], {i(1, ""), i(0, "")}) + + return M diff --git a/queries/php/highlights.scm b/queries/php/highlights.scm new file mode 100644 index 0000000..741bb7a --- /dev/null +++ b/queries/php/highlights.scm @@ -0,0 +1,5 @@ +;; extends + +[ + "readonly" +] @keyword.function |