Last active
November 25, 2022 20:21
-
-
Save jansen44/150c0f539fe0c1944c4d4507a5057443 to your computer and use it in GitHub Desktop.
LunarVim Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- General LunarVim configs | |
| lvim.log.level = "warn" | |
| lvim.format_on_save = true | |
| lvim.colorscheme = "nightfly" | |
| -- lvim.transparent_window = true | |
| -- VIM Options | |
| vim.opt.shiftwidth = 2 | |
| vim.opt.tabstop = 2 | |
| vim.opt.relativenumber = true | |
| vim.opt.colorcolumn = "120" | |
| -- Key Maps | |
| lvim.leader = "space" | |
| lvim.keys.normal_mode["<C-s>"] = ":w<cr>" | |
| -- Builtin Plugins Config | |
| lvim.builtin.alpha.active = true | |
| lvim.builtin.alpha.mode = "dashboard" | |
| lvim.builtin.terminal.active = true | |
| lvim.builtin.nvimtree.setup.view.side = "left" | |
| lvim.builtin.nvimtree.setup.renderer.icons.show.git = false | |
| lvim.builtin.treesitter.ensure_installed = { | |
| "bash", | |
| "c", | |
| "javascript", | |
| "json", | |
| "lua", | |
| "python", | |
| "typescript", | |
| "tsx", | |
| "css", | |
| "rust", | |
| "java", | |
| "yaml", | |
| } | |
| lvim.builtin.treesitter.highlight.enable = true | |
| lvim.builtin.dap.ui.config.layouts = { | |
| { | |
| elements = { | |
| { id = "scopes", size = 0.33 }, | |
| { id = "breakpoints", size = 0.17 }, | |
| { id = "stacks", size = 0.25 }, | |
| { id = "watches", size = 0.25 }, | |
| }, | |
| size = 0.33, | |
| position = "right", | |
| }, | |
| { | |
| elements = { | |
| { id = "repl", size = 1 }, | |
| }, | |
| size = 0.27, | |
| position = "bottom", | |
| }, | |
| } | |
| -- Plugins | |
| lvim.plugins = { | |
| { 'bluz71/vim-nightfly-colors' }, | |
| { "leoluz/nvim-dap-go" }, | |
| { "mxsdev/nvim-dap-vscode-js" }, | |
| { | |
| "microsoft/vscode-js-debug", | |
| opt = true, | |
| run = "npm install --legacy-peer-deps && npm run compile" | |
| } | |
| } | |
| -- Plugin Settings | |
| local dap = require('dap') | |
| dap.defaults.fallback.external_terminal = { | |
| command = '/usr/bin/alacritty', | |
| args = {'-e'} | |
| } | |
| -- DAP Adapters | |
| dap.adapters.lldb = { | |
| type = 'executable', | |
| command = '/usr/bin/lldb-vscode', | |
| name = 'lldb' | |
| } | |
| dap.adapters.delve = { | |
| type = 'server', | |
| port = '${port}', | |
| executable = { | |
| command = 'dlv', | |
| args = {'dap', '-l', '127.0.0.1:${port}'}, | |
| } | |
| } | |
| require("dap-vscode-js").setup({ | |
| -- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node" | |
| debugger_path = "/Users/jansenjunior/.local/share/lunarvim/site/pack/packer/opt/vscode-js-debug", -- Path to vscode-js-debug installation. | |
| -- debugger_cmd = { "js-debug-adapter" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`. | |
| adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, -- which adapters to register in nvim-dap | |
| -- log_file_path = "(stdpath cache)/dap_vscode_js.log" -- Path for file logging | |
| -- log_file_level = false -- Logging level for output to file. Set to false to disable file logging. | |
| -- log_console_level = vim.log.levels.ERROR -- Logging level for output to console. Set to false to disable console output. | |
| }) | |
| -- DAP Configs | |
| dap.configurations.rust = { | |
| { | |
| name = 'Compile&Debug', | |
| type = 'lldb', | |
| request = 'launch', | |
| stopOnEntry = false, | |
| runInTerminal = false, | |
| program = function() | |
| local f = assert(io.popen("cargo build --message-format=json -q", 'r')) | |
| local output = f:read('*l') | |
| local rc = f:close() | |
| if not rc then | |
| vim.notify("An error occurred while compiling. Please fix all compilation issues and try again.", vim.log.levels.ERROR) | |
| return | |
| end | |
| local json = vim.fn.json_decode(output) | |
| if | |
| type(json) == "table" | |
| and json.executable ~= vim.NIL | |
| and json.executable ~= nil | |
| then | |
| return json.executable | |
| end | |
| end | |
| }, | |
| } | |
| dap.configurations.go = { | |
| { | |
| type = "delve", | |
| name = "Debug", | |
| request = "launch", | |
| program = "${file}", | |
| }, | |
| } | |
| for _, language in ipairs({ "typescript", "javascript" }) do | |
| dap.configurations[language] = { | |
| { | |
| type = "pwa-node", | |
| request = "launch", | |
| name = "Launch file", | |
| program = "${file}", | |
| cwd = "${workspaceFolder}", | |
| }, | |
| { | |
| type = "pwa-node", | |
| request = "attach", | |
| name = "Attach", | |
| processId = require'dap.utils'.pick_process, | |
| cwd = "${workspaceFolder}", | |
| } | |
| } | |
| end | |
| -- Linters | |
| local formatters = require "lvim.lsp.null-ls.formatters" | |
| formatters.setup { | |
| { | |
| command = "prettier", | |
| filetypes = { "typescript", "typescriptreact", "javascript" }, | |
| }, | |
| } | |
| local linters = require "lvim.lsp.null-ls.linters" | |
| linters.setup { | |
| { | |
| command = "eslint", | |
| filetypes = { "javascript", "typescript" }, | |
| }, | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment