diff --git a/dot_config/nvim/lua/devfortunato/autocommands.lua b/dot_config/nvim/lua/devfortunato/autocommands.lua deleted file mode 100644 index ba1fd0a..0000000 --- a/dot_config/nvim/lua/devfortunato/autocommands.lua +++ /dev/null @@ -1,149 +0,0 @@ -local log = require("plenary.log"):new() -local ns = vim.api.nvim_create_namespace "live-tests" -local group = vim.api.nvim_create_augroup("devfortunato-magic", { clear = true }) - -local test_function_query_string = [[ -( - (function_declaration - name: (identifier) @name - parameters: - (parameter_list - (parameter_declaration - name: (identifier) - type: (pointer_type - (qualified_type - package: (package_identifier) @_package_name - name: (type_identifier) @_type_name))))) - - (#eq? @_package_name "testing") - (#eq? @_type_name "T") - (#eq? @name "%s") -) -]] - -local find_test_line = function(go_bufnr, name) - local formatted = string.format(test_function_query_string, name) - local query = vim.treesitter.query.parse("go", formatted) - local parser = vim.treesitter.get_parser(go_bufnr, "go", {}) - local tree = parser:parse()[1] - local root = tree:root() - for id, node in query:iter_captures(root, go_bufnr, 0, -1) do - if id == 1 then - local range = { node:range() } - return range[1] - end - end -end - -log.level = 'debug' - -local make_key = function(entry) - assert(entry.Package, "Must have Package:" .. vim.inspect(entry)) - assert(entry.Test, "Must have Test:" .. vim.inspect(entry)) - return string.format("%s/%s", entry.Package, entry.Test) -end - -local add_golang_test = function(state, entry) - state.tests[make_key(entry)] = { - name = entry.Test, - line = find_test_line(state.bufnr, entry.Test), - output = {}, - } -end - --- local add_golang_output = function(state, entry) --- assert(state.tests, vim.inspect(state)) --- table.insert(state.tests[make_key(entry)].output, vim.trim(entry.Output)) --- end - -local mark_success = function(state, entry) - state.tests[make_key(entry)].success = entry.Action == "pass" -end - -local attach_to_buffer = function (output_bufnr, pattern, command) - local state = { - bufnr = output_bufnr, - tests = {}, - } - -- vim.api.nvim_buf_create_user_command(output_bufnr, "GoTestLineDiag", function() - -- local line = vim.fn.line "." - 1 - -- for _, test in pairs(state.tests) do - -- if test.line == line then - -- vim.cmd.new() - -- vim.api.nvim_buf_set_lines(vim.api.nvim_get_current_buf(), 0, -1, false, test.output) - -- end - -- end - -- end, {}) - - vim.api.nvim_create_autocmd("BufWritePost",{ - group = group, - pattern = pattern, - callback = function () - vim.api.nvim_buf_clear_namespace(output_bufnr, ns, 0, -1) - vim.fn.jobstart(command, { - stdout_buffered = true, - on_stdout = function (_, data) - for _, line in pairs(data) do - local decoded = vim.json.decode(line) - if decoded.Action == "run" then - add_golang_test(state, decoded) - elseif decoded.Action == "pass" or decoded.Action == "fail" then - mark_success(state, decoded) - local test = state.tests[make_key(decoded)] - if test.success then - local text = { "✓" } - vim.api.nvim_buf_set_extmark(output_bufnr, ns, test.line, 0, { - virt_text = { text }, - }) - end - -- elseif decoded.Action == "output" then - -- if not decoded.Test then - -- return - -- end - -- add_golang_output(state, decoded) - end - end - end, - on_exit = function () - local failed = {} - for _, test in pairs(state.tests) do - if test.line then - if not test.success then - table.insert(failed , { - bufnr = output_bufnr, - lnum = test.line, - col = 0, - severity = vim.diagnostic.severity.ERROR, - source = "go-test", - message = "Test Failed", - user_data = {}, - }) - end - end - end - vim.diagnostic.set(ns, output_bufnr, failed, {}) - end, - }) - end - } - ) -end -vim.api.nvim_create_user_command("GoTestRun", function () - print("GoTestRun started") - attach_to_buffer(vim.api.nvim_get_current_buf(), "*.go",{"go", "test", "./...", "-v", "-json"}) -end, {}) - -vim.api.nvim_create_autocmd("BufWritePre", { - group = group, - pattern = "*", - desc = "Remove withespace on save", - command = "%s/\\s\\+$//e", -}) - --- vim.api.nvim_create_autocmd({"BufEnter", "FileType"}, { --- group = group, --- pattern = "*", --- desc = "don't autocomment new line", --- command = "setlocal formatoptions-=c fortmatoptions-=r formatoptions-=o", --- }) - diff --git a/dot_config/nvim/lua/devfortunato/executable_remap.lua b/dot_config/nvim/lua/devfortunato/remap.lua old mode 100644 new mode 100755 similarity index 100% rename from dot_config/nvim/lua/devfortunato/executable_remap.lua rename to dot_config/nvim/lua/devfortunato/remap.lua diff --git a/dot_config/nvim/lua/devfortunato/snips/init.lua b/dot_config/nvim/lua/devfortunato/snips/init.lua deleted file mode 100644 index 181109e..0000000 --- a/dot_config/nvim/lua/devfortunato/snips/init.lua +++ /dev/null @@ -1,41 +0,0 @@ -local ls = require "luasnip" - -local snippet = ls.s -local f = ls.function_node -local t = ls.text_node -local i = ls.insert_node - -local shortcut = function(val) - if type(val) == "string" then - return { t { val }, i(0) } - end - - if type(val) == "table" then - for k, v in ipairs(val) do - if type(v) == "string" then - val[k] = t { v } - end - end - end - - return val -end - -local M = {} - -M.same = function(index) - return f(function(args) - return args[1] - end, { index }) -end - -M.make = function(tbl) - local result = {} - for k, v in pairs(tbl) do - table.insert(result, (snippet({ trig = k, desc = v.desc }, shortcut(v)))) - end - - return result -end - -return M diff --git a/dot_config/nvim/lua/plugins/cellular.lua b/dot_config/nvim/lua/plugins/cellular.lua deleted file mode 100644 index e9a2eab..0000000 --- a/dot_config/nvim/lua/plugins/cellular.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - "eandrju/cellular-automaton.nvim" -} diff --git a/dot_config/nvim/lua/plugins/completition.lua b/dot_config/nvim/lua/plugins/completition.lua deleted file mode 100644 index cd2fa81..0000000 --- a/dot_config/nvim/lua/plugins/completition.lua +++ /dev/null @@ -1,21 +0,0 @@ -return { - { "hrsh7th/cmp-buffer" }, - { "hrsh7th/cmp-path" }, - { "hrsh7th/cmp-nvim-lua" }, - { "hrsh7th/cmp-nvim-lsp" }, - { "onsails/lspkind-nvim" }, - { "saadparwaiz1/cmp_luasnip", dependencies = { "L3MON4D3/LuaSnip" } }, - - -- { - -- "zbirenbaum/copilot.lua", - -- config = function() - -- require("copilot").setup() - -- end, - -- }, - -- { - -- "zbirenbaum/copilot-cmp", - -- config = function() - -- require("copilot_cmp").setup() - -- end, - -- }, -} diff --git a/dot_config/nvim/lua/plugins/crates.lua b/dot_config/nvim/lua/plugins/crates.lua deleted file mode 100644 index 8752983..0000000 --- a/dot_config/nvim/lua/plugins/crates.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - 'saecki/crates.nvim', - tag = 'v0.4.0', - dependencies = { 'nvim-lua/plenary.nvim' }, - config = function() - require('crates').setup() - end, -} diff --git a/dot_config/nvim/lua/plugins/icons.lua b/dot_config/nvim/lua/plugins/icons.lua deleted file mode 100644 index b5c7ef2..0000000 --- a/dot_config/nvim/lua/plugins/icons.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - -- "kyazdani42/nvim-web-devicons", - -- - -- -- TODO: Conditionally only do this for linux - -- { - -- "yamatsum/nvim-web-nonicons", - -- config = function() - -- require("nvim-nonicons").setup {} - -- end, - -- }, -} diff --git a/dot_config/nvim/lua/plugins/logo.lua b/dot_config/nvim/lua/plugins/logo.lua deleted file mode 100644 index fffcbc4..0000000 --- a/dot_config/nvim/lua/plugins/logo.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - [[ -██████╗ ███████╗██╗ ██╗███████╗ ██████╗ ██████╗ ████████╗██╗ ██╗███╗ ██╗ █████╗ ████████╗ ██████╗ -██╔══██╗██╔════╝██║ ██║██╔════╝██╔═══██╗██╔══██╗╚══██╔══╝██║ ██║████╗ ██║██╔══██╗╚══██╔══╝██╔═══██╗ -██║ ██║█████╗ ██║ ██║█████╗ ██║ ██║██████╔╝ ██║ ██║ ██║██╔██╗ ██║███████║ ██║ ██║ ██║ -██║ ██║██╔══╝ ╚██╗ ██╔╝██╔══╝ ██║ ██║██╔══██╗ ██║ ██║ ██║██║╚██╗██║██╔══██║ ██║ ██║ ██║ -██████╔╝███████╗ ╚████╔╝ ██║ ╚██████╔╝██║ ██║ ██║ ╚██████╔╝██║ ╚████║██║ ██║ ██║ ╚██████╔╝ -╚═════╝ ╚══════╝ ╚═══╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ -]] -} diff --git a/dot_config/nvim/lua/plugins/lsp.lua b/dot_config/nvim/lua/plugins/lsp.lua deleted file mode 100644 index 167eb22..0000000 --- a/dot_config/nvim/lua/plugins/lsp.lua +++ /dev/null @@ -1,205 +0,0 @@ -return { - { - "VonHeikemen/lsp-zero.nvim", - branch = "v3.x", - lazy = true, - config = false, - init = function() - -- Disable automatic setup, we are doing it manually - vim.g.lsp_zero_extend_cmp = 0 - vim.g.lsp_zero_extend_lspconfig = 0 - end, - }, - { - "williamboman/mason.nvim", - dependencies = { - "WhoIsSethDaniel/mason-tool-installer.nvim", - }, - lazy = false, - config = true, - }, - -- Autocompletion - { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - { "L3MON4D3/LuaSnip" }, - }, - config = function() - -- Here is where you configure the autocompletion settings. - local lsp_zero = require("lsp-zero") - lsp_zero.extend_cmp() - - -- And you can configure cmp even more, if you want to. - local cmp = require("cmp") - local cmp_action = lsp_zero.cmp_action() - local cmp_select = { behaviour = cmp.SelectBehavior.Select } - - cmp.setup({ - preselect = "item", - completion = { - completeopt = "menu,menuone,noselect", - }, - sources = { - { name = "nvim_lsp" }, - { name = "buffer" }, - { name = "nvim_lua" }, - { name = "path" }, - { name = "luasnip" }, - { name = "crates" }, - { name = "vim-dadbod-completion" }, - }, - -- formatting = lsp_zero.cmp_format(), - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - formatting = { - fields = { "abbr", "kind", "menu" }, - format = require("lspkind").cmp_format({ - mode = "symbol_text", -- show only symbol annotations - menu = { - buffer = "[buf]", - nvim_lsp = "[LSP]", - nvim_lua = "[api]", - path = "[path]", - luasnip = "[snip]", - gh_issues = "[issues]", - ["vim-dadbod-completion"] = "[DB]", - }, - maxwidth = 50, -- prevent the popup from showing more than provided characters - ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead - }), - }, - experimental = { - native_menu = false, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.select_prev_item(cmp_select), - [""] = cmp.mapping.select_next_item(cmp_select), - [""] = cmp.mapping.confirm({ select = true }), - ["z"] = cmp.mapping.complete(), - [""] = cmp_action.luasnip_jump_forward(), - [""] = cmp_action.luasnip_jump_backward(), - -- [""] = false, - -- [""] = cmp.config.disable, - [""] = cmp_action.luasnip_supertab(), - [""] = cmp_action.luasnip_shift_supertab(), - }), - }) - end, - }, - - -- LSP - { - "neovim/nvim-lspconfig", - cmd = { "LspInfo", "LspInstall", "LspStart" }, - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - { "hrsh7th/cmp-nvim-lsp" }, - { "williamboman/mason-lspconfig.nvim" }, - { "folke/neodev.nvim" }, - }, - config = function() - -- This is where all the LSP shenanigans will live - require("neodev").setup({}) - local lsp_zero = require("lsp-zero") - lsp_zero.extend_lspconfig() - ---@diagnostic disable-next-line: trailing-space - - ---@diagnostic disable-next-line: unused-local - lsp_zero.on_attach(function(client, bufnr) - local opts = { buffer = bufnr, remap = false } - - lsp_zero.default_keymaps({ buffer = bufnr }) - vim.keymap.set("n", "gd", function() - vim.lsp.buf.definition() - end, opts) - vim.keymap.set("n", "ds", function() - vim.lsp.buf.document_symbol() - end, opts) - vim.keymap.set("n", "K", function() - vim.lsp.buf.hover() - end, opts) - vim.keymap.set("n", "vd", function() - vim.diagnostic.open_float() - end, opts) - vim.keymap.set("n", "dn", function() - vim.diagnostic.goto_next() - end, opts) - vim.keymap.set("n", "dp", function() - vim.diagnostic.goto_prev() - end, opts) - vim.keymap.set({ "v", "n" }, "vca", function() - vim.lsp.buf.code_action() - end, opts) - vim.keymap.set("n", "vrr", function() - vim.lsp.buf.references() - end, opts) - vim.keymap.set("n", "vrn", function() - vim.lsp.buf.rename() - end, opts) - vim.keymap.set("i", "", function() - vim.lsp.buf.signature_help() - end, opts) - end) - - require("mason-lspconfig").setup({ - ensure_installed = { - "gopls", - "pylsp", - "rust_analyzer", - "yamlls", - "terraformls", - "lua_ls", - }, - handlers = { - lsp_zero.default_setup, - gopls = function() - require("lspconfig").gopls.setup({ - settings = { - gopls = { - hints = { - assignVariableTypes = true, - compositeLiteralFields = true, - compositeLiteralTypes = true, - constantValues = true, - functionTypeParameters = true, - parameterNames = true, - rangeVariableTypes = true, - }, - }, - }, - }) - end, - - lua_ls = function() - -- (Optional) Configure lua language server for neovim - require("lspconfig").lua_ls.setup({ - settings = { - Lua = { - completion = { - callSnippet = "Replace", - }, - hint = { - enable = true, - arrayIndex = "Disable", - }, - diagnostic = { - globals = { "vim" }, - }, - workspace = { - library = { vim.env.VIMRUNTIME, vim.fn.stdpath("config") }, - }, - }, - }, - }) - end, - }, - }) - end, - }, -} diff --git a/dot_config/nvim/lua/plugins/nvim-dbee.lua b/dot_config/nvim/lua/plugins/nvim-dbee.lua deleted file mode 100644 index a40adbc..0000000 --- a/dot_config/nvim/lua/plugins/nvim-dbee.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "kndndrj/nvim-dbee", - dependencies = { - "MunifTanjim/nui.nvim", - }, - build = function() - require("dbee").install() - end, - config = function() end, -} diff --git a/dot_config/nvim/lua/plugins/refactor.lua b/dot_config/nvim/lua/plugins/refactor.lua deleted file mode 100644 index 1ff5a81..0000000 --- a/dot_config/nvim/lua/plugins/refactor.lua +++ /dev/null @@ -1,38 +0,0 @@ -return{ - "ThePrimeagen/refactoring.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-treesitter/nvim-treesitter", - }, - config = function() - require("refactoring").setup({ - prompt_func_return_type = { - go = true, - java = false, - - cpp = false, - c = false, - h = false, - hpp = false, - cxx = false, - }, - prompt_func_param_type = { - go = true, - java = false, - - cpp = false, - c = false, - h = false, - hpp = false, - cxx = false, - }, - printf_statements = {}, - print_var_statements = {}, - - - - }) - - - end, - } diff --git a/dot_config/nvim/lua/plugins/sql.lua b/dot_config/nvim/lua/plugins/sql.lua deleted file mode 100644 index dc5d76b..0000000 --- a/dot_config/nvim/lua/plugins/sql.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - "tpope/vim-dadbod", - "kristijanhusak/vim-dadbod-completion", - "kristijanhusak/vim-dadbod-ui", -} diff --git a/dot_config/nvim/lua/plugins/vimfugitive.lua b/dot_config/nvim/lua/plugins/vimfugitive.lua deleted file mode 100644 index 5d720f2..0000000 --- a/dot_config/nvim/lua/plugins/vimfugitive.lua +++ /dev/null @@ -1,3 +0,0 @@ -return{ - "tpope/vim-fugitive" -}