diff options
Diffstat (limited to '.config/nvim_old/lua/plugins')
| -rw-r--r-- | .config/nvim_old/lua/plugins/completions.lua | 53 | ||||
| -rw-r--r-- | .config/nvim_old/lua/plugins/lsp.lua | 62 | ||||
| -rw-r--r-- | .config/nvim_old/lua/plugins/marks.lua | 9 | ||||
| -rw-r--r-- | .config/nvim_old/lua/plugins/none-ls.lua | 29 | ||||
| -rw-r--r-- | .config/nvim_old/lua/plugins/nvim-dap.lua | 142 | ||||
| -rw-r--r-- | .config/nvim_old/lua/plugins/render-markdown.lua | 25 | ||||
| -rw-r--r-- | .config/nvim_old/lua/plugins/rust_analyzer.lua | 56 | ||||
| -rw-r--r-- | .config/nvim_old/lua/plugins/telescope.lua | 8 | ||||
| -rw-r--r-- | .config/nvim_old/lua/plugins/treesitter.lua | 14 |
9 files changed, 398 insertions, 0 deletions
diff --git a/.config/nvim_old/lua/plugins/completions.lua b/.config/nvim_old/lua/plugins/completions.lua new file mode 100644 index 0000000..483fac7 --- /dev/null +++ b/.config/nvim_old/lua/plugins/completions.lua @@ -0,0 +1,53 @@ +-- Autocompletions +-- https://github.com/hrsh7th/nvim-cmp +-- https://github.com/L3MON4D3/LuaSnip +-- https://github.com/saadparwaiz1/cmp_luasnip +-- https://github.com/rafamadriz/friendly-snippets +-- https://github.com/hrsh7th/cmp-nvim-lsp + +return { + { + "hrsh7th/cmp-nvim-lsp", + }, + { + 'L3MON4D3/LuaSnip', + dependencies = { + 'saadparwaiz1/cmp_luasnip', + 'rafamadriz/friendly-snippets', + } + }, + { + "hrsh7th/nvim-cmp", + config = function() + local cmp = require'cmp' + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({ select = true }), + ['<C-j>'] = cmp.mapping.select_next_item(), + ['<C-k>'] = cmp.mapping.select_prev_item(), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, { + { name = 'buffer' }, + }) + }) + end, + } +} diff --git a/.config/nvim_old/lua/plugins/lsp.lua b/.config/nvim_old/lua/plugins/lsp.lua new file mode 100644 index 0000000..0314c42 --- /dev/null +++ b/.config/nvim_old/lua/plugins/lsp.lua @@ -0,0 +1,62 @@ +-- Language server for specified languages +-- Hover with 'K' +-- Goto definition with :Goto +-- Open code action with :Codeact + +local servers = { + "lua_ls", "bashls", "clangd", "marksman", "pyright", "lemminx", +} + +return { + { + "williamboman/mason.nvim", + config = function() + require("mason").setup() + end + }, + + { + "williamboman/mason-lspconfig.nvim", + config = function() + require("mason-lspconfig").setup { + ensure_installed = servers, + automatic_installation = true, + } + end + }, + + { + "neovim/nvim-lspconfig", + config = function() + -- Advertise autocompletion to lsp + local capabilities = require('cmp_nvim_lsp').default_capabilities() + for _, server in ipairs(servers) do + vim.lsp.config(server, { + capabilities = capabilities, + }) + end + + -- Key mapping + -- Hover for definition + vim.keymap.set('n', 'K', vim.lsp.buf.hover, {}) + + -- Move to definition + vim.api.nvim_create_user_command( + "Goto", + function() + vim.lsp.buf.definition() + end, + {} + ) + + -- Code action + vim.api.nvim_create_user_command( + "Codeact", + function() + vim.lsp.buf.code_action() + end, + {} + ) + end + } +} diff --git a/.config/nvim_old/lua/plugins/marks.lua b/.config/nvim_old/lua/plugins/marks.lua new file mode 100644 index 0000000..1d452ce --- /dev/null +++ b/.config/nvim_old/lua/plugins/marks.lua @@ -0,0 +1,9 @@ +return { + { + -- https://github.com/chentoast/marks.nvim + -- Makes marks visible + "chentoast/marks.nvim", + event = "VeryLazy", + opts = {}, + } +} diff --git a/.config/nvim_old/lua/plugins/none-ls.lua b/.config/nvim_old/lua/plugins/none-ls.lua new file mode 100644 index 0000000..ee6d859 --- /dev/null +++ b/.config/nvim_old/lua/plugins/none-ls.lua @@ -0,0 +1,29 @@ +-- Formatter +-- https://github.com/nvimtools/none-ls.nvim +-- Press '=' to format highlighted code +return { + "nvimtools/none-ls.nvim", + config = function() + local null_ls = require("null-ls") + null_ls.setup({ + sources = { + -- Formatting + null_ls.builtins.formatting.black, + -- + -- Diagnostics + -- null_ls.builtins.diagnostics.<package>, + -- + -- Completion + -- null_ls.builtins.completion.<package>, + } + }) + + vim.api.nvim_create_user_command( + "Format", + function() + vim.lsp.buf.format() + end, + {} + ) + end +} diff --git a/.config/nvim_old/lua/plugins/nvim-dap.lua b/.config/nvim_old/lua/plugins/nvim-dap.lua new file mode 100644 index 0000000..5a6d1ae --- /dev/null +++ b/.config/nvim_old/lua/plugins/nvim-dap.lua @@ -0,0 +1,142 @@ +-- Debugger +-- https://github.com/mfussenegger/nvim-dap +return { + "mfussenegger/nvim-dap", + event = "BufRead", + dependencies = { + "rcarriga/nvim-dap-ui", + "theHamsta/nvim-dap-virtual-text", + "nvim-telescope/telescope-dap.nvim", + "nvim-neotest/nvim-nio" + }, + config = function() + local dap = require("dap") + local dapui = require("dapui") + local virtual_text = require("nvim-dap-virtual-text") + + dap.adapters.lldb = { + type = 'executable', + command = '/usr/bin/lldb-dap', + name = 'lldb' + } + + local lldb = { + name = "Launch lldb", + type = "lldb", + request = "launch", + program = function() + return vim.fn.input( + "Path to executable: ", vim.fn.getcwd() .. "/", "file" + ) + end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + args = {}, + runInTerminal = false, + } + + dap.configurations.rust = {lldb} + dap.configurations.c = {lldb} + + dapui.setup( + { + controls = { + element = "repl", + enabled = true, + icons = { + disconnect = "🔗❌", + pause = "⏸", + play = "▶", + run_last = "⏭", + step_back = "↶", + step_into = "↓", + step_out = "↑", + step_over = "↷", + terminate = "⏹" + } + }, + element_mappings = {}, + expand_lines = true, + floating = { + border = "single", + mappings = { + close = { "q", "<Esc>" } + } + }, + force_buffers = true, + icons = { + collapsed = "", + current_frame = "", + expanded = "" + }, + layouts = { + { + elements = { + { + id = "scopes", + size = 0.25 + }, + { + id = "breakpoints", + size = 0.25 + }, + { + id = "stacks", + size = 0.25 + }, + { + id = "watches", + size = 0.25 + } + }, + position = "left", + size = 40 + }, + { + elements = { + { + id = "repl", + size = 0.5 + }, + { + id = "console", + size = 0.5 + } + }, + position = "bottom", + size = 10 + } + }, + mappings = { + edit = "e", + expand = { "<CR>", "<2-LeftMouse>" }, + open = "o", + remove = "d", + repl = "r", + toggle = "t" + }, + render = { + indent = 1, + max_value_lines = 100 + } + } + ) + + virtual_text.setup() + + vim.api.nvim_create_user_command( + "Debug", + function() + dapui.toggle() + end, + {} + ) + vim.keymap.set('n', "<Leader>b", dap.toggle_breakpoint, {}) + vim.keymap.set('n', "<F2>", dap.continue, {}) + vim.keymap.set('n', "<F3>", dap.step_over, {}) + vim.keymap.set('n', "<F4>", dap.step_back, {}) + vim.keymap.set('n', "<F5>", dap.step_into, {}) + vim.keymap.set('n', "<F6>", dap.step_out, {}) + vim.keymap.set('n', "<Leader>n", dap.restart, {}) + end +} diff --git a/.config/nvim_old/lua/plugins/render-markdown.lua b/.config/nvim_old/lua/plugins/render-markdown.lua new file mode 100644 index 0000000..d0d0639 --- /dev/null +++ b/.config/nvim_old/lua/plugins/render-markdown.lua @@ -0,0 +1,25 @@ +-- https://github.com/MeanderingProgrammer/render-markdown.nvim +return { + { + 'MeanderingProgrammer/render-markdown.nvim', + opts = {}, + dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' } + }, + { + 'ChuufMaster/markdown-toc', --https://github.com/ChuufMaster/markdown-toc + -- ":GenerateTOC" + -- ":DeleteTOC" + opts = { + + -- The heading level to match (i.e the number of "#"s to match to) max 6 + heading_level_to_match = -1, + + -- Set to True display a dropdown to allow you to select the heading level + ask_for_heading_level = false, + + -- TOC default string + -- WARN + toc_format = '%s- [%s](<%s#%s>)', + } + } +} diff --git a/.config/nvim_old/lua/plugins/rust_analyzer.lua b/.config/nvim_old/lua/plugins/rust_analyzer.lua new file mode 100644 index 0000000..914befe --- /dev/null +++ b/.config/nvim_old/lua/plugins/rust_analyzer.lua @@ -0,0 +1,56 @@ +-- https://github.com/mrcjkb/rustaceanvim + +return { + { + 'mrcjkb/rustaceanvim', + version = '^6', -- Recommended + lazy = false, -- This plugin is already lazy + config = function () + vim.g.rustaceanvim = { + -- Plugin configuration + tools = { + }, + -- LSP configuration + server = { + default_settings = { + -- rust-analyzer language server configuration + -- https://rust-analyzer.github.io/book/configuration.html + ['rust-analyzer'] = { + checkOnSave = true, + check = { + enable = true, + command = "clippy", + features = "all", + }, + completion = { + autoimport = { + enable = false; + } + }, + files = { + exclude = { + "build-dir/", + ".flatpak-builder", + } + } + --settings = { + -- cargo = { allFeatures = true }, + -- imports = { group = { enable = false } }, + -- completion = { postfix = { enable = false } }, + -- -- https://www.reddit.com/r/rust/comments/1e978l7/comment/led7ibp/ + -- -- checkOnSave = { command = "clippy" }, + -- checkOnSave = { command = false }, + + -- diagnostics = { enable = true }, + -- rustfmt = { enable = true }, + --} + }, + }, + }, + -- DAP configuration + dap = { + }, + } + end + }, +} diff --git a/.config/nvim_old/lua/plugins/telescope.lua b/.config/nvim_old/lua/plugins/telescope.lua new file mode 100644 index 0000000..e3ab856 --- /dev/null +++ b/.config/nvim_old/lua/plugins/telescope.lua @@ -0,0 +1,8 @@ +return { + -- https://github.com/nvim-telescope/telescope.nvim + 'nvim-telescope/telescope.nvim', + tag = '0.1.8', + dependencies = { + 'nvim-lua/plenary.nvim' + } +} diff --git a/.config/nvim_old/lua/plugins/treesitter.lua b/.config/nvim_old/lua/plugins/treesitter.lua new file mode 100644 index 0000000..f04198f --- /dev/null +++ b/.config/nvim_old/lua/plugins/treesitter.lua @@ -0,0 +1,14 @@ +-- Syntax highlighting +-- https://github.com/nvim-treesitter/nvim-treesitter +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + + config = function() + require("nvim-treesitter.configs").setup({ + auto_install = true, + highlight = { enable = true }, + indent = { enable = true }, + }) + end +} |
