summaryrefslogtreecommitdiff
path: root/neovim
diff options
context:
space:
mode:
authorpks <pks@pks.rocks>2025-12-19 22:00:16 +0100
committerpks <pks@pks.rocks>2025-12-19 22:00:16 +0100
commit4782273fded544167513d2cabbda64bfb7b607c2 (patch)
tree7083f8136ce946a1bcb08b377b609e94301dd7f4 /neovim
parent87a98ce3136131a7eb84f5ac01ba69102268e104 (diff)
WIP
Diffstat (limited to 'neovim')
-rw-r--r--neovim/.config/nvim/init.lua103
1 files changed, 101 insertions, 2 deletions
diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua
index 6c9ebaf..08a1e23 100644
--- a/neovim/.config/nvim/init.lua
+++ b/neovim/.config/nvim/init.lua
@@ -257,13 +257,85 @@ require("lazy").setup({
},
}
end,
- }
+ },
+
+ -- LSP (for Neovim < 0.11) ---------------------------------------------------
+ {
+ "neovim/nvim-lspconfig",
+ cond = vim.fn.has("nvim-0.11") == 0,
+ config = function()
+ local lspconfig = require("lspconfig")
+
+ lspconfig.pyright.setup({
+ settings = {
+ python = {
+ analysis = {
+ typeCheckingMode = "basic",
+ autoSearchPaths = false,
+ diagnosticMode = "openFilesOnly",
+ useLibraryCodeForTypes = false,
+ },
+ },
+ },
+ })
+
+ -- ty (Astral's Python type checker)
+ local configs = require("lspconfig.configs")
+ if not configs.ty then
+ configs.ty = {
+ default_config = {
+ cmd = { "ty", "server" },
+ filetypes = { "python" },
+ root_dir = lspconfig.util.root_pattern("pyproject.toml", "setup.py", ".git"),
+ single_file_support = true,
+ },
+ }
+ end
+ lspconfig.ty.setup({})
+
+ lspconfig.solargraph.setup({})
+ lspconfig.yamlls.setup({
+ settings = {
+ yaml = {
+ validate = true,
+ schemaStore = { enable = true, url = "https://www.schemastore.org/api/json/catalog.json" },
+ },
+ },
+ })
+ lspconfig.taplo.setup({})
+ lspconfig.lua_ls.setup({
+ settings = {
+ Lua = {
+ runtime = { version = "LuaJIT" },
+ workspace = { library = { vim.env.VIMRUNTIME } },
+ telemetry = { enable = false },
+ },
+ },
+ })
+ lspconfig.bashls.setup({})
+ lspconfig.jsonls.setup({
+ settings = {
+ json = {
+ validate = { enable = true },
+ schemaStore = { enable = true, url = "https://www.schemastore.org/api/json/catalog.json" },
+ },
+ },
+ })
+ lspconfig.html.setup({})
+ lspconfig.cssls.setup({})
+ lspconfig.ts_ls.setup({})
+ lspconfig.dockerls.setup({})
+ lspconfig.clangd.setup({})
+ end,
+ },
})
--------------------------------------------------------------------------------
--- LSP Configuration
+-- LSP Configuration (Neovim 0.11+ native API)
--------------------------------------------------------------------------------
+if vim.fn.has("nvim-0.11") == 1 then
+
vim.lsp.config.pyright = {
cmd = { "pyright-langserver", "--stdio" },
filetypes = { "python" },
@@ -377,7 +449,15 @@ vim.lsp.config.clangd = {
single_file_support = true,
}
+vim.lsp.config.ty = {
+ cmd = { "ty", "server" },
+ filetypes = { "python" },
+ root_markers = { "pyproject.toml", "setup.py", "setup.cfg", "requirements.txt", ".git" },
+ single_file_support = true,
+}
+
vim.lsp.enable("pyright")
+vim.lsp.enable("ty")
vim.lsp.enable("solargraph")
vim.lsp.enable("yamlls")
vim.lsp.enable("taplo")
@@ -390,6 +470,8 @@ vim.lsp.enable("ts_ls")
vim.lsp.enable("dockerls")
vim.lsp.enable("clangd")
+end -- Neovim 0.11+ check
+
--------------------------------------------------------------------------------
-- Tabline styling
--------------------------------------------------------------------------------
@@ -416,3 +498,20 @@ vim.api.nvim_create_autocmd("LspAttach", {
map("<leader>ds", vim.lsp.buf.document_symbol, "Document symbols")
end,
})
+
+--------------------------------------------------------------------------------
+-- Background color fallback (ensures black background even if colorscheme fails)
+--------------------------------------------------------------------------------
+local function set_background()
+ vim.api.nvim_set_hl(0, "Normal", { bg = "#000000" })
+ vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#000000" })
+ vim.api.nvim_set_hl(0, "SignColumn", { bg = "#000000" })
+ vim.api.nvim_set_hl(0, "LineNr", { bg = "#000000" })
+ vim.api.nvim_set_hl(0, "CursorLineNr", { bg = "#000000" })
+end
+
+set_background()
+vim.api.nvim_create_autocmd("ColorScheme", { callback = set_background })
+vim.api.nvim_create_autocmd("VimEnter", { callback = set_background })
+
+vim.api.nvim_set_hl(0, "Normal", { bg = "NONE" })