From a01bb5c0ed3c1a05a00bab07558b20097293dda4 Mon Sep 17 00:00:00 2001 From: gyoder <70408179+gyoder@users.noreply.github.com> Date: Sun, 28 Dec 2025 15:38:19 -0700 Subject: [PATCH] shrug, i forgor --- fish/.config/fish/config.fish | 1 + ghostty/.config/ghostty/config | 3 +- vim/.config/nvim/init.lua | 70 +++++++++++-- vim/.config/nvim/lsp/basedpyright.lua | 66 ++++++++++++ vim/.config/nvim/lsp/clangd.lua | 7 +- vim/.config/nvim/lsp/csharp-ls.lua | 9 ++ vim/.config/nvim/lsp/cspell-ls.lua | 8 +- vim/.config/nvim/lsp/gdscript.lua | 9 ++ vim/.config/nvim/lsp/pyright.lua | 65 ++++++++++++ vim/.config/nvim/lsp/rust-analyzer.lua | 15 +++ vim/.config/nvim/lsp/rust_analyzer.lua | 9 -- vim/.config/nvim/lsp/tinymist.lua | 77 ++++++++++++++ vim/.config/nvim/lsp/zigscient.lua | 12 +++ vim/.config/nvim/lsp/zls.lua | 16 +-- vim/.config/nvim/lua/diagnostics.lua | 7 +- vim/.config/nvim/lua/godot.lua | 60 +++++++++++ vim/.config/nvim/lua/native-lsp.lua | 36 ++++++- vim/.config/nvim/lua/plugins/init.lua | 135 ++++++++++++++++++------- vim/.config/nvim/lua/standard-lint.lua | 1 - 19 files changed, 538 insertions(+), 68 deletions(-) create mode 100644 vim/.config/nvim/lsp/basedpyright.lua create mode 100644 vim/.config/nvim/lsp/csharp-ls.lua create mode 100644 vim/.config/nvim/lsp/gdscript.lua create mode 100644 vim/.config/nvim/lsp/pyright.lua create mode 100644 vim/.config/nvim/lsp/rust-analyzer.lua delete mode 100644 vim/.config/nvim/lsp/rust_analyzer.lua create mode 100644 vim/.config/nvim/lsp/tinymist.lua create mode 100644 vim/.config/nvim/lsp/zigscient.lua create mode 100644 vim/.config/nvim/lua/godot.lua diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish index 7af31bb..bc22228 100644 --- a/fish/.config/fish/config.fish +++ b/fish/.config/fish/config.fish @@ -14,6 +14,7 @@ if string match -q "*turing*" "$host" /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/emulators \ /opt/homebrew/bin/iodine \ /opt/homebrew/bin \ + /opt/homebrew/opt/zig@0.14/bin \ /Users/scie/.platformio/penv/bin/ \ /Users/scie/.cargo/bin \ /Users/scie/.local/xonsh-env/xbin \ diff --git a/ghostty/.config/ghostty/config b/ghostty/.config/ghostty/config index 780f5e2..5016bc7 100644 --- a/ghostty/.config/ghostty/config +++ b/ghostty/.config/ghostty/config @@ -3,8 +3,9 @@ clipboard-read = allow clipboard-write = allow copy-on-select = true -theme = rose-pine +theme = Rose Pine font-family = "ComicCode Nerd Font" +font-style-italic = "ComicCode Nerd Font Light" macos-option-as-alt = left macos-icon = microchip font-feature = -calt diff --git a/vim/.config/nvim/init.lua b/vim/.config/nvim/init.lua index 3d2f297..7b1ba87 100644 --- a/vim/.config/nvim/init.lua +++ b/vim/.config/nvim/init.lua @@ -56,9 +56,48 @@ vim.api.nvim_create_autocmd("FileType", { pattern = "markdown", callback = function() vim.opt_local.textwidth = 80 + vim.opt_local.formatoptions = "atcqjnl" + vim.opt_local.wrap = true + vim.opt_local.linebreak = true + + -- Show column guide + vim.opt_local.colorcolumn = "80" end, }) +-- Typst configuration +vim.api.nvim_create_autocmd("FileType", { + pattern = "typst", + callback = function() + -- Line wrapping settings + vim.opt_local.textwidth = 80 + vim.opt_local.formatoptions = "atcqjnl" + vim.opt_local.wrap = true + vim.opt_local.linebreak = true + + -- Show column guide + vim.opt_local.colorcolumn = "80" + end, +}) +-- Setup formatting on LSP attach +-- vim.api.nvim_create_autocmd("LspAttach", { +-- callback = function(args) +-- local client = vim.lsp.get_client_by_id(args.data.client_id) +-- +-- if client and client.supports_method("textDocument/formatting") then +-- vim.api.nvim_create_autocmd({ "TextChanged", "TextChangedI" }, { +-- buffer = args.buf, +-- callback = function() +-- vim.lsp.buf.format({ +-- async = true, +-- bufnr = args.buf, +-- }) +-- end, +-- }) +-- end +-- end, +-- }) + vim.api.nvim_create_autocmd("TermOpen", { pattern = "*", callback = function() @@ -69,22 +108,22 @@ vim.api.nvim_create_autocmd("TermOpen", { vim.o.clipboard = "unnamedplus" vim.g.clipboard = { - name = "OSC 52", - copy = { - ["+"] = require("vim.ui.clipboard.osc52").copy("+"), - ["*"] = require("vim.ui.clipboard.osc52").copy("*"), - }, - paste = { - ["+"] = require("vim.ui.clipboard.osc52").paste("+"), - ["*"] = require("vim.ui.clipboard.osc52").paste("*"), - }, + name = "OSC 52", + copy = { + ["+"] = require("vim.ui.clipboard.osc52").copy("+"), + ["*"] = require("vim.ui.clipboard.osc52").copy("*"), + }, + paste = { + ["+"] = require("vim.ui.clipboard.osc52").paste("+"), + ["*"] = require("vim.ui.clipboard.osc52").paste("*"), + }, } -- stupid hacky workaround to make it so i can paste from tmux with OSC52 -- https://github.com/neovim/neovim/discussions/29350#discussioncomment-10299517 -- tracking issue about tmux behavior: https://github.com/tmux/tmux/issues/4275 if vim.env.TMUX ~= nil then - local copy = {'tmux', 'load-buffer', '-w', '-'} - local paste = {'bash', '-c', 'tmux refresh-client -l && sleep 0.05 && tmux save-buffer -'} + local copy = { 'tmux', 'load-buffer', '-w', '-' } + local paste = { 'bash', '-c', 'tmux refresh-client -l && sleep 0.05 && tmux save-buffer -' } vim.g.clipboard = { name = 'tmux', copy = { @@ -99,5 +138,14 @@ if vim.env.TMUX ~= nil then } end + + +-- https://simondalvai.org/blog/godot-neovim/ +require("godot") + + + + + -- Enable experimental UI in neovim-nightly require('vim._extui').enable({}) diff --git a/vim/.config/nvim/lsp/basedpyright.lua b/vim/.config/nvim/lsp/basedpyright.lua new file mode 100644 index 0000000..5f54c3d --- /dev/null +++ b/vim/.config/nvim/lsp/basedpyright.lua @@ -0,0 +1,66 @@ +---@brief +--- +--- https://detachhead.github.io/basedpyright +--- +--- `basedpyright`, a static type checker and language server for python + +local function set_python_path(command) + local path = command.args + local clients = vim.lsp.get_clients { + bufnr = vim.api.nvim_get_current_buf(), + name = 'basedpyright', + } + for _, client in ipairs(clients) do + if client.settings then + client.settings.python = vim.tbl_deep_extend('force', client.settings.python or {}, { pythonPath = path }) + else + client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { python = { pythonPath = path } }) + end + client:notify('workspace/didChangeConfiguration', { settings = nil }) + end +end + +---@type vim.lsp.Config +return { + cmd = { 'basedpyright-langserver', '--stdio' }, + filetypes = { 'python' }, + root_markers = { + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + 'pyrightconfig.json', + '.git', + }, + settings = { + basedpyright = { + analysis = { + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = 'openFilesOnly', + }, + }, + }, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function() + local params = { + command = 'basedpyright.organizeimports', + arguments = { vim.uri_from_bufnr(bufnr) }, + } + + -- Using client.request() directly because "basedpyright.organizeimports" is private + -- (not advertised via capabilities), which client:exec_cmd() refuses to call. + -- https://github.com/neovim/neovim/blob/c333d64663d3b6e0dd9aa440e433d346af4a3d81/runtime/lua/vim/lsp/client.lua#L1024-L1030 + client.request('workspace/executeCommand', params, nil, bufnr) + end, { + desc = 'Organize Imports', + }) + + vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightSetPythonPath', set_python_path, { + desc = 'Reconfigure basedpyright with the provided python path', + nargs = 1, + complete = 'file', + }) + end, +} diff --git a/vim/.config/nvim/lsp/clangd.lua b/vim/.config/nvim/lsp/clangd.lua index ddbab4f..2fd489a 100644 --- a/vim/.config/nvim/lsp/clangd.lua +++ b/vim/.config/nvim/lsp/clangd.lua @@ -4,7 +4,11 @@ return { -- '--clang-tidy', '--background-index', '--offset-encoding=utf-8', - '--query-driver=/Users/scie/.platformio/packages/toolchain-xtensa-esp32/**' + '--query-driver=/Users/scie/.platformio/packages/toolchain-xtensa-esp32/**', + '--query-driver=/Users/scie/.platformio/packages/framework-arduinoststm32/**', + -- '--query-driver=/Users/scie/.platformio/packages/**', + -- '--query-driver=/opt/homebrew/Cellar/avr-gcc@9/9.4.0_1/bin/avr-gcc', + -- '--query-driver=/opt/homebrew/Cellar/avr-gcc@9/9.4.0_1/bin/avr-g++' }, filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda', 'proto', 'arduino' }, root_markers = { @@ -25,4 +29,3 @@ return { offsetEncoding = { 'utf-8', 'utf-16' }, }, } - diff --git a/vim/.config/nvim/lsp/csharp-ls.lua b/vim/.config/nvim/lsp/csharp-ls.lua new file mode 100644 index 0000000..037650b --- /dev/null +++ b/vim/.config/nvim/lsp/csharp-ls.lua @@ -0,0 +1,9 @@ +---@type vim.lsp.Config +return { + cmd = { 'csharp-ls' }, + root_markers = { ".git" }, + filetypes = { 'cs' }, + init_options = { + AutomaticWorkspaceInit = true, + }, +} diff --git a/vim/.config/nvim/lsp/cspell-ls.lua b/vim/.config/nvim/lsp/cspell-ls.lua index 4f184af..b01c7a3 100644 --- a/vim/.config/nvim/lsp/cspell-ls.lua +++ b/vim/.config/nvim/lsp/cspell-ls.lua @@ -4,7 +4,7 @@ --- return { cmd = { 'cspell-lsp', '--stdio' }, - filetypes = {"go", "rust", "js", "ts", "html", "css", "json", "yaml", "markdown", "gitcommit", "typst", "lua", "htmlua"}, + filetypes = { "go", "rust", "js", "ts", "html", "css", "json", "yaml", "markdown", "gitcommit", "typst", "lua", "htmlua", "c", "cpp", "arduino" }, root_markers = { '.git', 'cspell.json', @@ -20,4 +20,10 @@ return { 'cspell.yaml', 'cspell.yml', }, + init_options = { + userWordsFile = vim.fn.expand('~/.config/cspell/user-dictionary.txt'), + configPaths = { + vim.fn.expand('~/.cspell.json'), + }, + }, } diff --git a/vim/.config/nvim/lsp/gdscript.lua b/vim/.config/nvim/lsp/gdscript.lua new file mode 100644 index 0000000..42f3ae2 --- /dev/null +++ b/vim/.config/nvim/lsp/gdscript.lua @@ -0,0 +1,9 @@ +local port = os.getenv 'GDScript_Port' or '6005' +local cmd = vim.lsp.rpc.connect('127.0.0.1', tonumber(port)) + +---@type vim.lsp.Config +return { + cmd = cmd, + filetypes = { 'gd', 'gdscript', 'gdscript3' }, + root_markers = { 'project.godot', '.git' }, +} diff --git a/vim/.config/nvim/lsp/pyright.lua b/vim/.config/nvim/lsp/pyright.lua new file mode 100644 index 0000000..edc802e --- /dev/null +++ b/vim/.config/nvim/lsp/pyright.lua @@ -0,0 +1,65 @@ +---@brief +--- +--- https://github.com/microsoft/pyright +--- +--- `pyright`, a static type checker and language server for python + +local function set_python_path(command) + local path = command.args + local clients = vim.lsp.get_clients { + bufnr = vim.api.nvim_get_current_buf(), + name = 'pyright', + } + for _, client in ipairs(clients) do + if client.settings then + client.settings.python = vim.tbl_deep_extend('force', client.settings.python, { pythonPath = path }) + else + client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { python = { pythonPath = path } }) + end + client:notify('workspace/didChangeConfiguration', { settings = nil }) + end +end + +---@type vim.lsp.Config +return { + cmd = { 'pyright-langserver', '--stdio' }, + filetypes = { 'python' }, + root_markers = { + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + 'pyrightconfig.json', + '.git', + }, + settings = { + python = { + analysis = { + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = 'openFilesOnly', + }, + }, + }, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function() + local params = { + command = 'pyright.organizeimports', + arguments = { vim.uri_from_bufnr(bufnr) }, + } + + -- Using client.request() directly because "pyright.organizeimports" is private + -- (not advertised via capabilities), which client:exec_cmd() refuses to call. + -- https://github.com/neovim/neovim/blob/c333d64663d3b6e0dd9aa440e433d346af4a3d81/runtime/lua/vim/lsp/client.lua#L1024-L1030 + client.request('workspace/executeCommand', params, nil, bufnr) + end, { + desc = 'Organize Imports', + }) + vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightSetPythonPath', set_python_path, { + desc = 'Reconfigure pyright with the provided python path', + nargs = 1, + complete = 'file', + }) + end, +} diff --git a/vim/.config/nvim/lsp/rust-analyzer.lua b/vim/.config/nvim/lsp/rust-analyzer.lua new file mode 100644 index 0000000..31c9b63 --- /dev/null +++ b/vim/.config/nvim/lsp/rust-analyzer.lua @@ -0,0 +1,15 @@ +return { + cmd = { "rust-analyzer" }, + filetypes = { "rust", "rs" }, + root_markers = { "Cargo.lock" }, + settings = { + ["rust-analyzer"] = { + check = { + command = "clippy", + }, + diagnostics = { + enable = true, + }, + }, + }, +} diff --git a/vim/.config/nvim/lsp/rust_analyzer.lua b/vim/.config/nvim/lsp/rust_analyzer.lua deleted file mode 100644 index 6187a15..0000000 --- a/vim/.config/nvim/lsp/rust_analyzer.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - cmd = { 'rust-analyzer' }, - filetypes = { 'rust', 'rs' }, - root_markers = { - 'cargo.toml', - '.git' - }, -} - diff --git a/vim/.config/nvim/lsp/tinymist.lua b/vim/.config/nvim/lsp/tinymist.lua new file mode 100644 index 0000000..5b6a449 --- /dev/null +++ b/vim/.config/nvim/lsp/tinymist.lua @@ -0,0 +1,77 @@ +---@brief +--- +--- https://github.com/Myriad-Dreamin/tinymist +--- An integrated language service for Typst [taɪpst]. You can also call it "微霭" [wēi ǎi] in Chinese. +--- +--- Currently some of Tinymist's workspace commands are supported, namely: +--- `LspTinymistExportSvg`, `LspTinymistExportPng`, `LspTinymistExportPdf +--- `LspTinymistExportMarkdown`, `LspTinymistExportText`, `LspTinymistExportQuery`, +--- `LspTinymistExportAnsiHighlight`, `LspTinymistGetServerInfo`, +--- `LspTinymistGetDocumentTrace`, `LspTinymistGetWorkspaceLabels`, and +--- `LspTinymistGetDocumentMetrics`. + +---@param command_name string +---@param client vim.lsp.Client +---@param bufnr integer +---@return fun():nil run_tinymist_command, string cmd_name, string cmd_desc +local function create_tinymist_command(command_name, client, bufnr) + local export_type = command_name:match 'tinymist%.export(%w+)' + local info_type = command_name:match 'tinymist%.(%w+)' + if info_type and info_type:match '^get' then + info_type = info_type:gsub('^get', 'Get') + end + local cmd_display = export_type or info_type + ---@return nil + local function run_tinymist_command() + local arguments = { vim.api.nvim_buf_get_name(bufnr) } + local title_str = export_type and ('Export ' .. cmd_display) or cmd_display + ---@type lsp.Handler + local function handler(err, res) + if err then + return vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR) + end + -- If exporting, show the string result; else, show the table for inspection + vim.notify(export_type and res or vim.inspect(res), vim.log.levels.INFO) + end + return client:exec_cmd({ + title = title_str, + command = command_name, + arguments = arguments, + }, { bufnr = bufnr }, handler) + end + -- Construct a readable command name/desc + local cmd_name = export_type and ('TinymistExport' .. cmd_display) or ('Tinymist' .. cmd_display) ---@type string + local cmd_desc = export_type and ('Export to ' .. cmd_display) or ('Get ' .. cmd_display) ---@type string + return run_tinymist_command, cmd_name, cmd_desc +end + +---@type vim.lsp.Config +return { + cmd = { 'tinymist' }, + filetypes = { 'typst' }, + root_markers = { '.git' }, + on_attach = function(client, bufnr) + for _, command in ipairs { + 'tinymist.exportSvg', + 'tinymist.exportPng', + 'tinymist.exportPdf', + -- 'tinymist.exportHtml', -- Use typst 0.13 + 'tinymist.exportMarkdown', + 'tinymist.exportText', + 'tinymist.exportQuery', + 'tinymist.exportAnsiHighlight', + 'tinymist.getServerInfo', + 'tinymist.getDocumentTrace', + 'tinymist.getWorkspaceLabels', + 'tinymist.getDocumentMetrics', + } do + local cmd_func, cmd_name, cmd_desc = create_tinymist_command(command, client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'Lsp' .. cmd_name, cmd_func, { nargs = 0, desc = cmd_desc }) + end + end, + settings = { + ["tinymist"] = { + formatterMode = "typstyle" + } + } +} diff --git a/vim/.config/nvim/lsp/zigscient.lua b/vim/.config/nvim/lsp/zigscient.lua new file mode 100644 index 0000000..cdce2f3 --- /dev/null +++ b/vim/.config/nvim/lsp/zigscient.lua @@ -0,0 +1,12 @@ +---@brief +--- https://github.com/zigtools/zls +--- +--- Zig LSP implementation + Zig Language Server + +---@type vim.lsp.Config +return { + cmd = { 'zigscient' }, + filetypes = { 'zig', 'zir' }, + root_markers = { 'zls.json', 'build.zig', '.git' }, + workspace_required = false, +} diff --git a/vim/.config/nvim/lsp/zls.lua b/vim/.config/nvim/lsp/zls.lua index 332c059..6a8dc08 100644 --- a/vim/.config/nvim/lsp/zls.lua +++ b/vim/.config/nvim/lsp/zls.lua @@ -1,10 +1,12 @@ +---@brief +--- https://github.com/zigtools/zls +--- +--- Zig LSP implementation + Zig Language Server + +---@type vim.lsp.Config return { cmd = { 'zls' }, - filetypes = { 'zig' }, - root_markers = { - 'zls.json', - 'build.zig', - '.git' - }, + filetypes = { 'zig', 'zir' }, + root_markers = { 'zls.json', 'build.zig', '.git' }, + workspace_required = false, } - diff --git a/vim/.config/nvim/lua/diagnostics.lua b/vim/.config/nvim/lua/diagnostics.lua index 55dede6..52f747e 100644 --- a/vim/.config/nvim/lua/diagnostics.lua +++ b/vim/.config/nvim/lua/diagnostics.lua @@ -1,2 +1,7 @@ -vim.diagnostic.config({ virtual_text = true }) +vim.diagnostic.config({ + virtual_text = true, + signs = true, + underline = true, + update_in_insert = false, +}) diff --git a/vim/.config/nvim/lua/godot.lua b/vim/.config/nvim/lua/godot.lua new file mode 100644 index 0000000..327ed33 --- /dev/null +++ b/vim/.config/nvim/lua/godot.lua @@ -0,0 +1,60 @@ +local function connect_to_godot_server() + -- Check if project.godot exists in current directory + local project_file = vim.fn.getcwd() .. "/project.godot" + if vim.fn.filereadable(project_file) == 1 then + local pipe_path = vim.fn.getcwd() .. "/nvim_server.pipe" + + -- Create the pipe if it doesn't exist, then connect + local success = vim.fn.serverstart(pipe_path) + if success then + print("Connected to Godot server via " .. pipe_path) + else + print("Failed to create/connect to Godot server pipe: " .. pipe_path) + end + + local dap = require("dap") + + dap.adapters.godot = { + type = 'server', + host = '127.0.0.1', + port = 6006, + } + + dap.configurations.gdscript = { + { + type = 'godot', + request = 'launch', + name = 'Launch scene', + project = '${workspaceFolder}', + launch_scene = true, + }, + } + + dap.configurations.cs = { + { + type = 'godot', + request = 'launch', + name = 'Launch scene', + project = '${workspaceFolder}', + launch_scene = true, + }, + } + end +end + +-- Auto-connect when Neovim starts +vim.api.nvim_create_autocmd("VimEnter", { + callback = connect_to_godot_server, + desc = "Auto-connect to Godot server if project.godot exists" +}) + +-- Optional: Also check when changing directories +vim.api.nvim_create_autocmd("DirChanged", { + callback = connect_to_godot_server, + desc = "Auto-connect to Godot server when changing to Godot project directory" +}) + +-- Optional: Command to manually connect +vim.api.nvim_create_user_command("GodotConnect", connect_to_godot_server, { + desc = "Manually connect to Godot server" +}) diff --git a/vim/.config/nvim/lua/native-lsp.lua b/vim/.config/nvim/lua/native-lsp.lua index e31468c..162533d 100644 --- a/vim/.config/nvim/lua/native-lsp.lua +++ b/vim/.config/nvim/lua/native-lsp.lua @@ -15,6 +15,7 @@ vim.lsp.config('pyright', { }) vim.lsp.enable("pyright") +-- vim.lsp.enable("basedpyright") vim.lsp.config('ty', { on_attach = function() @@ -49,6 +50,7 @@ vim.lsp.config('zls', { }) vim.lsp.enable("zls") +-- vim.lsp.enable("zigscient") vim.lsp.enable("gopls") @@ -58,8 +60,40 @@ vim.lsp.enable("cspell-ls") vim.lsp.enable("astro") +vim.lsp.config('rust_analyzer', { + on_attach = function() + print('rust-analyzer is now active in this file') + end, +}) + +vim.lsp.enable("rust-analyzer") +vim.lsp.enable("gdscript") +vim.lsp.config('csharp-ls', { + on_attach = function() + print('csharp-ls is now active in this file') + end, +}) + + +vim.lsp.enable("csharp-ls") + -- https://lsp-zero.netlify.app/blog/lsp-client-features.html -vim.opt.completeopt = {'menu', 'menuone', 'noselect', 'noinsert'} +vim.opt.completeopt = { 'menu', 'menuone', 'noselect', 'noinsert' } vim.opt.shortmess:append('c') + +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("lsp", { clear = true }), + callback = function(args) + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = args.buf, + callback = function() + if vim.bo[args.buf].filetype == "typst" or vim.bo[args.buf].filetype == "c" then + return + end + vim.lsp.buf.format({ async = false, id = args.data.client_id }) + end, + }) + end +}) diff --git a/vim/.config/nvim/lua/plugins/init.lua b/vim/.config/nvim/lua/plugins/init.lua index 09464f9..213119d 100644 --- a/vim/.config/nvim/lua/plugins/init.lua +++ b/vim/.config/nvim/lua/plugins/init.lua @@ -2,9 +2,9 @@ vim.cmd [[packadd packer.nvim]] local ensure_packer = function() local fn = vim.fn - local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' + local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) vim.cmd [[packadd packer.nvim]] return true end @@ -32,7 +32,7 @@ return require('packer').startup(function(use) } use { 'nvim-telescope/telescope.nvim', tag = '0.1.x', - requires = { {'nvim-lua/plenary.nvim'} } + requires = { { 'nvim-lua/plenary.nvim' } } } use { @@ -60,7 +60,7 @@ return require('packer').startup(function(use) end } - use { + use { 'CRAG666/betterTerm.nvim', config = function() require('betterTerm').setup() end } @@ -68,9 +68,9 @@ return require('packer').startup(function(use) use { 'anurag3301/nvim-platformio.lua', requires = { - {'akinsho/nvim-toggleterm.lua'}, - {'nvim-telescope/telescope.nvim'}, - {'nvim-lua/plenary.nvim'}, + { 'akinsho/nvim-toggleterm.lua' }, + { 'nvim-telescope/telescope.nvim' }, + { 'nvim-lua/plenary.nvim' }, }, config = function() if not vim.g.is_purdue then @@ -113,28 +113,95 @@ return require('packer').startup(function(use) use { 'f-person/git-blame.nvim', - config = function () + config = function() require("gitblame").setup { gitblame_delay = 1 } end } - use { - 'mrcjkb/rustaceanvim', - config = function() require('plugins/rust-config') end - } + -- use { + -- 'mrcjkb/rustaceanvim', + -- config = function() require('plugins/rust-config') end + -- } use { "NeogitOrg/neogit", - config = function () + config = function() require("neogit").setup {} end } - use "mfussenegger/nvim-dap" + use { + "mfussenegger/nvim-dap", + + config = function() + local dap = require("dap") + + require('dap.ext.vscode').load_launchjs(nil, { + node = { 'javascript', 'typescript' }, + python = { 'python' }, + go = { 'go' }, + codelldb = { 'c', 'cpp', 'rust' } + }) + + vim.keymap.set('n', '', function() dap.continue() end, { desc = 'DAP: Continue' }) + vim.keymap.set('n', '', function() dap.step_into() end, { desc = 'DAP: Step Into' }) + vim.keymap.set('n', '', function() dap.step_out() end, { desc = 'DAP: Step Out' }) + vim.keymap.set('n', '', function() dap.step_over() end, { desc = 'DAP: Step Over' }) + vim.keymap.set('n', '', function() dap.toggle_breakpoint() end, { desc = 'DAP: Toggle Breakpoint' }) + vim.keymap.set('n', '', function() dap.continue() end) + vim.keymap.set('n', '', function() dap.step_over() end) + vim.keymap.set('n', '', function() dap.step_into() end) + vim.keymap.set('n', '', function() dap.step_out() end) + vim.keymap.set('n', 'b', function() dap.toggle_breakpoint() end) + vim.keymap.set('n', 'dr', function() dap.repl.open() end) + + dap.adapters.codelldb = { + type = "executable", + command = "codelldb" + } + dap.configurations.cpp = { + { + name = "Launch file", + type = "codelldb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + }, + } + end + } + + + use { + 'stevearc/overseer.nvim', + config = function() require('overseer').setup() end + } use 'theHamsta/nvim-dap-virtual-text' - use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio"} } + use { + "rcarriga/nvim-dap-ui", + requires = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, + config = function() + local dap, dapui = require("dap"), require("dapui") + dapui.setup() + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + end + } use { "geigerzaehler/tree-sitter-jinja2" } @@ -176,29 +243,30 @@ return require('packer').startup(function(use) }) + -- use { + -- 'preservim/vim-pencil', + -- config = function() + -- vim.cmd([[ + -- augroup PencilSetup + -- autocmd! + -- autocmd FileType markdown,text,tex,gitcommit setlocal formatoptions+=t + -- autocmd FileType markdown,text,tex,gitcommit PencilHard + -- augroup END augroup END + -- ]]) + -- end + -- } + use { - 'preservim/vim-pencil', + 'LukasPietzschmann/telescope-tabs', + requires = { 'nvim-telescope/telescope.nvim' }, config = function() - vim.cmd([[ - augroup PencilSetup - autocmd! - autocmd FileType markdown,text,tex,gitcommit setlocal formatoptions+=t - autocmd FileType markdown,text,tex,gitcommit PencilHard - augroup END augroup END - ]]) + require 'telescope-tabs'.setup { + -- Your custom config :^) + } end } - use { - 'LukasPietzschmann/telescope-tabs', - requires = { 'nvim-telescope/telescope.nvim' }, - config = function() - require'telescope-tabs'.setup{ - -- Your custom config :^) - } - end -} - + use "HiPhish/rainbow-delimiters.nvim" ------------------------ @@ -207,4 +275,3 @@ return require('packer').startup(function(use) require('packer').sync() end end) - diff --git a/vim/.config/nvim/lua/standard-lint.lua b/vim/.config/nvim/lua/standard-lint.lua index b46004e..4aa79b1 100644 --- a/vim/.config/nvim/lua/standard-lint.lua +++ b/vim/.config/nvim/lua/standard-lint.lua @@ -1,6 +1,5 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave", "TextChanged" }, { callback = function() - -- try_lint without arguments runs the linters defined in `linters_by_ft` -- for the current filetype require("lint").try_lint()