dotfiles
shell, editor, ssh.
git clone https://owenrusk.dev/dotfiles.git
commit c0ac6ed744ca40338377f8d319673bba025844da parent 66a9e8824a55845b7fdd94668dcd73d9d039f070 author Owen Rusk <owen@papermothgames.com> date 2025-03-31 20:10:18 -0500
nvim: vim.lsp.config now that 0.11 is out same servers, less code. lua_ls while i'm here.
| nvim/lua/owen/lsp.lua | +24 | -23 |
diff --git a/nvim/lua/owen/lsp.lua b/nvim/lua/owen/lsp.lua index b71a481..77a52f5 100644 --- a/nvim/lua/owen/lsp.lua +++ b/nvim/lua/owen/lsp.lua @@ -1,30 +1,31 @@ -- servers come from the system, not from neovim.-local servers = {- pyright = {- cmd = { "pyright-langserver", "--stdio" },- markers = { "pyproject.toml", "setup.py", ".git" },- settings = { python = { analysis = { typeCheckingMode = "standard" } } },- },- ruff = {- cmd = { "ruff", "server" },- markers = { "pyproject.toml", "ruff.toml", ".git" },- },-}+vim.lsp.config("pyright", { + cmd = { "pyright-langserver", "--stdio" }, + filetypes = { "python" }, + root_markers = { "pyproject.toml", "setup.py", ".git" }, + settings = { python = { analysis = { typeCheckingMode = "standard" } } }, +})-vim.api.nvim_create_autocmd("FileType", {- pattern = "python",- callback = function(args)- for name, s in pairs(servers) do- vim.lsp.start({- name = name,- cmd = s.cmd,- root_dir = vim.fs.root(args.buf, s.markers),- settings = s.settings,- })- end- end,+vim.lsp.config("ruff", { + cmd = { "ruff", "server" }, + filetypes = { "python" }, + root_markers = { "pyproject.toml", "ruff.toml", ".git" }, }) +vim.lsp.config("lua_ls", { + cmd = { "lua-language-server" }, + filetypes = { "lua" }, + root_markers = { ".luarc.json", ".git" }, + settings = { + Lua = { + runtime = { version = "LuaJIT" }, + workspace = { library = { vim.env.VIMRUNTIME } }, + }, + }, +}) + +vim.lsp.enable({ "pyright", "ruff", "lua_ls" }) + vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id)