diff options
Diffstat (limited to 'config/nvim/lua/plugins.lua')
| -rw-r--r-- | config/nvim/lua/plugins.lua | 163 |
1 files changed, 107 insertions, 56 deletions
diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 7741484..bfc4440 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -1,5 +1,21 @@ vim.cmd [[ packadd packer.nvim ]] + +local on_attach = function(_, bufnr) + local opts = { noremap = true, silent = true } + local map = function(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end + map("n", "<leader>[", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts) + map("n", "<leader>]", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) + map("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) + map("n", "gk", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) + map("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) + map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts) + map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts) + map("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts) + map("n", "<leader>q", "<cmd>Telescope diagnostics<CR>", opts) + map("n", "<leader>p", "<cmd>Telescope lsp_workspace_symbols<CR>", opts) +end + return require("packer").startup(function() use "wbthomason/packer.nvim" -- plugin manager (can manage itself) use "AndrewRadev/sideways.vim" -- Move arguments sideways @@ -7,6 +23,31 @@ return require("packer").startup(function() use "romainl/vim-cool" -- only highlight search matches when searching use "lukas-reineke/indent-blankline.nvim" + use { + "ellisonleao/glow.nvim", + config = function() require("glow").setup() end + } + + use { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + requires = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + }, + config = function() + require("neo-tree").setup({ + window = { + mappings = { + ["<c-x>"] = "open_split", + ["<c-v>"] = "open_vsplit",} + }, + }) + end, + } + -- use { -- "lewis6991/satellite.nvim", -- config = function () @@ -14,12 +55,12 @@ return require("packer").startup(function() -- end -- } - use { - 'andymass/vim-matchup', - setup = function() - vim.g.matchup_matchparen_offscreen = { method = "popup" } - end - } + -- use { + -- 'andymass/vim-matchup', + -- setup = function() + -- vim.g.matchup_matchparen_offscreen = { method = "popup" } + -- end + -- } -- Put arguments on multiple lines use { @@ -68,26 +109,13 @@ return require("packer").startup(function() -- nvim lsp configuration use { "neovim/nvim-lspconfig", - ft = {"rust", "python", "c", "cpp", "lua", "go", "haskell", "ocaml", "zig", "yaml", "odin"}, +-- "rust", + ft = {"python", "c", "cpp", "lua", "go", "haskell", "ocaml", "zig", "yaml", "odin"}, config = function() vim.diagnostic.config { signs = false, update_in_insert = false, } - local on_attach = function(_, bufnr) - local opts = { noremap = true, silent = true } - local map = function(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - map("n", "<leader>[", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts) - map("n", "<leader>]", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) - map("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) - map("n", "gk", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) - map("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) - map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts) - map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts) - map("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts) - map("n", "<leader>q", "<cmd>Telescope diagnostics<CR>", opts) - map("n", "<leader>p", "<cmd>Telescope lsp_workspace_symbols<CR>", opts) - end local lspconfig = require("lspconfig") local capabilities = require("cmp_nvim_lsp").default_capabilities( vim.lsp.protocol.make_client_capabilities() @@ -126,8 +154,7 @@ return require("packer").startup(function() "BufWritePre", { callback = go_import_callback, pattern = "*.go", group = augroup } ) - -- lspconfig.clangd.setup { on_attach = on_attach } - lspconfig.rust_analyzer.setup { on_attach = on_attach } + -- lspconfig.rust_analyzer.setup { on_attach = on_attach } -- need python-lsp-server and pyls-flake8 lspconfig.pylsp.setup { on_attach = on_attach, @@ -172,7 +199,7 @@ return require("packer").startup(function() lspconfig.hls.setup { on_attach = on_attach } -- opam install ocaml-lsp-server lspconfig.ocamllsp.setup { on_attach = on_attach } - lspconfig.clangd.setup { on_attach = on_attach } + lspconfig.clangd.setup { on_attach = on_attach, cmd = {"clangd", "-header-insertion=never"} } -- pacman -S zls lspconfig.zls.setup{} -- pacman -S yaml-language-server @@ -190,7 +217,9 @@ return require("packer").startup(function() ["http://json.schemastore.org/kustomization"] = "kustomization.{yml,yaml}", ["http://json.schemastore.org/ansible-playbook"] = "*play*.{yml,yaml}", ["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}", - ["https://json.schemastore.org/gitlab-ci"] = "*gitlab-ci*.{yml,yaml}", + -- ["https://json.schemastore.org/gitlab-ci"] = "*gitlab-ci*.{yml,yaml}", + ["https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json"] = "*gitlab-ci*.{yml,yaml}", + ["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "*docker-compose*.{yml,yaml}", ["https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json"] = "*flow*.{yml,yaml}", }, @@ -201,36 +230,21 @@ return require("packer").startup(function() end, } - -- -- rust lsp (needs rust-analyser) - -- use { - -- "simrat39/rust-tools.nvim", - -- requires = {"neovim/nvim-lspconfig"}, - -- ft = {"rust"}, - -- config = function() - -- local on_attach = function(_, bufnr) - -- local opts = { noremap = true, silent = true } - -- local map = function(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - -- map("n", "<leader>[", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts) - -- map("n", "<leader>]", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) - -- map("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) - -- map("n", "gk", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) - -- map("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) - -- map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts) - -- map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts) - -- map("n", "<leader>q", "<cmd>Telescope diagnostics<CR>", opts) - -- map("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts) - -- end - -- require("rust-tools").setup { - -- server = { - -- on_attach = on_attach, - -- } - -- } - -- vim.diagnostic.config { - -- signs = false, - -- update_in_insert = false, - -- } - -- end - -- } + use { + "mrcjkb/rustaceanvim", + ft = {"rust"}, + config = function() + -- to toggle inlay hints + -- vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) + -- vim.g.rustaceanvim.server.on_attach = on_attach + vim.diagnostic.config { + signs = false, + update_in_insert = false, + } + -- require("rustaceanvim") + -- vim.g.rustaceanvim.server.on_attach = on_attach + end, + } use { "hrsh7th/nvim-cmp", @@ -312,6 +326,42 @@ return require("packer").startup(function() end } + use { + "mfussenegger/nvim-dap", + requires = { + "rcarriga/nvim-dap-ui", + "nvim-telescope/telescope-dap.nvim", + "mfussenegger/nvim-dap-python", + }, + config = function() + local dap = require("dap") + require("dap-python").setup() + vim.keymap.set("n", "<F5>", ":lua require'dap'.continue()<CR>") + vim.keymap.set("n", "<F10>", ":lua require'dap'.step_over()<CR>") + vim.keymap.set("n", "<F11>", ":lua require'dap'.step_into()<CR>") + vim.keymap.set("n", "<F12>", ":lua require'dap'.step_out()<CR>") + vim.keymap.set("n", "<leader>b", ":lua require'dap'.toogle_breakpoint()<CR>") + -- vim.keymap.set("n", "<leader>B", ":lua require'dap'.toogle_breakpoint()<CR>") + vim.keymap.set("n", "<leader>dr", ":lua require'dap'.repl_open()<CR>") + + dap.adapters.gdb = { + type = "executable", + command = "gdb", + args = {"-i", "dap"}, + } + dap.configurations.c = { + { + name = "Launch", + type = "gdb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end + }, + } + end + } + -- comment text objects use { "numToStr/Comment.nvim", @@ -399,6 +449,7 @@ return require("packer").startup(function() "c", "commonlisp", "cpp", + "cuda", "fish", "glsl", "go", @@ -492,7 +543,7 @@ return require("packer").startup(function() use { "lewis6991/gitsigns.nvim", - tag = 'release', + -- tag = 'release', config = function() require("gitsigns").setup { signcolumn = false, |
