yes
This commit is contained in:
parent
2198ddb21e
commit
9df01f6576
4 changed files with 161 additions and 67 deletions
|
|
@ -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
|
||||
|
||||
|
||||
###################
|
||||
|
|
|
|||
|
|
@ -5,3 +5,8 @@ wallpaper {
|
|||
monitor = eDP-2
|
||||
path = ~/wallpaper.png
|
||||
}
|
||||
|
||||
wallpaper {
|
||||
monitor = DP-5
|
||||
path = ~/wallpaper.png
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 = { { "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>", 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({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = 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" }, "<leader>ca", "<cmd>Lspsaga code_action<CR>", { desc = "Code Action" })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue