---@diagnostic disable: undefined-global vim.o.termguicolors = true vim.o.relativenumber = true vim.o.number = true vim.o.cc = "80" vim.o.updatetime = 1000 vim.o.splitright = true vim.o.splitbelow = true vim.o.signcolumn = "no" -- diagnostics are already inline vim.o.ignorecase = true vim.o.tabstop = 2 vim.o.shiftwidth = 0 vim.o.expandtab = true vim.o.undofile = true vim.o.scrolloff = 3 vim.o.winborder = "none" vim.o.mouse = "" vim.o.completeopt = "menu,menuone,noselect" vim.g.mapleader = " " vim.pack.add({ "https://github.com/neovim/nvim-lspconfig", "https://github.com/nvim-mini/mini.pick", "https://github.com/projekt0n/github-nvim-theme", }) for _, plugin in ipairs(vim.pack.get()) do if not plugin.active then vim.pack.del({plugin.path:match(".*/(.*)$")}) end end require("mini.pick").setup({ window = { config = { border = "none" }, }, }) vim.keymap.set("n", "f", ":Pick files tool='rg'") -- Switch between semantically related files easily :) local exts = {{"c", "h"}, {"cc", "hh"}, {"frag", "vert"}} vim.keymap.set("n", "s", function() local bufpath = vim.api.nvim_buf_get_name(0) for _, pair in ipairs(exts) do for i, ext in ipairs(pair) do if bufpath:match("%." .. ext .. "$") then local other = pair[i % #pair + 1] vim.cmd("e " .. bufpath:gsub("%." .. ext .. "$", "." .. other)) return end end end print("no files to swap to") end) -- toggle inlay hints vim.keymap.set("n", "h", function() vim.lsp.inlay_hint.enable( not vim.lsp.inlay_hint.is_enabled({bufnr=0}), {bufnr=0}) end) vim.lsp.enable({"lua_ls", "clangd", "zls"}) vim.diagnostic.config({ virtual_text = true, severity_sort = true, }) vim.api.nvim_create_autocmd("LspAttach", { callback = function(ev) local opts = {silent=true, buffer=ev.buf} vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts) vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) local client = vim.lsp.get_client_by_id(ev.data.client_id) local chars = {} for i = 32, 126 do table.insert(chars, string.char(i)) end -- client.server_capabilities.semanticTokensProvider = nil client.server_capabilities.completionProvider.triggerCharacters = chars if client:supports_method("textDocument/completion") then vim.lsp.completion.enable(true, client.id, ev.buf, {autotrigger=true}) end end, }) vim.g.adwaita_darker = true vim.cmd.colorscheme("github_dark_default") require('vim._extui').enable({})