commit 2fb63f9104c8c03af959061865f0e5b474215998 Author: Michael Heidelberger Date: Tue Mar 12 09:56:18 2024 -0500 lvim config 03122024 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..31bc3dd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +lvim/ +config.lua.bak +lazy* diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..8116ab9 --- /dev/null +++ b/config.lua @@ -0,0 +1,89 @@ +-- Read the docs: https://www.lunarvim.org/docs/configuration +-- Example configs: https://github.com/LunarVim/starter.lvim +-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6 +-- Forum: https://www.reddit.com/r/lunarvim/ +-- Discord: https://discord.com/invite/Xb9B4Ny +-- install plugins +lvim.plugins = { + "ChristianChiarulli/swenv.nvim", + "stevearc/dressing.nvim", + "mfussenegger/nvim-dap-python", + "nvim-neotest/neotest", + "nvim-neotest/neotest-python", + "epwalsh/obsidian.nvim", + "subnut/nvim-ghost.nvim", + +} +-- automatically install python syntax highlighting +lvim.builtin.treesitter.ensure_installed = { + "python", +} + +-- setup formatting +local formatters = require "lvim.lsp.null-ls.formatters" +formatters.setup { { name = "black" }, } +lvim.format_on_save.enabled = true +lvim.format_on_save.pattern = { "*.py" } + +-- setup linting +local linters = require "lvim.lsp.null-ls.linters" +linters.setup { { command = "flake8", filetypes = { "python" } } } + +-- setup debug adapter +lvim.builtin.dap.active = true +local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/") +pcall(function() + require("dap-python").setup(mason_path .. "packages/debugpy/venv/bin/python") +end) + +-- setup testing +require("neotest").setup({ + adapters = { + require("neotest-python")({ + -- Extra arguments for nvim-dap configuration + -- See https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for values + dap = { + justMyCode = false, + console = "integratedTerminal", + }, + args = { "--log-level", "DEBUG", "--quiet" }, + runner = "pytest", + }) + } +}) + +lvim.builtin.which_key.mappings["dm"] = { "lua require('neotest').run.run()", + "Test Method" } +lvim.builtin.which_key.mappings["dM"] = { "lua require('neotest').run.run({strategy = 'dap'})", + "Test Method DAP" } +lvim.builtin.which_key.mappings["df"] = { + "lua require('neotest').run.run({vim.fn.expand('%')})", "Test Class" } +lvim.builtin.which_key.mappings["dF"] = { + "lua require('neotest').run.run({vim.fn.expand('%'), strategy = 'dap'})", "Test Class DAP" } +lvim.builtin.which_key.mappings["dS"] = { "lua require('neotest').summary.toggle()", "Test Summary" } + + +-- binding for switching +lvim.builtin.which_key.mappings["C"] = { + name = "Python", + c = { "lua require('swenv.api').pick_venv()", "Choose Env" }, +} +vim.api.nvim_create_autocmd("BufEnter", { + pattern = { "term://*"}, + command = "startinsert" +}) +vim.api.nvim_create_autocmd("WinEnter", { + pattern = { "term://*"}, + command = "startinsert" +}) +vim.api.nvim_create_autocmd("BufLeave", { + pattern = { "term://*"}, + command = "stopinsert" +}) + +vim.opt.number=true +vim.opt.textwidth=80 +vim.opt.wrapmargin=0 +vim.opt.wrap=true +vim.opt.colorcolumn="80" +vim.opt.linebreak=true