From 9df01f6576cea48e168a18deb1090f572953db93 Mon Sep 17 00:00:00 2001 From: Xory Date: Wed, 7 Jan 2026 14:57:56 +0200 Subject: [PATCH] yes --- config/hypr/hyprland.conf | 3 +- config/hypr/hyprpaper.conf | 5 + config/nvim/init.lua | 217 ++++++++++++++++++++++++++----------- home.nix | 3 + 4 files changed, 161 insertions(+), 67 deletions(-) diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index d733010..13f8995 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -17,7 +17,8 @@ ################ # See https://wiki.hypr.land/Configuring/Monitors/ -monitor=,preferred,auto,auto +monitor=eDP-2,2560x1600@165.0,1920x80,1.6 +monitor=DP-5,1920x1080@60.0,0x0,1.0 ################### diff --git a/config/hypr/hyprpaper.conf b/config/hypr/hyprpaper.conf index 9dcc679..667afa2 100644 --- a/config/hypr/hyprpaper.conf +++ b/config/hypr/hyprpaper.conf @@ -5,3 +5,8 @@ wallpaper { monitor = eDP-2 path = ~/wallpaper.png } + +wallpaper { + monitor = DP-5 + path = ~/wallpaper.png +} diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 925ef68..fe3acb2 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -2,91 +2,176 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end + vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) end vim.opt.rtp:prepend(lazypath) +-- === NIXOS HELPER (Simplified) === +local function get_tsserver_path() + -- 1. Try to find 'tsserver' in the current shell (direnv/nix-shell) + local bin = vim.fn.exepath("tsserver") + if bin == "" then + vim.notify("WARN: tsserver not found in PATH. Are you in a nix-shell?", vim.log.levels.WARN) + return nil + end + + -- 2. Follow the Nix symlinks to find the actual .js file + -- On NixOS, 'bin/tsserver' is a shell script wrapper. We need the .js file it points to. + local resolved = vim.fn.resolve(bin) + + -- Logic: Check if the resolved path is already the js file or needs traversal + if resolved:match("%.js$") then + return resolved + end + + -- Common NixOS pattern: /nix/store/.../bin/tsserver -> points near lib/node_modules + return vim.fn.fnamemodify(resolved, ":h") .. "/../lib/node_modules/typescript/lib/tsserver.js" +end + + require("lazy").setup({ - { "catppuccin/nvim", name = "catppuccin" }, - "neovim/nvim-lspconfig", - {"nvim-treesitter/nvim-treesitter", lazy = false, branch = "main", build = ":TSUpdate", opts = {}}, - { "nvim-tree/nvim-tree.lua", opts = {} }, + ------------------------------ UI ------------------------------ + { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, + { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", opts = {} }, "nvim-tree/nvim-web-devicons", + { "nvim-tree/nvim-tree.lua", opts = {} }, "romgrk/barbar.nvim", { "nvim-lualine/lualine.nvim", opts = {} }, - { "windwp/nvim-autopairs", opts = {} }, - "neovim/nvim-lspconfig", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "hrsh7th/nvim-cmp", - "hrsh7th/vim-vsnip", - "voldikss/vim-floaterm", - { - 'IogaMaster/neocord', + { + 'windwp/nvim-autopairs', + event = "InsertEnter", + opts = {} + }, + + -- DIRENV (Crucial for NixOS shells) + { "direnv/direnv.vim" }, + + ------------------------------ DIAGNOSTICS & UI ------------------------------ + { + "folke/trouble.nvim", + cmd = "Trouble", + opts = {}, + keys = { { "xx", "Trouble diagnostics toggle", desc = "Diagnostics" } }, + }, + + { + "rachartier/tiny-inline-diagnostic.nvim", event = "VeryLazy", - opts = {} - } + priority = 1000, + config = function() + require("tiny-inline-diagnostic").setup() + vim.diagnostic.config({ virtual_text = false }) + end, + }, + + { + "nvimdev/lspsaga.nvim", + opts = { + lightbulb = { + enable = true, + virtual_text = false, + sign = true, + } + } + }, + + ------------------------------ COMPLETION ------------------------------ + { + "saghen/blink.cmp", + version = "*", + opts = { + keymap = { preset = "default" }, + sources = { default = { "lsp", "path", "snippets", "buffer" } }, + signature = { enabled = true } + }, + }, + + ------------------------------ FORMATTING ------------------------------ + { + "stevearc/conform.nvim", + event = { "BufWritePre" }, + opts = { + formatters_by_ft = { + lua = { "stylua" }, + python = { "ruff_format" }, + javascript = { "prettierd", "prettier", stop_after_first = true }, + typescript = { "prettierd", "prettier", stop_after_first = true }, + vue = { "prettierd" }, + }, + format_on_save = { timeout_ms = 500, lsp_fallback = true }, + }, + }, + + ------------------------------ SPECIALISTS ------------------------------ + { "mrcjkb/rustaceanvim", version = '^5', lazy = false }, + { "pmizio/typescript-tools.nvim", dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" } }, + "esmuellert/nvim-eslint", + "neovim/nvim-lspconfig", }) +------------------------------ CONFIGURATION ------------------------------ vim.o.tabstop = 2 vim.o.shiftwidth = 2 vim.o.expandtab = true -vim.o.smarttab = true -vim.o.cursorline = true -vim.o.laststatus = 3 -vim.o.background = "dark" -vim.o.termguicolors = true vim.o.number = true -vim.o.relativenumber = true +vim.o.signcolumn = "yes" +vim.o.cursorline = true vim.cmd.colorscheme "catppuccin-mocha" -vim.o.guifont = "CaskaydiaCove Nerd Font:h11" -vim.diagnostic.config({ - virtual_text = true, -- Show inline error messages - signs = true, -- Show signs in the gutter - underline = true, -- Underline errors - update_in_insert = false, - severity_sort = true, -}) +------------------------------ NATIVE LSP SETUP ------------------------------ -local cmp = require'cmp' -cmp.setup({ - snippet = { - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) - end, +local capabilities = require('blink.cmp').get_lsp_capabilities() + +-- 1. TYPESCRIPT TOOLS (Specialist) +require("typescript-tools").setup({ + capabilities = capabilities, + + -- CRITICAL: This must be a string. If nil, the plugin defaults to internal logic. + tsserver_path = get_tsserver_path(), + + settings = { + -- Remove the 'tsserver_plugins' block for now. + -- It causes the "table at index 1" crash if the paths are wrong. + + tsserver_file_preferences = { + includeCompletionsForModuleExports = true, + quotePreference = "auto", + importModuleSpecifierPreference = "non-relative", + }, }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, - }, { - { name = 'buffer' }, - }) + + -- Only run on standard JS/TS files for now + filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact" }, +}) +-- 2. ESLINT (Specialist) +require("nvim-eslint").setup({ + capabilities = capabilities, }) -local capabilities = require("cmp_nvim_lsp").default_capabilities() +-- 3. RUST (Specialist) +vim.g.rustaceanvim = { + server = { + capabilities = capabilities, + default_settings = { ['rust-analyzer'] = { checkOnSave = { command = "clippy" } } } + } +} -vim.lsp.enable("rust_analyzer") -vim.lsp.enable("pylsp") -vim.lsp.enable("biome") -vim.lsp.enable("eslint") -vim.lsp.enable("ccls") +-- 4. GENERICS (Native Loop) +-- NOTE: "vue_ls" is the new name for Volar. +local generic_servers = { "basedpyright", "ruff", "lua_ls", "html", "svelte", "vue_ls", "nil_ls" } +for _, name in ipairs(generic_servers) do + -- Apply caps + vim.lsp.config(name, { + capabilities = capabilities, + -- NixOS Tip: This prevents Neovim from yelling if a server is missing from your shell + on_init = function(client) + -- Optional: logic to check if root_dir is valid + end + }) + + -- Enable + vim.lsp.enable(name) +end + +vim.keymap.set({ "n", "v" }, "ca", "Lspsaga code_action", { desc = "Code Action" }) diff --git a/home.nix b/home.nix index 19638ea..cd955d3 100644 --- a/home.nix +++ b/home.nix @@ -94,6 +94,9 @@ "spotify" = "${pkgs.firejail}/bin/firejail ${config.programs.spicetify.spicedSpotify}/bin/spotify"; }; syntaxHighlighting.enable = true; + initContent = '' +eval "$(direnv hook zsh)" + ''; }; programs.starship.enable = true;