From ae6f1fbd818c8eec651a4356fa70b7e1e7100a67 Mon Sep 17 00:00:00 2001 From: Stephen Leece Date: Sat, 30 Dec 2023 10:44:59 -0800 Subject: [PATCH] add with configuration for python --- README.md | 21 ++++++++++++++++++++- init.lua | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- lazy-lock.json | 4 ++++ 3 files changed, 72 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 78ac6df0..1209d624 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,26 @@ -# kickstart.nvim +# swl_kickstart.nvim + +Instructions unique to my dotfiles: +- create a symlink in $HOME/.config/ +`ln -s /Users//src/swl_kickstart.nvim /Users//.config/` +- launch with `knv` https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b +## nvim-dap, nvim-dap-python + +### set up a virtual env for debugpy requirement as suggested + +mkdir .virtualenvs +cd .virtualenvs +python -m venv debugpy +debugpy/bin/python -m pip install debugpy + + + + + + ### Introduction A starting point for Neovim that is: diff --git a/init.lua b/init.lua index 3f895c51..3a2f8098 100644 --- a/init.lua +++ b/init.lua @@ -254,6 +254,24 @@ require('lazy').setup({ build = ':TSUpdate', }, + { + -- Debug Adapter Protocol client + 'mfussenegger/nvim-dap', + }, + { + -- python specific debugger + 'mfussenegger/nvim-dap-python', + }, + + { + -- DAP UI + 'rcarriga/nvim-dap-ui', + dependencies = { + 'mfussenegger/nvim-dap' + } + }, + + -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. @@ -586,7 +604,11 @@ local servers = { } -- Setup neovim lua configuration -require('neodev').setup() +-- enable type checking for nvim-dap-ui to get type checking, documentation and autocompletion +-- for all API functions +require('neodev').setup({ + library = { plugins = { "nvim-dap-ui" }, types = true }, +}) -- nvim-cmp supports additional completion capabilities, so broadcast that to servers local capabilities = vim.lsp.protocol.make_client_capabilities() @@ -662,5 +684,30 @@ cmp.setup { }, } +-- python debugger +require('dap-python').setup('/Users/stephenleece/.asdf/shims/python') +-- require('dap-python').test_runner = "pytest" + +-- configure dap ui +local dap, dapui = require("dap"), require("dapui") +dapui.setup() +dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() +end +dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() +end +dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() +end +vim.fn.sign_define('DapBreakpoint',{ text ='🟥', texthl ='', linehl ='', numhl =''}) +vim.fn.sign_define('DapStopped',{ text ='▶️', texthl ='', linehl ='', numhl =''}) +vim.keymap.set('n', '', require 'dap'.continue) +vim.keymap.set('n', '', require 'dap'.step_over) +vim.keymap.set('n', '', require 'dap'.step_into) +vim.keymap.set('n', '', require 'dap'.step_out) +vim.keymap.set('n', 'b', require 'dap'.toggle_breakpoint) + + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lazy-lock.json b/lazy-lock.json index 1fdc37ec..e91c6d7d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,6 +2,7 @@ "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "LuaSnip": { "branch": "master", "commit": "cab667e2674881001a86a7478fff7dc7791c63f5" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "fidget.nvim": { "branch": "main", "commit": "a1493d94ecb3464ab3ae4d5855765310566dace4" }, "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, @@ -13,6 +14,9 @@ "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, "neodev.nvim": { "branch": "main", "commit": "f972d7e6cd21b691199565cfe3e6487e774a4e8f" }, "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, + "nvim-dap": { "branch": "master", "commit": "f0dca670fa059eb89dda8869a6310c804241345c" }, + "nvim-dap-python": { "branch": "master", "commit": "091e4ae00a12085f9ed4200a3cd04af7179b8a23" }, + "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, "nvim-lspconfig": { "branch": "master", "commit": "553c4e0e667167640c5398573f6f3a488ff8047a" }, "nvim-treesitter": { "branch": "master", "commit": "649d137371e9214d30b20565e0574824fa3a3670" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "dbcd9388e3b119a87c785e10a00d62876077d23d" },