Skip to content

Instantly share code, notes, and snippets.

@WillSams
Last active October 24, 2023 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WillSams/20c63ba7e57cd1c713b36a781fb34371 to your computer and use it in GitHub Desktop.
Save WillSams/20c63ba7e57cd1c713b36a781fb34371 to your computer and use it in GitHub Desktop.
My LunarVim Config
-- GODOT CONFIGURATION --------------------------------------------
local dap = require('dap')
dap.adapters.godot = {
type = "server",
host = '127.0.0.1',
port = 6008,
}
dap.configurations.gdscript = {
{
type = "godot",
request = "launch",
name = "Launch scene",
project = "${workspaceFolder}",
launch_scene = true,
}
}
require 'lspconfig'.gdscript.setup {
force_setup = true,
single_file_support = false,
root_dir = require('lspconfig.util').root_pattern('project.godot', '.git'),
filetypes = { "gd", "gdscript", "gdscript3" },
}
-- BUILTIN CONFIGURATION -----------------------------------------
lvim.builtin.telescope.defaults.layout_strategy = "horizontal"
lvim.builtin.telescope.defaults.layout_config.prompt_position = "bottom"
lvim.builtin.telescope.pickers = {
find_files = {
layout_config = {
width = 0.80,
},
},
live_grep = {
layout_config = {
width = 0.80,
},
},
}
-- install plugins
lvim.plugins = {
"ChristianChiarulli/swenv.nvim",
"stevearc/dressing.nvim",
"mfussenegger/nvim-dap-python",
"nvim-neotest/neotest",
"nvim-neotest/neotest-python",
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
},
{
"zbirenbaum/copilot-cmp",
after = { "copilot.lua" },
config = function()
require("copilot_cmp").setup()
end,
},
}
-- automatically install syntax highlighting
lvim.builtin.treesitter.ensure_installed = {
"java", "python", "gdscript", "javascript", "markdown"
}
-- setup formatting
local formatters = require "lvim.lsp.null-ls.formatters"
formatters.setup {
{ name = "black" },
{
command = "clang-format",
filetypes = { "java" },
extra_args = { "--style", "Google" },
}
}
lvim.format_on_save.enabled = true
lvim.format_on_save.pattern = { "*.py", "*.gd", "*.js", "*.java" }
-- 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"] = { "<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" }
-- binding for switching
lvim.builtin.which_key.mappings["C"] = {
name = "Python",
c = { "<cmd>lua require('swenv.api').pick_venv()<cr>", "Choose Env" },
}
-- Google Co-Pilot
-- Start LunarVim, let plugin install, then :Copilot auth
local ok, copilot = pcall(require, "copilot")
if not ok then
return
end
copilot.setup {
suggestion = {
keymap = {
accept = "<c-l>",
next = "<c-j>",
prev = "<c-k>",
dismiss = "<c-h>",
},
},
}
local opts = { noremap = true, silent = true }
vim.api.nvim_set_keymap("n", "<c-s>", "<cmd>lua require('copilot.suggestion').toggle_auto_trigger()<CR>", opts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment