You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.8 KiB

  1. -- Read the docs: https://www.lunarvim.org/docs/configuration
  2. -- Example configs: https://github.com/LunarVim/starter.lvim
  3. -- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
  4. -- Forum: https://www.reddit.com/r/lunarvim/
  5. -- Discord: https://discord.com/invite/Xb9B4Ny
  6. -- install plugins
  7. lvim.plugins = {
  8. "ChristianChiarulli/swenv.nvim",
  9. "stevearc/dressing.nvim",
  10. "mfussenegger/nvim-dap-python",
  11. "nvim-neotest/neotest",
  12. "nvim-neotest/neotest-python",
  13. "epwalsh/obsidian.nvim",
  14. "subnut/nvim-ghost.nvim",
  15. }
  16. -- automatically install python syntax highlighting
  17. lvim.builtin.treesitter.ensure_installed = {
  18. "python",
  19. }
  20. -- setup formatting
  21. local formatters = require "lvim.lsp.null-ls.formatters"
  22. formatters.setup { { name = "black" }, }
  23. lvim.format_on_save.enabled = true
  24. lvim.format_on_save.pattern = { "*.py" }
  25. -- setup linting
  26. local linters = require "lvim.lsp.null-ls.linters"
  27. linters.setup { { command = "flake8", filetypes = { "python" } } }
  28. -- setup debug adapter
  29. lvim.builtin.dap.active = true
  30. local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/")
  31. pcall(function()
  32. require("dap-python").setup(mason_path .. "packages/debugpy/venv/bin/python")
  33. end)
  34. -- setup testing
  35. require("neotest").setup({
  36. adapters = {
  37. require("neotest-python")({
  38. -- Extra arguments for nvim-dap configuration
  39. -- See https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for values
  40. dap = {
  41. justMyCode = false,
  42. console = "integratedTerminal",
  43. },
  44. args = { "--log-level", "DEBUG", "--quiet" },
  45. runner = "pytest",
  46. })
  47. }
  48. })
  49. lvim.builtin.which_key.mappings["dm"] = { "<cmd>lua require('neotest').run.run()<cr>",
  50. "Test Method" }
  51. lvim.builtin.which_key.mappings["dM"] = { "<cmd>lua require('neotest').run.run({strategy = 'dap'})<cr>",
  52. "Test Method DAP" }
  53. lvim.builtin.which_key.mappings["df"] = {
  54. "<cmd>lua require('neotest').run.run({vim.fn.expand('%')})<cr>", "Test Class" }
  55. lvim.builtin.which_key.mappings["dF"] = {
  56. "<cmd>lua require('neotest').run.run({vim.fn.expand('%'), strategy = 'dap'})<cr>", "Test Class DAP" }
  57. lvim.builtin.which_key.mappings["dS"] = { "<cmd>lua require('neotest').summary.toggle()<cr>", "Test Summary" }
  58. -- binding for switching
  59. lvim.builtin.which_key.mappings["C"] = {
  60. name = "Python",
  61. c = { "<cmd>lua require('swenv.api').pick_venv()<cr>", "Choose Env" },
  62. }
  63. vim.api.nvim_create_autocmd("BufEnter", {
  64. pattern = { "term://*"},
  65. command = "startinsert"
  66. })
  67. vim.api.nvim_create_autocmd("WinEnter", {
  68. pattern = { "term://*"},
  69. command = "startinsert"
  70. })
  71. vim.api.nvim_create_autocmd("BufLeave", {
  72. pattern = { "term://*"},
  73. command = "stopinsert"
  74. })
  75. vim.opt.number=true
  76. vim.opt.textwidth=80
  77. vim.opt.wrapmargin=0
  78. vim.opt.wrap=true
  79. vim.opt.colorcolumn="80"
  80. vim.opt.linebreak=true