From 7b02b0293d32fc3d6df08c8c6366778fa8444141 Mon Sep 17 00:00:00 2001 From: Aria Nolan Date: Tue, 1 Aug 2023 22:19:57 -0400 Subject: [PATCH] stuff --- .gitignore | 1 + config.lua | 35 ++++++++++++++++++++++--- lua/user/python.lua | 63 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 lua/user/python.lua diff --git a/.gitignore b/.gitignore index e033bc6..1a79582 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ lazy-lock.json +lv-settings.lua diff --git a/config.lua b/config.lua index 8623e27..15c0aa9 100644 --- a/config.lua +++ b/config.lua @@ -5,15 +5,18 @@ -- Discord: https://discord.com/invite/Xb9B4Ny require("user.c") +require("user.python") -lvim.colorscheme = "catppuccin-frappe" -vim.opt.rnu = false -- relative numbers +lvim.transparent_window = true +lvim.colorscheme = "rose-pine-moon" +vim.opt.rnu = true -- relative numbers vim.opt.cb = "unnamedplus" vim.opt.nf = "alpha,octal,hex,bin,unsigned" vim.opt.si = true vim.opt.backup = false lvim.builtin.nvimtree.active = false -- NOTE: using neo-tree lvim.builtin.indentlines.active = true +vim.o.timeoutlen = 250 vim.opt.ts = 2 vim.opt.sw = 2 @@ -32,14 +35,38 @@ vim.diagnostic.config({ virtual_text = true }) lvim.builtin.treesitter.highlight.enable = true -- auto install treesitter parsers -lvim.builtin.treesitter.ensure_installed = { "cpp", "c" } +lvim.builtin.treesitter.ensure_installed = { "cpp", "c", "python"} -- Additional Plugins table.insert(lvim.plugins, { + "kvrohit/mellow.nvim", + "embark-theme/vim", + "nyngwang/nvimgelion", + "maxmx03/FluoroMachine.nvim", + "sonjiku/yawnc.nvim", + "xero/miasma.nvim", + "lmburns/kimbox", "p00f/clangd_extensions.nvim", "catppuccin/nvim", + "marko-cerovac/material.nvim", + "bluz71/vim-nightfly-colors", + "sainnhe/sonokai", "nyoom-engineering/oxocarbon.nvim", "rose-pine/neovim", + "kyazdani42/blue-moon", + "bkegley/gloombuddy", + "Th3Whit3Wolf/space-nvim", + "yonlu/omni.vim", + "ray-x/aurora", + "ray-x/starry.nvim", + "AlexvZyl/nordic.nvim", + "shaunsingh/moonlight.nvim", + "sainnhe/gruvbox-material", + "neanias/everforest-nvim", + "kdheepak/monochrome.nvim", + "mcchrish/zenbones.nvim", + "FrenzyExists/aquarium-vim", + "rebelot/kanagawa.nvim", { "nvim-neo-tree/neo-tree.nvim", branch = "v2.x", @@ -93,7 +120,7 @@ table.insert(lvim.plugins, { event = "BufRead", config = function() require("numb").setup { - show_numbers = true, -- Enable 'number' for the window while peeking + show_numbers = true, -- Enable 'number' for the window while peeking show_cursorline = true, -- Enable 'cursorline' for the window while peeking } end, diff --git a/lua/user/python.lua b/lua/user/python.lua new file mode 100644 index 0000000..de80130 --- /dev/null +++ b/lua/user/python.lua @@ -0,0 +1,63 @@ +-- install plugins +table.insert(lvim.plugins, { + "ChristianChiarulli/swenv.nvim", + "stevearc/dressing.nvim", + "mfussenegger/nvim-dap-python", + "nvim-neotest/neotest", + "nvim-neotest/neotest-python", +}) + +-- 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" }, +}