Something went wrong. Try again.
Configuration for my NixOS based systems and Home Manager
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177local nvim_lsp = require("lspconfig")--########################--#### Set up LSPs ####--########################---- TypeScriptnvim_lsp.tsserver.setup { flags = { debounce_text_changes = 150 }}
local util = require("lspconfig.util")
-- Rust-- Python LSPnvim_lsp.pylsp.setup( { cmd = {"/home/noah/.envs/nvim/bin/pylsp"}, root_dir = function(fname) local root_files = { "pants.toml", "pyproject.toml", "setup.py", "setup.cfg", "Pipfile" } return util.find_git_ancestor(fname) or util.root_pattern(unpack(root_files))(fname) end })--nvim_lsp.scheme_langserver.setup{}
-- Golang-- Lots of things--nvim_lsp.diagnosticls.setup(-- {-- flags = {-- debounce_text_changes = 150-- }-- }--)nvim_lsp.lua_ls.setup{ settings = { Lua = { runtime = { -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) version = "LuaJIT" }, diagnostics = { -- Get the language server to recognize the `vim` global globals = {"vim"} }, workspace = { -- Make the server aware of Neovim runtime files library = vim.api.nvim_get_runtime_file("", true) }, -- Do not send telemetry data containing a randomized but unique identifier telemetry = { enable = false } } }}
-- LSPs that just use default configlocal simple_lsps = { "fennel_ls", "nil_ls", "htmx", "bzl", "bufls", "crystalline", "dockerls", "erlangls", "elixirls", "fortls", "gleam", "gopls", "hls", "jsonls", "vimls", "asm_lsp", "ccls", "pyright", -- ruff", idk if this is wrong? "ruff_lsp", "clojure_lsp", "guile_ls", -- Of course the Java-based ones are verbose af "kotlin_language_server", "java_language_server", "jsonls", "pest_ls", "ocamllsp", "reason_ls", "racket_langserver", "rust_analyzer", "scheme_langserver", "sqls", "thriftls", "typst_lsp", "vhdl_ls", "yamlls", "zls", "tsserver", "eslint",}-- #simple_lsps is the length of the table when treated as a list... funky!for _,v in pairs(simple_lsps) do nvim_lsp[v].setup{}end
-- Whenever an LSP is attached to a bufferlocal on_attach = function(ev) --Enable completion triggered by <c-x><x-o> vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
local opts = {noremap = true, silent = true, buffer = ev.buf} local protocol = require("vim.lsp.protocol") -- Mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts) vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts) vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts) vim.keymap.set("n", "<space>wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts) vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts) vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts) vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, opts) vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, opts) vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, opts) vim.keymap.set("n", "<space>f", function() vim.lsp.buf.format{ async = true } end, opts) vim.keymap.set("n", "<space>s", vim.lsp.buf.workspace_symbol, opts)
-- require'completion'.on_attach(client, bufnr) protocol.CompletionItemKind = { "", -- Text "⋙", -- Method "𝑓", -- Function "", -- Constructor "", -- Field "", -- Variable "", -- Class "ﰮ", -- Interface "", -- Module "", -- Property "", -- Unit "", -- Value "", -- Enum "", -- Keyword "", -- Snippet "", -- Color "", -- File "", -- Reference "", -- Folder "", -- EnumMember "", -- Constant "", -- Struct "", -- Event "ﬦ", -- Operator "" -- TypeParameter }endvim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('UserLspConfig', {}), callback = on_attach})