Skip to content

Instantly share code, notes, and snippets.

@AnurajBhaskar47
Last active July 7, 2024 18:55
Show Gist options
  • Select an option

  • Save AnurajBhaskar47/a95f8e931f244aa2617f0e46bff0aca9 to your computer and use it in GitHub Desktop.

Select an option

Save AnurajBhaskar47/a95f8e931f244aa2617f0e46bff0aca9 to your computer and use it in GitHub Desktop.
lunarvim_config
-- Read the docs: https://www.lunarvim.org/docs/configuration
-- 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
-- Formatting
-- lvim.format_on_save.enabled = true
-- lvim.format_on_save.pattern = { "*.lua", "*.py", "*.cpp", "*.rs" }
-- lvim.transparent_window = true
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
vim.g.nvim_markdown_preview_theme = 'solarized-dark'
-- Vim_settings
vim.opt.relativenumber = true
vim.keymap.set("i", "jj", "<Esc>")
vim.keymap.set("i", "<C-BS>", "<C-w>")
-- Lvim_keybindings
lvim.keys.insert_mode["<S-Tab>"] = "<C-d>"
lvim.keys.normal_mode["Y"] = "Vy"
lvim.keys.normal_mode["<Esc>"] = ":nohl<cr>"
lvim.keys.normal_mode["<C-m>"] = ":MarkdownPreview<cr>"
lvim.keys.normal_mode["<A-n>"] = ":RunCode<cr>:startinsert <cr>" -- Code-Runner
lvim.keys.normal_mode["<C-a>"] = "ggVG"
lvim.builtin.terminal.execs = {
{ nil, "<C-`>", "Horizontal Terminal", "horizontal", 0.3 },
{ nil, "<C-.>", "Vertical Terminal", "vertical", 0.4 },
{ nil, "<M-3>", "Float Terminal", "float", nil },
}
-- Leader-keybindings
lvim.builtin.which_key.mappings["bt"] = { ":Telescope current_buffer_fuzzy_find<cr>", "Current buffer fuzzy find" }
lvim.builtin.which_key.mappings["R"] = { ":RunCode<cr>:startinsert <cr>", "Run code" }
lvim.builtin.which_key.mappings["rF"] = { ":RunFile tab<CR>", "Run Files" }
lvim.builtin.which_key.mappings["rf"] = { ":RunFile<CR>", "Run File" }
lvim.builtin.which_key.mappings["rp"] = { ":RunProject<CR>", "Run Project" }
lvim.builtin.which_key.mappings["rc"] = { ":RunClose<CR>", "Run Close" }
-- lvim.builtin.which_key.mappings["crf"] = { ":CRFiletype<CR>", "CR Filetype" }
-- lvim.builtin.which_key.mappings["crp"] = { ":CRProjects<CR>", "CR Projects" }
-- Plugins
lvim.plugins = {
-- Cmake-tools␍
{
"Civitasv/cmake-tools.nvim"
},
-- CodeRunner␍
{
"CRAG666/code_runner.nvim",
config = true,
dependencies = { "nvim-lua/plenary.nvim" },
},
-- Markdown-preview␍
{
"davidgranstrom/nvim-markdown-preview"
},
-- UltiSnips␍
-- {
-- "sirver/ultisnips",␍
-- },
{
"simrat39/rust-tools.nvim",
ft = "rust",
dependencies = "neovim/nvim-lspconfig",
-- opts = function ()
-- return require "custom.configs.rust-tools"␍
-- end,
},
-- {
-- "mfussenegger/nvim-dap-python",
-- ft = "python",
-- dependencies = {
-- "mfussenegger/nvim-dap",
-- },
-- config = function(_, opts)
-- local path = "C:\Users\Anuraj Bhaskar\AppData\Roaming\nvim-data\mason\packages\debugpy\venv\Scripts\python.exe"
-- require("dap-python").setup(path)
-- end,
-- },
{ "mfussenegger/nvim-dap-python" },
{ "nvim-neotest/nvim-nio" },
{ "nvim-neotest/neotest" },
{ "nvim-neotest/neotest-python" },
}
-- Debug Adapter Protocol
lvim.builtin.dap.active = true
-- Python
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)
require("neotest").setup({
adapters = {
require("neotest-python")({
dap = {
justMyCode = false,
console = "integratedTerminal",
},
args = { "--log-level", "DEBUG", "--quiet" },
runner = "pytest",
})
}
})
-- DAP Keybindings
lvim.builtin.which_key.mappings["dm"] = { "<cmd>lua require('neotest').run.run()<cr>",
"Test Method" }
lvim.builtin.which_key.mappings["dM"] = { "<cmd>lua require('neotest').run.run({strategy = 'dap'})<cr>",
"Test Method DAP" }
lvim.builtin.which_key.mappings["df"] = {
"<cmd>lua require('neotest').run.run({vim.fn.expand('%')})<cr>", "Test Class" }
lvim.builtin.which_key.mappings["dF"] = {
"<cmd>lua require('neotest').run.run({vim.fn.expand('%'), strategy = 'dap'})<cr>", "Test Class DAP" }
lvim.builtin.which_key.mappings["dS"] = { "<cmd>lua require('neotest').summary.toggle()<cr>", "Test Summary" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment