From 1b5fdb9724862a81fb38f1c9fc44da890c061d81 Mon Sep 17 00:00:00 2001 From: Andy Teijelo Date: Sun, 16 Oct 2022 14:18:21 -0400 Subject: [PATCH] finished setting up vimspector --- init.lua | 11 +++++--- lua/user/colorscheme.lua | 6 +++++ lua/user/dap.lua | 15 ++++++++++- lua/user/keymaps.lua | 38 ++++++++++++++++++++------- lua/user/lsp/handlers.lua | 2 +- lua/user/lsp/settings/pyright.lua | 2 +- lua/user/lsp/settings/sumneko_lua.lua | 4 +-- lua/user/plugins.lua | 16 ++++++++--- lua/user/treesitter.lua | 18 ++++++++++--- 9 files changed, 86 insertions(+), 26 deletions(-) diff --git a/init.lua b/init.lua index 72082bb..281b26f 100644 --- a/init.lua +++ b/init.lua @@ -1,9 +1,11 @@ +-- keep these above require "user.options" require "user.keymaps" require "user.plugins" + +--require "user.alpha" require "user.autocommands" require "user.colorscheme" -require "user.exrc" require "user.cmp" require "user.telescope" require "user.gitsigns" @@ -18,6 +20,9 @@ require "user.project" require "user.impatient" require "user.illuminate" require "user.indentline" -require "user.alpha" require "user.lsp" -require "user.dap" +--require "user.dap" + +require "user.exrc" +--require "user.rust-tools" +require "user.vimspector" diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua index 9eacc2c..a460258 100644 --- a/lua/user/colorscheme.lua +++ b/lua/user/colorscheme.lua @@ -1,10 +1,16 @@ --require("catppuccin").setup() --vim.cmd [[colorscheme catppuccin]] +--TokyonNight --local colorscheme = "tokyonight-night" + +--Catppuccin vim.g.catppuccin_flavour = "mocha" -- latte, frappe, macchiato, mocha local colorscheme = "catppuccin" +--DarkPlus +--local colorscheme = "darkplus" + local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) if not status_ok then return diff --git a/lua/user/dap.lua b/lua/user/dap.lua index 2ee829e..ff17663 100644 --- a/lua/user/dap.lua +++ b/lua/user/dap.lua @@ -35,7 +35,7 @@ dapui.setup { }, } -vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" }) +vim.fn.sign_define("DapBreakpoint", { text = "●", texthl = "DiagnosticSignError", linehl = "", numhl = "" }) dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() @@ -48,3 +48,16 @@ end dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end + +local codelldb_path = "/usr/lib/codelldb/adapter/codelldb" +local liblldb_path = "/usr/lib/codelldb/adapter/libcodelldb.so" + +dap.adapters.codelldb = { + type = 'server', + host = '127.0.0.1', + port = "13000", + executable = { + command = codelldb_path, + args = {"--liblldb", liblldb_path, "--port", "13000"}, + } +} diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index ba8e8d8..e1da94c 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -45,6 +45,7 @@ keymap("n", "h", "nohlsearch", opts) -- Close buffers keymap("n", "", "Bdelete", opts) +keymap("n", "", "Bdelete!", opts) -- Better paste keymap("v", "p", '"_dP', opts) @@ -76,13 +77,30 @@ keymap("n", "fb", ":Telescope buffers", opts) keymap("n", "/", "lua require('Comment.api').toggle_current_linewise()", opts) keymap("x", "/", 'lua require("Comment.api").toggle_linewise_op(vim.fn.visualmode())') --- DAP -keymap("n", "db", "lua require'dap'.toggle_breakpoint()", opts) -keymap("n", "dc", "lua require'dap'.continue()", opts) -keymap("n", "di", "lua require'dap'.step_into()", opts) -keymap("n", "do", "lua require'dap'.step_over()", opts) -keymap("n", "dO", "lua require'dap'.step_out()", opts) -keymap("n", "dr", "lua require'dap'.repl.toggle()", opts) -keymap("n", "dl", "lua require'dap'.run_last()", opts) -keymap("n", "du", "lua require'dapui'.toggle()", opts) -keymap("n", "dt", "lua require'dap'.terminate()", opts) +---- DAP +--keymap("n", "", "lua require'dap'.toggle_breakpoint()", opts) +--keymap("n", "", "lua require'dap'.continue()", opts) +--keymap("n", "", "lua require'dap'.step_over()", opts) +--keymap("n", "", "lua require'dap'.step_into()", opts) +--keymap("n", "", "lua require'dap'.step_out()", opts) +--keymap("n", "dr", "lua require'dap'.repl.toggle()", opts) +--keymap("n", "dl", "lua require'dap'.run_last()", opts) +--keymap("n", "du", "lua require'dapui'.toggle()", opts) +--keymap("n", "", "lua require'dap'.terminate()", opts) + +-- Vimspector +keymap("n", "", "VimspectorToggleBreakpoint", opts) +keymap("n", "", "VimspectorContinue", opts) +keymap("n", "", "VimspectorStepOver", opts) +keymap("n", "", "VimspectorStepInto", opts) +keymap("n", "", "VimspectorStepOut", opts) +keymap("n", "", "VimspectorReset", opts) -- Shift+F5 +keymap("n", "", "VimspectorRestart", opts) -- Ctrl+Shift+F5 +keymap("n", "di", "VimspectorBalloonEval", opts) +--keymap("n", "dl", "lua require'dap'.run_last()", opts) +--keymap("n", "du", "lua require'dapui'.toggle()", opts) +--keymap("n", "", "lua require'dap'.terminate()", opts) + + +keymap("n", "bf", vim.lsp.buf.format, opts) -- Shift+F5 +keymap("v", "bf", vim.lsp.buf.format, opts) -- Shift+F5 diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua index 09dbe90..7605d34 100644 --- a/lua/user/lsp/handlers.lua +++ b/lua/user/lsp/handlers.lua @@ -23,7 +23,7 @@ M.setup = function() end local config = { - virtual_text = false, -- disable virtual text + virtual_text = true, -- disable virtual text signs = { active = signs, -- show signs }, diff --git a/lua/user/lsp/settings/pyright.lua b/lua/user/lsp/settings/pyright.lua index c2a518d..422cf91 100644 --- a/lua/user/lsp/settings/pyright.lua +++ b/lua/user/lsp/settings/pyright.lua @@ -2,7 +2,7 @@ return { settings = { python = { analysis = { - typeCheckingMode = "off", + typeCheckingMode = "on", }, }, }, diff --git a/lua/user/lsp/settings/sumneko_lua.lua b/lua/user/lsp/settings/sumneko_lua.lua index 1154de2..f2df12c 100644 --- a/lua/user/lsp/settings/sumneko_lua.lua +++ b/lua/user/lsp/settings/sumneko_lua.lua @@ -6,8 +6,8 @@ return { }, workspace = { library = { - [vim.fn.expand "$VIMRUNTIME/lua"] = true, - [vim.fn.stdpath "config" .. "/lua"] = true, + [vim.fn.expand "$VIMRUNTIME/lua"] = false, + [vim.fn.stdpath "config" .. "/lua"] = false, }, }, telemetry = { diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 290d01f..7d394f6 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -93,16 +93,24 @@ return packer.startup(function(use) "nvim-treesitter/nvim-treesitter", commit = "8e763332b7bf7b3a426fd8707b7f5aa85823a5ac", } + use { + "nvim-treesitter/nvim-treesitter-context", + commit = "2f9f75d33158c0289c70cc1e0975af9d36ec16b2", + } -- Git use { "lewis6991/gitsigns.nvim", commit = "f98c85e7c3d65a51f45863a34feb4849c82f240f" } - -- DAP - use { "mfussenegger/nvim-dap", commit = "014ebd53612cfd42ac8c131e6cec7c194572f21d" } - use { "rcarriga/nvim-dap-ui", commit = "d76d6594374fb54abf2d94d6a320f3fd6e9bb2f7" } - use { "ravenxrz/DAPInstall.nvim", commit = "8798b4c36d33723e7bba6ed6e2c202f84bb300de" } + ---- DAP + --use { "mfussenegger/nvim-dap", commit = "014ebd53612cfd42ac8c131e6cec7c194572f21d" } + --use { "rcarriga/nvim-dap-ui", commit = "d76d6594374fb54abf2d94d6a320f3fd6e9bb2f7" } + --use { "ravenxrz/DAPInstall.nvim", commit = "8798b4c36d33723e7bba6ed6e2c202f84bb300de" } use { "MunifTanjim/exrc.nvim" } + use { "simrat39/rust-tools.nvim" } + + -- VimSpector + use { "puremourning/vimspector" } -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins diff --git a/lua/user/treesitter.lua b/lua/user/treesitter.lua index e9e31df..c857ca1 100644 --- a/lua/user/treesitter.lua +++ b/lua/user/treesitter.lua @@ -1,9 +1,10 @@ -local status_ok, treesitter = pcall(require, "nvim-treesitter") +local status_ok, _ = pcall(require, "nvim-treesitter") if not status_ok then return end -local status_ok, configs = pcall(require, "nvim-treesitter.configs") +local configs +status_ok, configs = pcall(require, "nvim-treesitter.configs") if not status_ok then return end @@ -13,8 +14,8 @@ configs.setup({ -- ensure_installed = "all", -- one of "all" or a list of languages ignore_install = { "" }, -- List of parsers to ignore installing sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) - - highlight = { + + highlight = { enable = true, -- false will disable the whole extension disable = { "css" }, -- list of language that will be disabled }, @@ -29,3 +30,12 @@ configs.setup({ }, }) + +local context +status_ok, context = pcall(require, "nvim-treesitter.context") +if not status_ok then + return +end + +context.setup({}) +