aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha
diff options
context:
space:
mode:
authorAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-01-31 09:44:13 +0100
committerAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-01-31 09:44:13 +0100
commit669561e21073e6efafddda25ba3ace69fb43819e (patch)
treef94ebd60ad4cab480b5cbcb7e65dd2060696c339 /lua/alpha
parent5044c70e9f62cdd06ee91e754423b07c1c18c12d (diff)
downloadnvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.tar.gz
nvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.zip
feat: apply stylua
Diffstat (limited to 'lua/alpha')
-rw-r--r--lua/alpha/completition/init.lua210
-rw-r--r--lua/alpha/dap.lua272
-rw-r--r--lua/alpha/database.lua66
-rw-r--r--lua/alpha/globals.lua16
-rw-r--r--lua/alpha/harpoon.lua51
-rw-r--r--lua/alpha/laravel-tinker.lua99
-rw-r--r--lua/alpha/lsp/attach.lua49
-rw-r--r--lua/alpha/lsp/init.lua18
-rw-r--r--lua/alpha/lsp/mason.lua16
-rw-r--r--lua/alpha/lsp/null-ls.lua55
-rw-r--r--lua/alpha/lsp/servers.lua22
-rw-r--r--lua/alpha/lsp/setups.lua134
-rw-r--r--lua/alpha/lsp/tools.lua4
-rw-r--r--lua/alpha/php/gateway.lua198
-rw-r--r--lua/alpha/php/lsp.lua197
-rw-r--r--lua/alpha/php/servers.lua42
-rw-r--r--lua/alpha/scratchs/behat-test.lua111
-rw-r--r--lua/alpha/scratchs/laravel.lua2
-rw-r--r--lua/alpha/scratchs/sample.lua36
-rw-r--r--lua/alpha/snips/ft/cucumber.lua7
-rw-r--r--lua/alpha/snips/ft/go.lua190
-rw-r--r--lua/alpha/snips/ft/lua.lua82
-rw-r--r--lua/alpha/snips/ft/php.lua198
-rw-r--r--lua/alpha/snips/ft/yaml.lua258
-rw-r--r--lua/alpha/telescope/actions.lua230
-rw-r--r--lua/alpha/telescope/init.lua210
-rw-r--r--lua/alpha/telescope/mappings.lua24
-rw-r--r--lua/alpha/telescope/setup.lua320
-rw-r--r--lua/alpha/utils.lua30
29 files changed, 1574 insertions, 1573 deletions
diff --git a/lua/alpha/completition/init.lua b/lua/alpha/completition/init.lua
index 2951608..9955d4e 100644
--- a/lua/alpha/completition/init.lua
+++ b/lua/alpha/completition/init.lua
@@ -1,127 +1,127 @@
-local cmp = require("cmp")
-local lspkind = require("lspkind")
-local luasnip = require("luasnip")
-local cmp_autopairs = require("nvim-autopairs.completion.cmp")
-local compare = require('cmp.config.compare')
+local cmp = require "cmp"
+local lspkind = require "lspkind"
+local luasnip = require "luasnip"
+local cmp_autopairs = require "nvim-autopairs.completion.cmp"
+local compare = require "cmp.config.compare"
-cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
+cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } })
-cmp.setup({
- mapping = {
- ["<C-d>"] = cmp.mapping.scroll_docs(-4),
- ["<C-f>"] = cmp.mapping.scroll_docs(4),
- ["<C-e>"] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.close()
- elseif luasnip.expand_or_jumpable() then
- luasnip.expand_or_jump()
- else
- fallback()
- end
- end, { "i", "s" }),
- ["<C-n>"] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.select_next_item()
- elseif luasnip.choice_active() then
- luasnip.change_choice(1)
- else
- fallback()
- end
- end, { "i", "s" }),
- ["<C-p>"] = cmp.mapping.select_prev_item(),
- ["<C-y>"] = cmp.mapping.confirm({
- behavior = cmp.ConfirmBehavior.Insert,
- select = true,
- }),
- ["<c-space>"] = cmp.mapping.complete(),
- },
- sources = {
- { name = "nvim_lua" },
- { name = "nvim_lsp" },
- { name = "path" },
- { name = "luasnip" },
- { name = 'nvim_lsp_signature_help' },
- {
- name = "buffer",
- keyword_length = 4,
- option = {
- get_bufnrs = function()
- local bufs = {}
- for _, win in ipairs(vim.api.nvim_list_wins()) do
- bufs[vim.api.nvim_win_get_buf(win)] = true
- end
- return vim.tbl_keys(bufs)
- end,
- },
- },
- },
+cmp.setup {
+ mapping = {
+ ["<C-d>"] = cmp.mapping.scroll_docs(-4),
+ ["<C-f>"] = cmp.mapping.scroll_docs(4),
+ ["<C-e>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.close()
+ elseif luasnip.expand_or_jumpable() then
+ luasnip.expand_or_jump()
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+ ["<C-n>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.select_next_item()
+ elseif luasnip.choice_active() then
+ luasnip.change_choice(1)
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+ ["<C-p>"] = cmp.mapping.select_prev_item(),
+ ["<C-y>"] = cmp.mapping.confirm {
+ behavior = cmp.ConfirmBehavior.Insert,
+ select = true,
+ },
+ ["<c-space>"] = cmp.mapping.complete(),
+ },
+ sources = {
+ { name = "nvim_lua" },
+ { name = "nvim_lsp" },
+ { name = "path" },
+ { name = "luasnip" },
+ { name = "nvim_lsp_signature_help" },
+ {
+ name = "buffer",
+ keyword_length = 4,
+ option = {
+ get_bufnrs = function()
+ local bufs = {}
+ for _, win in ipairs(vim.api.nvim_list_wins()) do
+ bufs[vim.api.nvim_win_get_buf(win)] = true
+ end
+ return vim.tbl_keys(bufs)
+ end,
+ },
+ },
+ },
- snippet = {
- expand = function(args)
- require("luasnip").lsp_expand(args.body)
- end,
- },
+ snippet = {
+ expand = function(args)
+ require("luasnip").lsp_expand(args.body)
+ end,
+ },
- formatting = {
- format = lspkind.cmp_format({
- with_text = true,
- menu = {
- buffer = "[buf]",
- nvim_lsp = "[LSP]",
- nvim_lua = "[api]",
- path = "[path]",
- luasnip = "[snip]",
- ["vim-dadbod-completion"] = "[DB]",
- },
- }),
- },
+ formatting = {
+ format = lspkind.cmp_format {
+ with_text = true,
+ menu = {
+ buffer = "[buf]",
+ nvim_lsp = "[LSP]",
+ nvim_lua = "[api]",
+ path = "[path]",
+ luasnip = "[snip]",
+ ["vim-dadbod-completion"] = "[DB]",
+ },
+ },
+ },
- sorting = {
- priority_weight = 2,
- comparators = {
- compare.kind,
- compare.sort_text,
- }
- },
+ sorting = {
+ priority_weight = 2,
+ comparators = {
+ compare.kind,
+ compare.sort_text,
+ },
+ },
- experimental = {
- native_menu = false,
+ experimental = {
+ native_menu = false,
- ghost_text = true,
- },
-})
+ ghost_text = true,
+ },
+}
-- Set configuration for specific filetype.
cmp.setup.filetype("gitcommit", {
- sources = cmp.config.sources({
- { name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it.
- }, {
- { name = "buffer" },
- }),
+ sources = cmp.config.sources({
+ { name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it.
+ }, {
+ { name = "buffer" },
+ }),
})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline("/", {
- mapping = cmp.mapping.preset.cmdline(),
- sources = {
- { name = "buffer" },
- },
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = {
+ { name = "buffer" },
+ },
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
- mapping = cmp.mapping.preset.cmdline(),
- sources = cmp.config.sources({
- { name = "path" },
- }, {
- { name = "cmdline" },
- }),
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = "path" },
+ }, {
+ { name = "cmdline" },
+ }),
})
cmp.setup.filetype({ "sql", "mysql", "plsql" }, {
- sources = cmp.config.sources({
- { name = "vim-dadbod-completion" },
- }, {
- { name = "buffer" },
- }),
+ sources = cmp.config.sources({
+ { name = "vim-dadbod-completion" },
+ }, {
+ { name = "buffer" },
+ }),
})
diff --git a/lua/alpha/dap.lua b/lua/alpha/dap.lua
index ee53443..a89d72e 100644
--- a/lua/alpha/dap.lua
+++ b/lua/alpha/dap.lua
@@ -1,33 +1,33 @@
-local dap, dapui, dap_go = require("dap"), require("dapui"), require("dap-go")
+local dap, dapui, dap_go = require "dap", require "dapui", require "dap-go"
-require("nvim-dap-virtual-text").setup({})
+require("nvim-dap-virtual-text").setup {}
-- dap.set_log_level('TRACE')
dap_go.setup()
-dapui.setup({
- icons = { expanded = "▾", collapsed = "▸" },
- layouts = {
- {
- elements = {
- "scopes",
- "breakpoints",
- "stacks",
- "watches",
- },
- size = 80,
- position = "left",
- },
- {
- elements = {
- "repl",
- "console",
- },
- size = 10,
- position = "bottom",
- },
- },
-})
+dapui.setup {
+ icons = { expanded = "▾", collapsed = "▸" },
+ layouts = {
+ {
+ elements = {
+ "scopes",
+ "breakpoints",
+ "stacks",
+ "watches",
+ },
+ size = 80,
+ position = "left",
+ },
+ {
+ elements = {
+ "repl",
+ "console",
+ },
+ size = 10,
+ position = "bottom",
+ },
+ },
+}
vim.fn.sign_define("DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" })
vim.fn.sign_define("DapStopped", { text = "▶", texthl = "", linehl = "", numhl = "" })
@@ -36,83 +36,83 @@ vim.fn.sign_define("DapBreakpointCondition", { text = "❓", texthl = "", linehl
vim.fn.sign_define("DapLogPoint", { text = "💬", texthl = "", linehl = "", numhl = "" })
dap.adapters.php = {
- type = "executable",
- command = "php-debug-adapter",
+ type = "executable",
+ command = "php-debug-adapter",
}
dap.configurations.php = {
- {
- type = "php",
- request = "launch",
- name = "Laravel",
- port = 9003,
- pathMappings = {
- ["/var/www/html"] = "${workspaceFolder}",
- },
- },
- {
- type = "php",
- request = "launch",
- name = "Symfony",
- port = 9003,
- pathMappings = {
- ["/app"] = "${workspaceFolder}",
- },
- },
+ {
+ type = "php",
+ request = "launch",
+ name = "Laravel",
+ port = 9003,
+ pathMappings = {
+ ["/var/www/html"] = "${workspaceFolder}",
+ },
+ },
+ {
+ type = "php",
+ request = "launch",
+ name = "Symfony",
+ port = 9003,
+ pathMappings = {
+ ["/app"] = "${workspaceFolder}",
+ },
+ },
}
-require("dap-vscode-js").setup({
- debugger_cmd = { "js-debug-adapter" },
- adapters = { "pwa-node", "pwa-chrome", "node-terminal" },
-})
+require("dap-vscode-js").setup {
+ debugger_cmd = { "js-debug-adapter" },
+ adapters = { "pwa-node", "pwa-chrome", "node-terminal" },
+}
-for _, language in ipairs({ "typescript", "javascript" }) do
- require("dap").configurations[language] = {
- {
- type = "pwa-node",
- request = "launch",
- name = "Launch file",
- program = "${file}",
- cwd = "${workspaceFolder}",
- },
- {
- type = "pwa-node",
- request = "attach",
- name = "Attach",
- processId = require("dap.utils").pick_process,
- cwd = "${workspaceFolder}",
- },
- }
+for _, language in ipairs { "typescript", "javascript" } do
+ require("dap").configurations[language] = {
+ {
+ type = "pwa-node",
+ request = "launch",
+ name = "Launch file",
+ program = "${file}",
+ cwd = "${workspaceFolder}",
+ },
+ {
+ type = "pwa-node",
+ request = "attach",
+ name = "Attach",
+ processId = require("dap.utils").pick_process,
+ cwd = "${workspaceFolder}",
+ },
+ }
end
-for _, language in ipairs({ "typescriptreact", "javascriptreact" }) do
- require("dap").configurations[language] = {
- {
- type = "pwa-chrome",
- name = "Attach - Remote Debugging",
- request = "attach",
- program = "${file}",
- cwd = vim.fn.getcwd(),
- sourceMaps = true,
- protocol = "inspector",
- port = 9222,
- webRoot = "${workspaceFolder}",
- },
- {
- type = "pwa-chrome",
- name = "Launch Chrome",
- request = "launch",
- url = "http://localhost:3000",
- },
- }
+for _, language in ipairs { "typescriptreact", "javascriptreact" } do
+ require("dap").configurations[language] = {
+ {
+ type = "pwa-chrome",
+ name = "Attach - Remote Debugging",
+ request = "attach",
+ program = "${file}",
+ cwd = vim.fn.getcwd(),
+ sourceMaps = true,
+ protocol = "inspector",
+ port = 9222,
+ webRoot = "${workspaceFolder}",
+ },
+ {
+ type = "pwa-chrome",
+ name = "Launch Chrome",
+ request = "launch",
+ url = "http://localhost:3000",
+ },
+ }
end
-- Events Listeners
dap.listeners.after.event_initialized["dapui_config"] = function()
- dapui.open({})
+ dapui.open {}
end
-local hydra = require("hydra")
+local hydra = require "hydra"
local hint = [[
Nvim DAP
_d_: Start/Continue _j_: StepOver _k_: StepOut _l_: StepInto ^
@@ -124,52 +124,52 @@ local hint = [[
^^ _<Esc>_
]]
-hydra({
- name = "dap",
- hint = hint,
- mode = "n",
- config = {
- color = "blue",
- invoke_on_body = true,
- hint = {
- border = "rounded",
- position = "bottom",
- },
- },
- body = "<leader>d",
- heads = {
- { "d", dap.continue },
- { "bp", dap.toggle_breakpoint },
- { "l", dap.step_into },
- { "j", dap.step_over },
- { "k", dap.step_out },
- { "h", dapui.eval },
- { "c", dap.run_to_cursor },
- {
- "bc",
- function()
- vim.ui.input({ prompt = "Condition: " }, function(condition)
- dap.set_breakpoint(condition)
- end)
- end,
- },
- {
- "?",
- function()
- vim.ui.input({ prompt = "Log: " }, function(log)
- dap.set_breakpoint(nil, nil, log)
- end)
- end,
- },
- {
- "x",
- function()
- dap.terminate()
- dapui.close({})
- dap.clear_breakpoints()
- end,
- },
+hydra {
+ name = "dap",
+ hint = hint,
+ mode = "n",
+ config = {
+ color = "blue",
+ invoke_on_body = true,
+ hint = {
+ border = "rounded",
+ position = "bottom",
+ },
+ },
+ body = "<leader>d",
+ heads = {
+ { "d", dap.continue },
+ { "bp", dap.toggle_breakpoint },
+ { "l", dap.step_into },
+ { "j", dap.step_over },
+ { "k", dap.step_out },
+ { "h", dapui.eval },
+ { "c", dap.run_to_cursor },
+ {
+ "bc",
+ function()
+ vim.ui.input({ prompt = "Condition: " }, function(condition)
+ dap.set_breakpoint(condition)
+ end)
+ end,
+ },
+ {
+ "?",
+ function()
+ vim.ui.input({ prompt = "Log: " }, function(log)
+ dap.set_breakpoint(nil, nil, log)
+ end)
+ end,
+ },
+ {
+ "x",
+ function()
+ dap.terminate()
+ dapui.close {}
+ dap.clear_breakpoints()
+ end,
+ },
- { "<Esc>", nil, { exit = true } },
- },
-})
+ { "<Esc>", nil, { exit = true } },
+ },
+}
diff --git a/lua/alpha/database.lua b/lua/alpha/database.lua
index 32121eb..39e9769 100644
--- a/lua/alpha/database.lua
+++ b/lua/alpha/database.lua
@@ -1,43 +1,43 @@
vim.g.db_ui_use_nerd_fonts = 1
vim.g.db_ui_show_database_icon = 1
vim.g.db_ui_force_echo_notifications = 1
-vim.g.db_ui_win_position = 'right'
+vim.g.db_ui_win_position = "right"
vim.g.db_ui_winwidth = 80
vim.g.db_ui_table_helpers = {
- mysql = {
- Count = "select count(1) from {optional_schema}{table}",
- Explain = "EXPLAIN {last_query}"
- },
- sqlite = {
- Describe = "PRAGMA table_info({table})"
- }
+ mysql = {
+ Count = "select count(1) from {optional_schema}{table}",
+ Explain = "EXPLAIN {last_query}",
+ },
+ sqlite = {
+ Describe = "PRAGMA table_info({table})",
+ },
}
vim.g.db_ui_icons = {
- expanded = {
- db = '▾ ',
- buffers = '▾ ',
- saved_queries = '▾ ',
- schemas = '▾ ',
- schema = '▾ פּ',
- tables = '▾ 藺',
- table = '▾ ',
- },
- collapsed = {
- db = '▸ ',
- buffers = '▸ ',
- saved_queries = '▸ ',
- schemas = '▸ ',
- schema = '▸ פּ',
- tables = '▸ 藺',
- table = '▸ ',
- },
- saved_query = '',
- new_query = '璘',
- tables = '離',
- buffers = '﬘',
- add_connection = '',
- connection_ok = '✓',
- connection_error = '✕',
+ expanded = {
+ db = "▾ ",
+ buffers = "▾ ",
+ saved_queries = "▾ ",
+ schemas = "▾ ",
+ schema = "▾ פּ",
+ tables = "▾ 藺",
+ table = "▾ ",
+ },
+ collapsed = {
+ db = "▸ ",
+ buffers = "▸ ",
+ saved_queries = "▸ ",
+ schemas = "▸ ",
+ schema = "▸ פּ",
+ tables = "▸ 藺",
+ table = "▸ ",
+ },
+ saved_query = "",
+ new_query = "璘",
+ tables = "離",
+ buffers = "﬘",
+ add_connection = "",
+ connection_ok = "✓",
+ connection_error = "✕",
}
diff --git a/lua/alpha/globals.lua b/lua/alpha/globals.lua
index 5fcee70..d6fd70c 100644
--- a/lua/alpha/globals.lua
+++ b/lua/alpha/globals.lua
@@ -1,13 +1,13 @@
-P = function (v)
- print(vim.inspect(v))
- return v
+P = function(v)
+ print(vim.inspect(v))
+ return v
end
-RELOAD = function (...)
- return require("plenary.reload").reload_module(...)
+RELOAD = function(...)
+ return require("plenary.reload").reload_module(...)
end
-R = function (name)
- RELOAD(name)
- return require(name)
+R = function(name)
+ RELOAD(name)
+ return require(name)
end
diff --git a/lua/alpha/harpoon.lua b/lua/alpha/harpoon.lua
index 209424f..78e6e9b 100644
--- a/lua/alpha/harpoon.lua
+++ b/lua/alpha/harpoon.lua
@@ -1,43 +1,44 @@
-local M = {};
+local M = {}
-- changing this values will require re-compile packer
local terms = vim.g.harpoon_terms or 3
local quick_binds = vim.g.harpoon_quick_binds or 5
M.keymaps = {
- {"<leader>ss"},
- {"<leader>sa"},
+ { "<leader>ss" },
+ { "<leader>sa" },
}
for i = 1, terms do
- table.insert(M.keymaps, {string.format("<leader><leader>%s", i)})
+ table.insert(M.keymaps, { string.format("<leader><leader>%s", i) })
end
for i = 1, quick_binds do
- table.insert(M.keymaps, {string.format("<leader>%s", i)})
+ table.insert(M.keymaps, { string.format("<leader>%s", i) })
end
M.setup = function()
- require('harpoon').setup()
-
- vim.keymap.set('n', '<leader>ss', require("harpoon.ui").toggle_quick_menu, { noremap = true, silent = true, expr = false })
- vim.keymap.set('n', '<leader>sa', require("harpoon.mark").add_file, { noremap = true, silent = true, expr = false })
-
- for i = 1, terms do
- vim.keymap.set('n', string.format('<leader><leader>%s', i), function() require("harpoon.term").gotoTerminal(i) end,
- { noremap = true, silent = true, expr = false })
- end
-
- for i = 1, quick_binds do
- vim.keymap.set(
- 'n',
- string.format("<leader>%s", i),
- function()
- require("harpoon.ui").nav_file(i)
- end,
- { noremap = true, silent = true, expr = false }
- )
- end
+ require("harpoon").setup()
+
+ vim.keymap.set(
+ "n",
+ "<leader>ss",
+ require("harpoon.ui").toggle_quick_menu,
+ { noremap = true, silent = true, expr = false }
+ )
+ vim.keymap.set("n", "<leader>sa", require("harpoon.mark").add_file, { noremap = true, silent = true, expr = false })
+
+ for i = 1, terms do
+ vim.keymap.set("n", string.format("<leader><leader>%s", i), function()
+ require("harpoon.term").gotoTerminal(i)
+ end, { noremap = true, silent = true, expr = false })
+ end
+
+ for i = 1, quick_binds do
+ vim.keymap.set("n", string.format("<leader>%s", i), function()
+ require("harpoon.ui").nav_file(i)
+ end, { noremap = true, silent = true, expr = false })
+ end
end
return M
diff --git a/lua/alpha/laravel-tinker.lua b/lua/alpha/laravel-tinker.lua
index fa23346..214d958 100644
--- a/lua/alpha/laravel-tinker.lua
+++ b/lua/alpha/laravel-tinker.lua
@@ -1,67 +1,64 @@
local M = {}
+M.runCode = function()
+ local curBuff = vim.api.nvim_get_current_buf()
-M.runCode = function ()
- local curBuff = vim.api.nvim_get_current_buf()
+ local stats = vim.api.nvim_list_uis()[1]
- local stats = vim.api.nvim_list_uis()[1]
+ local width = stats.width
+ local height = stats.height
- local width = stats.width
- local height = stats.height
+ local bufh = vim.api.nvim_create_buf(false, true)
+ local winId = vim.api.nvim_open_win(bufh, true, {
+ relative = "editor",
+ width = width * 0.75,
+ height = height * 0.75,
+ col = 2,
+ row = 2,
+ style = "minimal",
+ border = "rounded",
+ })
- local bufh = vim.api.nvim_create_buf(false, true)
- local winId = vim.api.nvim_open_win(bufh, true, {
- relative = "editor",
- width = width * 0.75,
- height = height * 0.75,
- col = 2,
- row = 2,
- style = "minimal",
- border = "rounded",
- })
+ -- get the start and end lines of selection
+ local startLine = vim.api.nvim_buf_get_mark(curBuff, "<")[1] - 1
+ local endLine = vim.api.nvim_buf_get_mark(curBuff, ">")[1]
+ -- print("range: ", startLine, endLine)
- -- get the start and end lines of selection
- local startLine = vim.api.nvim_buf_get_mark(curBuff, "<")[1] -1
- local endLine = vim.api.nvim_buf_get_mark(curBuff, ">")[1]
- -- print("range: ", startLine, endLine)
+ local code = vim.api.nvim_buf_get_lines(curBuff, startLine, endLine, false)
- local code = vim.api.nvim_buf_get_lines(curBuff, startLine, endLine, false);
+ -- print (vim.inspect(code))
- -- print (vim.inspect(code))
+ local codeText = vim.fn.shellescape(table.concat(code, " "))
+ -- print(codeText)
- local codeText = vim.fn.shellescape(table.concat(code, " "))
- -- print(codeText)
+ local result = vim.fn.systemlist("php artisan tinker --execute=" .. codeText)
-
- local result = vim.fn.systemlist('php artisan tinker --execute=' .. codeText)
-
- vim.api.nvim_buf_set_text(bufh, 0, 0, 0, 0, result)
+ vim.api.nvim_buf_set_text(bufh, 0, 0, 0, 0, result)
end
-M.backTerminal = function ()
- local bufh = vim.api.nvim_create_buf(false, true)
- local term = vim.api.nvim_open_term(bufh, {})
-
- local winId = vim.api.nvim_open_win(bufh, true, {
- relative = "editor",
- width = 80,
- height = 80,
- col = 2,
- row = 2,
- style = "minimal",
- border = "rounded",
- })
-
- local jobId = vim.fn.jobstart("php artisan tinker", {
- on_stdout = function (err, data)
- print(err, vim.inspect(data))
- vim.api.nvim_chan_send(term, table.concat(data, "\n"))
- end
- })
-
- vim.api.nvim_chan_send(jobId, "$ub = UploadBatch::find(1);\n")
- vim.api.nvim_chan_send(jobId, "dump($ub);\n")
+M.backTerminal = function()
+ local bufh = vim.api.nvim_create_buf(false, true)
+ local term = vim.api.nvim_open_term(bufh, {})
+
+ local winId = vim.api.nvim_open_win(bufh, true, {
+ relative = "editor",
+ width = 80,
+ height = 80,
+ col = 2,
+ row = 2,
+ style = "minimal",
+ border = "rounded",
+ })
+
+ local jobId = vim.fn.jobstart("php artisan tinker", {
+ on_stdout = function(err, data)
+ print(err, vim.inspect(data))
+ vim.api.nvim_chan_send(term, table.concat(data, "\n"))
+ end,
+ })
+
+ vim.api.nvim_chan_send(jobId, "$ub = UploadBatch::find(1);\n")
+ vim.api.nvim_chan_send(jobId, "dump($ub);\n")
end
-
return M
diff --git a/lua/alpha/lsp/attach.lua b/lua/alpha/lsp/attach.lua
index ce63e02..fa67b2e 100644
--- a/lua/alpha/lsp/attach.lua
+++ b/lua/alpha/lsp/attach.lua
@@ -1,29 +1,34 @@
-local telescope_mapper = require("alpha.telescope.mappings")
+local telescope_mapper = require "alpha.telescope.mappings"
local filetype_attach = setmetatable({}, {
- __index = function()
- return function() end
- end,
+ __index = function()
+ return function() end
+ end,
})
-return function (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", "<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 })
- vim.keymap.set({ "n", "v" }, "<leader>vca", vim.lsp.buf.code_action, {})
- vim.keymap.set("n", "<leader>vf", function()
- return vim.lsp.buf.format({ async = true })
- end, {})
+return function(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", "<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 })
+ vim.keymap.set({ "n", "v" }, "<leader>vca", vim.lsp.buf.code_action, {})
+ vim.keymap.set("n", "<leader>vf", function()
+ return vim.lsp.buf.format {
+ async = true,
+ filter = function(cli)
+ return cli.name ~= "sumneko_lua"
+ end,
+ }
+ end, {})
- 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)
+ 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"
+ vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc"
- -- Attach any filetype specific options to the client
- filetype_attach[filetype](client, bufnr)
+ -- Attach any filetype specific options to the client
+ filetype_attach[filetype](client, bufnr)
end
diff --git a/lua/alpha/lsp/init.lua b/lua/alpha/lsp/init.lua
index c29472d..01bb3c1 100644
--- a/lua/alpha/lsp/init.lua
+++ b/lua/alpha/lsp/init.lua
@@ -1,14 +1,14 @@
-- LSP configuration
-- install servers and tools
-require('alpha.lsp.mason')
-local setups = require("alpha.lsp.setups")
+require "alpha.lsp.mason"
+local setups = require "alpha.lsp.setups"
-local lspconfig = require('lspconfig')
-require('mason-lspconfig').setup_handlers({
- function (server_name)
- lspconfig[server_name].setup(setups[server_name]())
- end
-})
+local lspconfig = require "lspconfig"
+require("mason-lspconfig").setup_handlers {
+ function(server_name)
+ lspconfig[server_name].setup(setups[server_name]())
+ end,
+}
-require('alpha.lsp.null-ls')
+require "alpha.lsp.null-ls"
diff --git a/lua/al