diff options
| author | Elvis Claros Castro <elvis@claros.ar> | 2024-07-12 11:18:14 -0300 |
|---|---|---|
| committer | Elvis Claros Castro <elvis@claros.ar> | 2024-07-12 11:18:14 -0300 |
| commit | ea0f4bf8ffade657b1d45152dbc183d4679e75c4 (patch) | |
| tree | cc1fb023bc308e019ddce33a4b0aed39f56805dc /lua/alpha | |
| parent | 1fd0af14d592d612c2aaab7717c04c8806ba3daa (diff) | |
| download | nvim-conf-ea0f4bf8ffade657b1d45152dbc183d4679e75c4.tar.gz nvim-conf-ea0f4bf8ffade657b1d45152dbc183d4679e75c4.zip | |
Feat: PI
Diffstat (limited to 'lua/alpha')
47 files changed, 0 insertions, 3019 deletions
diff --git a/lua/alpha/animations.lua b/lua/alpha/animations.lua deleted file mode 100644 index c0b7a6c..0000000 --- a/lua/alpha/animations.lua +++ /dev/null @@ -1,50 +0,0 @@ -local redraw_buffer = function() - local Animation = require "animation" - local fps = 45 -- frames per second - local easing = require "animation.easing" - - local buffer = 0 - local len = 0 - local place_holder = {} - - local lines = vim.api.nvim_buf_get_lines(buffer, 0, -1, true) - - for _, line in ipairs(lines) do - len = len + string.len(line) - table.insert(place_holder, "") - end - - vim.api.nvim_buf_set_lines(buffer, 0, #lines, true, place_holder) - - local duration = math.ceil(len / fps * 1000) - - local i = 1 - local line_nr = 1 - local insertLine = "" - - local function callback() - if lines[line_nr] == nil then - return true - end - local char = string.sub(lines[line_nr], i, i) - if char == nil then - return true - end - insertLine = insertLine .. char - i = i + 1 - vim.api.nvim_buf_set_lines(buffer, line_nr - 1, line_nr, true, { insertLine }) - - if insertLine == lines[line_nr] then - i = 1 - line_nr = line_nr + 1 - insertLine = "" - end - end - - local animation = Animation(duration, fps, easing.line, callback) - animation:run() -end - -return { - redraw_buffer = redraw_buffer, -} diff --git a/lua/alpha/completition/init.lua b/lua/alpha/completition/init.lua deleted file mode 100644 index 667e30b..0000000 --- a/lua/alpha/completition/init.lua +++ /dev/null @@ -1,205 +0,0 @@ -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.setup { - window = { - completion = { - border = "rounded", - -- winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None', - -- winblend = vim.o.pumblend, - -- scrolloff = 0, - -- col_offset = 0, - -- side_padding = 1, - -- scrollbar = true, - }, - documentation = { - -- max_height = math.floor(WIDE_HEIGHT * (WIDE_HEIGHT / vim.o.lines)), - -- max_width = math.floor((WIDE_HEIGHT * 2) * (vim.o.columns / (WIDE_HEIGHT * 2 * 16 / 9))), - border = "rounded", - -- winhighlight = 'FloatBorder:NormalFloat', - -- winblend = vim.o.pumblend, - }, - }, - 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-l>"] = cmp.mapping.select_next_item(), - ["<C-y>"] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Insert, - select = true, - }, - ["<c-space>"] = cmp.mapping.complete(), - }, - sources = { - { name = "dictionary" }, - { name = "nvim_lua" }, - { name = "nvim_lsp" }, - { name = "path" }, - { name = "luasnip" }, - { name = "copilot" }, - { - name = "buffer", - keyword_length = 4, - option = { - get_bufnrs = function() - local bufs = {} - for _, win in ipairs(vim.api.nvim_list_wins()) do - local bufnr = vim.api.nvim_win_get_buf(win) - if vim.api.nvim_buf_get_option(bufnr, "buftype") ~= "terminal" then - bufs[bufnr] = true - end - end - return vim.tbl_keys(bufs) - end, - }, - }, - }, - - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - - formatting = { - format = function (entry, vim_item) - lspkind.cmp_format { - with_text = true, - menu = { - buffer = "[buf]", - nvim_lsp = "[ ]", - nvim_lua = "[api]", - path = "[path]", - luasnip = "[snip]", - copilot = "[ﮧ ]", - ["vim-dadbod-completion"] = "[DB]", - }, - } - local KIND_ICONS = { - Tailwind = '', - Color = ' ', - -- Class = 7, - -- Constant = '', - -- Constructor = 4, - -- Enum = 13, - -- EnumMember = 20, - -- Event = 23, - -- Field = 5, - -- File = 17, - -- Folder = 19, - -- Function = 3, - -- Interface = 8, - -- Keyword = 14, - -- Method = 2, - -- Module = 9, - -- Operator = 24, - -- Property = 10, - -- Reference = 18, - Snippet = " ", - -- Struct = 22, - -- Text = "", - -- TypeParameter = 25, - -- Unit = 11, - -- Value = 12, - -- Variable = 6 - } - if vim_item.kind == 'Color' and entry.completion_item.documentation then - local _, _, r, g, b = - ---@diagnostic disable-next-line: param-type-mismatch - string.find(entry.completion_item.documentation, '^rgb%((%d+), (%d+), (%d+)') - - if r and g and b then - local color = string.format('%02x', r) .. string.format('%02x', g) .. string.format('%02x', b) - local group = 'Tw_' .. color - - if vim.api.nvim_call_function('hlID', { group }) < 1 then - vim.api.nvim_command('highlight' .. ' ' .. group .. ' ' .. 'guifg=#' .. color) - end - - vim_item.kind = KIND_ICONS.Tailwind - vim_item.kind_hl_group = group - - return vim_item - end - end - - vim_item.kind = KIND_ICONS[vim_item.kind] or vim_item.kind - return vim_item - end - }, - - sorting = { - priority_weight = 2, - comparators = { - compare.kind, - compare.sort_text, - }, - }, - - experimental = { - native_menu = false, - - ghost_text = false, - }, -} - -vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) - --- 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" }, - }), -}) - --- 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" }, - }, -}) - --- 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" }, - }), -}) - -cmp.setup.filetype({ "sql", "mysql", "plsql" }, { - sources = cmp.config.sources({ - { name = "vim-dadbod-completion" }, - }, { - { name = "buffer" }, - }), -}) diff --git a/lua/alpha/dap/configs/dart.lua b/lua/alpha/dap/configs/dart.lua deleted file mode 100644 index a23c118..0000000 --- a/lua/alpha/dap/configs/dart.lua +++ /dev/null @@ -1,32 +0,0 @@ -local dap = require('dap') - -dap.adapters.dart = { - type = "executable", - -- As of this writing, this functionality is open for review in https://github.com/flutter/flutter/pull/91802 - command = "flutter", - args = {"debug_adapter"} -} -dap.configurations.dart = { - { - name = "Launch Flutter Program Linux", - type = "dart", - request = "launch", - -- The nvim-dap plugin populates this variable with the filename of the current buffer - program = "${file}", - -- The nvim-dap plugin populates this variable with the editor's current working directory - cwd = "${workspaceFolder}", - -- This gets forwarded to the Flutter CLI tool, substitute `linux` for whatever device you wish to launch - toolArgs = {"-d", "linux"} - }, - { - name = "Launch Flutter Program Motorola", - type = "dart", - request = "launch", - -- The nvim-dap plugin populates this variable with the filename of the current buffer - program = "${file}", - -- The nvim-dap plugin populates this variable with the editor's current working directory - cwd = "${workspaceFolder}", - -- This gets forwarded to the Flutter CLI tool, substitute `linux` for whatever device you wish to launch - toolArgs = {"-d", "192.168.0.33:5555"} - } -} diff --git a/lua/alpha/dap/configs/elixir.lua b/lua/alpha/dap/configs/elixir.lua deleted file mode 100644 index bf732ce..0000000 --- a/lua/alpha/dap/configs/elixir.lua +++ /dev/null @@ -1,52 +0,0 @@ -local dap = require('dap') - -dap.adapters.mix_task = { - type = 'executable', - command = 'elixir-ls-debugger', -- El comando 'elixir-ls' está en $PATH - args = {} -} - -dap.configurations.elixir = { - { - type = "mix_task", - name = "mix (Default task)", - request = "launch", - projectDir = "${workspaceRoot}" - }, - { - type = "mix_task", - name = "mix test", - request = "launch", - task = 'test', - env = { - MIX_ENV = "test", - MIX_TARGET = "host", - HEX_UNSAFE_HTTPS = 1 - }, - taskArgs = {"--trace"}, - startApps = true, -- for Phoenix projects - projectDir = "${workspaceFolder}", - requireFiles = { - "test/**/test_helper.exs", - "test/**/*_test.exs" - } - }, - { - type = "mix_task", - name = "phx server", - request = "launch", - stackTraceMode = "all", - task = 'phx.server', - debugAutoInterpretAllModules = true, - noDebug = false, - exitAfterTaskReturns = false, - env = { - MIX_ENV = "dev", - MIX_TARGET = "host", - HEX_UNSAFE_HTTPS = 1 - }, - startApps = false, -- for Phoenix projects - taskArgs = {"--no-halt", "--open"}, - projectDir = "${workspaceFolder}", - }, -} diff --git a/lua/alpha/dap/configs/golang.lua b/lua/alpha/dap/configs/golang.lua deleted file mode 100644 index 1ec449a..0000000 --- a/lua/alpha/dap/configs/golang.lua +++ /dev/null @@ -1 +0,0 @@ -require("dap-go").setup() diff --git a/lua/alpha/dap/configs/javascript.lua b/lua/alpha/dap/configs/javascript.lua deleted file mode 100644 index 03173ba..0000000 --- a/lua/alpha/dap/configs/javascript.lua +++ /dev/null @@ -1,62 +0,0 @@ -local dap = require('dap') -dap.adapters.firefox = { - type = 'executable', - command = 'firefox-debug-adapter', -} - -dap.configurations.typescript = { - { - name = 'Debug with Firefox', - type = 'firefox', - request = 'launch', - reAttach = true, - url = 'http://localhost:3010', - webRoot = '${workspaceFolder}', - firefoxExecutable = '/home/elvis/.local/bin/firefox' - }, -} --- 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}", --- }, --- } --- 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", --- }, --- } --- end diff --git a/lua/alpha/dap/configs/kotlin.lua b/lua/alpha/dap/configs/kotlin.lua deleted file mode 100644 index aa486db..0000000 --- a/lua/alpha/dap/configs/kotlin.lua +++ /dev/null @@ -1,18 +0,0 @@ -local dap = require('dap') - -dap.adapters.kotlin = { - type = 'executable'; - command = "kotlin-debug-adapter"; -} - -dap.configurations.kotlin = { - { - type = 'kotlin', - request = 'launch', - program = "${file}", - name = 'Launch kotlin program', - projectRoot = "${workspaceFolder}/app", - mainClass = "AppKt", - } -} -dap.defaults.kotlin.auto_continue_if_many_stopped = false diff --git a/lua/alpha/dap/configs/php.lua b/lua/alpha/dap/configs/php.lua deleted file mode 100644 index 968bb9d..0000000 --- a/lua/alpha/dap/configs/php.lua +++ /dev/null @@ -1,27 +0,0 @@ -local dap = require("dap") - -dap.adapters.php = { - 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}", - }, - }, -} diff --git a/lua/alpha/dap/configs/rust.lua b/lua/alpha/dap/configs/rust.lua deleted file mode 100644 index 9ca976f..0000000 --- a/lua/alpha/dap/configs/rust.lua +++ /dev/null @@ -1,57 +0,0 @@ -local dap = require("dap") - -local rust_adapter = nil -local rust_adapters = { "lldb-vscode", "codelldb" } -for _, adapter in pairs(rust_adapters) do - if vim.fn.executable(adapter) then - rust_adapter = adapter - end -end - -if rust_adapter ~= nil then - dap.adapters.lldb = { - type = "executable", - command = rust_adapter, - name = "lldb", - } - - dap.configurations.rust = { - { - name = "launch", - type = "lldb", - request = "launch", - program = function() - local dir = vim.fn.getcwd() - return dir .. "/target/debug/" .. vim.fs.basename(dir) - end, - cwd = "${workspaceFolder}", - stopOnEntry = false, - args = function() - local resp = vim.fn.input "Arguments: " - if resp == "" then - return {} - end - - return vim.fn.split(resp, " ") - end, - }, - { - name = "custom", - type = "lldb", - request = "launch", - program = function() - return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") - end, - cwd = "${workspaceFolder}", - stopOnEntry = false, - args = function() - local resp = vim.fn.input "Arguments: " - if resp == "" then - return {} - end - - return vim.fn.split(resp, " ") - end, - }, - } -end diff --git a/lua/alpha/dap/init.lua b/lua/alpha/dap/init.lua deleted file mode 100644 index 12ea352..0000000 --- a/lua/alpha/dap/init.lua +++ /dev/null @@ -1,108 +0,0 @@ -local dap, dapui, hydra = require "dap", require "dapui", require "hydra" - -dap.set_log_level('TRACE') - --- Setup Virtual Text -require("nvim-dap-virtual-text").setup {} - -for _, ft_path in ipairs(vim.api.nvim_get_runtime_file("lua/alpha/dap/configs/*.lua", true)) do - loadfile(ft_path)() -end - --- Signs -vim.fn.sign_define("DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" }) -vim.fn.sign_define("DapStopped", { text = "▶", texthl = "", linehl = "", numhl = "" }) -vim.fn.sign_define("DapBreakpointRejected", { text = "🚫", texthl = "", linehl = "", numhl = "" }) -vim.fn.sign_define("DapBreakpointCondition", { text = "❓", texthl = "", linehl = "", numhl = "" }) -vim.fn.sign_define("DapLogPoint", { text = "💬", texthl = "", linehl = "", numhl = "" }) - --- UI structure -dapui.setup { - icons = { expanded = "▾", collapsed = "▸" }, - layouts = { - { - elements = { - "scopes", - "breakpoints", - "stacks", - "watches", - }, - size = 50, - position = "right", - }, - { - elements = { - "repl", - "console", - }, - size = 7, - position = "bottom", - }, - }, -} - --- Events Listeners -dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open {} -end - -local hint = [[ - Nvim DAP - _d_: Start/Continue _j_: StepOver _k_: StepOut _l_: StepInto ^ - _bp_: Toogle Breakpoint _bc_: Conditional Breakpoint ^ - _?_: log point ^ - _c_: Run To Cursor ^ - _h_: Show information of the variable under the cursor ^ - _x_: Stop Debbuging ^ - ^^ _<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, - }, - - { "<Esc>", nil, { exit = true } }, - }, -} diff --git a/lua/alpha/globals.lua b/lua/alpha/globals.lua deleted file mode 100644 index e445e72..0000000 --- a/lua/alpha/globals.lua +++ /dev/null @@ -1,23 +0,0 @@ ---- Dumps all values into pretty print ----@vararg any ----@return any -dump = function(...) - local args = {...} - - local mapped = {} - for _, v in ipairs(args) do - table.insert(mapped, vim.inspect(v)) - end - print(unpack(mapped)) - - return unpack(args) -end - -Reload = function(...) - return require("plenary.reload").reload_module(...) -end - -R = function(name) - Reload(name) - return require(name) -end diff --git a/lua/alpha/laravel-tinker.lua b/lua/alpha/laravel-tinker.lua deleted file mode 100644 index 214d958..0000000 --- a/lua/alpha/laravel-tinker.lua +++ /dev/null @@ -1,64 +0,0 @@ -local M = {} - -M.runCode = function() - local curBuff = vim.api.nvim_get_current_buf() - - local stats = vim.api.nvim_list_uis()[1] - - 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", - }) - - -- 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) - - -- print (vim.inspect(code)) - - local codeText = vim.fn.shellescape(table.concat(code, " ")) - -- print(codeText) - - local result = vim.fn.systemlist("php artisan tinker --execute=" .. codeText) - - 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") -end - -return M diff --git a/lua/alpha/lsp/attach.lua b/lua/alpha/lsp/attach.lua deleted file mode 100644 index 7c7413c..0000000 --- a/lua/alpha/lsp/attach.lua +++ /dev/null @@ -1,29 +0,0 @@ -local telescope_mapper = require "alpha.telescope.mappings" - -return function(client, bufnr) - -- keymaps for lsp - vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = 0, desc = "LSP Help information of symbol under the cursor" }) - vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, { buffer = 0, desc = "LSP Rename symbol under cursor" }) - vim.keymap.set("i", "<c-h>", vim.lsp.buf.signature_help, { buffer = 0, desc = "LSP Signature help" }) - vim.keymap.set("n", "<leader>vo", ":LspRestart<cr>", { noremap = true, desc = "LSP Resta |