feat: isolate nvim config

This commit is contained in:
tux
2025-02-27 16:22:02 +05:30
parent 2dc7d829a5
commit eb149f8329
24 changed files with 27 additions and 753 deletions

21
flake.lock generated
View File

@ -873,6 +873,7 @@
"nur": "nur", "nur": "nur",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"tfolio": "tfolio", "tfolio": "tfolio",
"tnvim": "tnvim",
"wezterm-flake": "wezterm-flake" "wezterm-flake": "wezterm-flake"
} }
}, },
@ -1028,6 +1029,26 @@
"url": "ssh://git@github.com/tuxdotrs/tfolio.git" "url": "ssh://git@github.com/tuxdotrs/tfolio.git"
} }
}, },
"tnvim": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1740652309,
"narHash": "sha256-Ag5MrswBfHtxjlxyHmR/gESGnposwHYNO/Nppf+CeLk=",
"owner": "tuxdotrs",
"repo": "tnvim",
"rev": "5a820f6457fa1b8aebb46abff560c0d7da2eea34",
"type": "github"
},
"original": {
"owner": "tuxdotrs",
"repo": "tnvim",
"type": "github"
}
},
"treefmt-nix": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [

View File

@ -125,6 +125,10 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager"; inputs.home-manager.follows = "home-manager";
}; };
tnvim = {
url = "github:tuxdotrs/tnvim";
inputs.nixpkgs.follows = "nixpkgs";
};
tfolio = { tfolio = {
url = "git+ssh://git@github.com/tuxdotrs/tfolio.git"; url = "git+ssh://git@github.com/tuxdotrs/tfolio.git";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

View File

@ -2,7 +2,7 @@
home.file = { home.file = {
".config/nvim" = { ".config/nvim" = {
recursive = true; recursive = true;
source = "${pkgs.tux-nvim-config}"; source = "${pkgs.tnvim}";
}; };
}; };

View File

@ -4,6 +4,7 @@
modifications = final: prev: { modifications = final: prev: {
awesome = inputs.nixpkgs-f2k.packages.${prev.system}.awesome-git; awesome = inputs.nixpkgs-f2k.packages.${prev.system}.awesome-git;
ghostty = inputs.ghostty.packages.${prev.system}.default; ghostty = inputs.ghostty.packages.${prev.system}.default;
tnvim = inputs.tnvim.packages.${prev.system}.default;
tfolio = inputs.tfolio.packages.${prev.system}.default; tfolio = inputs.tfolio.packages.${prev.system}.default;
cyber-tux = inputs.cyber-tux.packages.${prev.system}.default; cyber-tux = inputs.cyber-tux.packages.${prev.system}.default;
discord = prev.discord.override { discord = prev.discord.override {

View File

@ -1,6 +1,5 @@
{pkgs, ...}: { {pkgs, ...}: {
tux-awesome-wm-config = pkgs.callPackage ./awesome {}; tux-awesome-wm-config = pkgs.callPackage ./awesome {};
tux-nvim-config = pkgs.callPackage ./nvim {};
astronvim = pkgs.callPackage ./astronvim {}; astronvim = pkgs.callPackage ./astronvim {};
firefox-mod-blur = pkgs.callPackage ./firefox-mod-blur {}; firefox-mod-blur = pkgs.callPackage ./firefox-mod-blur {};
plymouth-spinner-monochrome = pkgs.callPackage ./plymouth-spinner-monochrome {}; plymouth-spinner-monochrome = pkgs.callPackage ./plymouth-spinner-monochrome {};

View File

@ -1,22 +0,0 @@
{
stdenv,
lib,
}: let
nvim = ./nvim;
in
stdenv.mkDerivation {
pname = "tux-nvim-config";
version = "2.5.0";
buildCommand = ''
mkdir -p $out
cp -r ${nvim}/* "$out/"
'';
meta = with lib; {
description = "tux's nvim config";
homepage = "https://tux.rs";
platforms = platforms.all;
license = licenses.gpl3;
};
}

View File

@ -1,54 +0,0 @@
vim.g.base46_cache = vim.fn.stdpath("data") .. "/base46/"
vim.g.mapleader = " "
-- bootstrap lazy and all plugins
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system({ "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)
local lazy_config = require("configs.lazy")
-- load plugins
require("lazy").setup({
{
"NvChad/NvChad",
lazy = false,
branch = "v2.5",
import = "nvchad.plugins",
config = function()
require("options")
end,
},
{ import = "plugins" },
}, lazy_config)
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require("nvchad.autocmds")
vim.schedule(function()
require("mappings")
end)
-- hightlight on yank
vim.api.nvim_create_autocmd("TextYankPost", {
group = vim.api.nvim_create_augroup("highlight_yank", { clear = true }),
desc = "Hightlight selection on yank",
pattern = "*",
callback = function()
vim.highlight.on_yank()
end,
})
-- load neovide
require("neovide")
vim.filetype.add({ extension = { templ = "templ" } })

View File

@ -1,28 +0,0 @@
local M = {}
M.base46 = {
theme = "poimandres",
transparency = true,
}
M.lsp = {
signature = false,
}
M.nvdash = {
load_on_startup = true,
header = {
" ",
" ",
"|------------------------|",
"| NOBODY FUX WITH TUX |",
"|------------------------|",
" \\ (•◡•) / ",
" \\ / ",
" ",
" ",
},
}
return M

View File

@ -1,22 +0,0 @@
local opts = {
provider = "hyperbolic",
vendors = {
deepseek = {
__inherited_from = "openai",
api_key_name = "DEEPSEEK_API_KEY",
endpoint = "https://api.deepseek.com/v1",
model = "deepseek-chat",
},
hyperbolic = {
__inherited_from = "openai",
api_key_name = "cmd:cat /run/secrets/hyperbolic_api_key",
endpoint = "https://api.hyperbolic.xyz/v1",
model = "deepseek-ai/DeepSeek-R1",
temperature = 0,
max_tokens = 4096,
},
},
}
return opts

View File

@ -1,29 +0,0 @@
local prettier = { "prettierd", "prettier" }
local options = {
lsp_fallback = true,
formatters_by_ft = {
lua = { "stylua" },
javascript = prettier,
typescript = prettier,
javascriptreact = prettier,
typescriptreact = prettier,
json = prettier,
jsonc = prettier,
css = prettier,
html = prettier,
markdown = prettier,
nix = { "alejandra" },
go = { "goimports", "gofumpt" },
rust = { "rust_analyzer" },
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 1000,
},
}
require("conform").setup(options)

View File

@ -1,17 +0,0 @@
require("dapui").setup()
require("nvim-dap-virtual-text").setup()
local dap, dapui = require("dap"), require("dapui")
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
dapui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
dapui.close()
end

View File

@ -1,5 +0,0 @@
require("go").setup({
trouble = true,
icons = { breakpoint = "", currentpos = "" },
gocoverage_sign = "",
})

View File

@ -1,47 +0,0 @@
return {
defaults = { lazy = true },
install = { colorscheme = { "nvchad" } },
ui = {
icons = {
ft = "",
lazy = "󰂠 ",
loaded = "",
not_loaded = "",
},
},
performance = {
rtp = {
disabled_plugins = {
"2html_plugin",
"tohtml",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"syntax",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
},
},
},
}

View File

@ -1,47 +0,0 @@
local configs = require("nvchad.configs.lspconfig")
local on_attach = configs.on_attach
local capabilities = configs.capabilities
local lspconfig = require("lspconfig")
local servers = { "eslint", "gopls", "templ" }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup({
on_attach = on_attach,
capabilities = capabilities,
})
end
lspconfig.nil_ls.setup({
on_attach = on_attach,
capabilities = capabilities,
filetypes = { "nix" },
cmd = { "nil" },
settings = {
["nil"] = {
flake = {
autoArchive = true,
},
},
},
})
lspconfig.html.setup({
on_attach = on_attach,
capabilities = capabilities,
filetypes = { "html", "templ" },
})
lspconfig.htmx.setup({
on_attach = on_attach,
capabilities = capabilities,
filetypes = { "html", "templ" },
})
lspconfig.tailwindcss.setup({
on_attach = on_attach,
capabilities = capabilities,
filetypes = { "templ", "astro", "javascript", "typescript", "react", "typescriptreact" },
init_options = { userLanguages = { templ = "html" } },
})

View File

@ -1,27 +0,0 @@
local opts = {
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
presets = {
long_message_to_split = true,
inc_rename = false,
lsp_doc_border = false,
},
views = {
mini = {
win_options = {
winblend = 0,
},
},
},
}
require("notify").setup({
background_colour = "#000",
})
return opts

View File

@ -1,40 +0,0 @@
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local null_ls = require("null-ls")
local b = null_ls.builtins
local opts = {
sources = {
b.formatting.prettierd,
b.formatting.stylua,
-- nix
b.code_actions.statix,
b.formatting.alejandra,
b.diagnostics.deadnix,
-- go
b.code_actions.gomodifytags,
b.code_actions.impl,
b.formatting.gofumpt,
b.formatting.goimports,
b.diagnostics.staticcheck,
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({
group = augroup,
buffer = bufnr,
})
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
end,
}
return opts

View File

@ -1,71 +0,0 @@
local M = {}
M.treesitter = {
ensure_installed = {
-- defaults
"vim",
"lua",
"regex",
"bash",
"markdown",
"markdown_inline",
-- web dev
"html",
"css",
"javascript",
"typescript",
"tsx",
-- nix
"nix",
-- go
"go",
"gomod",
"gowork",
"gosum",
"templ",
-- rust
"rust",
},
}
M.mason = {
ensure_installed = {
-- defaults
"lua-language-server",
"stylua",
"luacheck",
-- web dev
"css-lsp",
"html-lsp",
"htmx-lsp",
"prettier",
"prettierd",
"eslint-lsp",
"eslint_d",
"tailwindcss-language-server",
-- nix
"nil",
-- go
"gopls",
"templ",
-- rust
"codelldb",
},
}
M.telescope = {
defaults = {
winblend = 40,
pumblend = 40,
},
}
return M

View File

@ -1,17 +0,0 @@
local configs = require("nvchad.configs.lspconfig")
local on_attach = configs.on_attach
local capabilities = configs.capabilities
vim.g.rustaceanvim = {
server = {
on_attach = on_attach,
capabilities = capabilities,
default_settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
},
},
},
}

View File

@ -1,20 +0,0 @@
require("smartyank").setup({
highlight = {
enabled = true,
higroup = "IncSearch",
timeout = 2000,
},
clipboard = {
enabled = true,
},
tmux = {
enabled = true,
cmd = { "tmux", "set-buffer", "-w" },
},
osc52 = {
enabled = true,
ssh_only = false,
silent = false,
echo_hl = "Directory",
},
})

View File

@ -1,5 +0,0 @@
local on_attach = require("nvchad.configs.lspconfig").on_attach
require("typescript-tools").setup({
on_attach = on_attach,
})

View File

@ -1,56 +0,0 @@
require("nvchad.mappings")
local map = vim.keymap.set
local float_opts = {
relative = "editor",
row = 0.13,
col = 0.14,
width = 0.7,
height = 0.7,
border = "single",
}
local toggleTerm = function()
require("nvchad.term").toggle({ pos = "float", id = "float", float_opts = float_opts })
end
local toggleLazygit = function()
require("nvchad.term").toggle({ pos = "float", id = "lazygit", float_opts = float_opts, cmd = "lazygit" })
end
local toggleTreesj = function()
require("treesj").toggle()
end
local closeAllBuffer = function()
require("nvchad.tabufline").closeAllBufs()
end
map({ "n", "t" }, "<F7>", toggleTerm, { desc = "Toggle Floating Terminal" })
map({ "n", "t" }, "<F8>", toggleLazygit, { desc = "Toggle Lazygit" })
map("n", "<leader>Sl", "<cmd>SessionManager! load_last_session<cr>", { desc = "Load last session" })
map("n", "<leader>Ss", "<cmd>SessionManager! save_current_session<cr>", { desc = "Save this session" })
map("n", "<leader>Sd", "<cmd>SessionManager! delete_session<cr>", { desc = "Delete session" })
map("n", "<leader>Sf", "<cmd>SessionManager! load_session<cr>", { desc = "Search sessions" })
map("n", "<leader>S.", "<cmd>SessionManager! load_current_dir_session<cr>", { desc = "Load current directory session" })
map("n", "<leader>tt", "<cmd>TroubleToggle<cr>", { desc = "Toggle diagnostics" })
map("n", "<leader>td", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME,BUG,TEST,NOTE<cr>", { desc = "Todo/Fix/Fixme" })
map("n", "<leader>m", toggleTreesj, { desc = "Toggle Treesitter Join" })
map("n", "<leader>o", "<cmd>Outline<cr>", { desc = "Toggle Outline" })
map("n", "<leader>tn", "<cmd>Boole increment<cr>", { desc = "Increase value" })
map("n", "<leader>tp", "<cmd>Boole decrement<cr>", { desc = "Decrease value" })
map("n", "<leader>X", closeAllBuffer, { desc = "Close all buffers" })
-- DAP
map("n", "<C-b>", "<cmd>DapToggleBreakpoint<cr>", { desc = "Toggle break point" })
map("n", "<C-c>", "<cmd>DapContinue<cr>", { desc = "Continue" })
map("n", "<C-x>", "<cmd>DapTerminate<cr>", { desc = "Terminate" })
map("n", "<C-o>", "<cmd>DapStepOver<cr>", { desc = "Step over" })
-- Go To Tab
for i = 1, 9, 1 do
vim.keymap.set("n", string.format("<A-%s>", i), function()
vim.api.nvim_set_current_buf(vim.t.bufs[i])
end)
end

View File

@ -1,21 +0,0 @@
local map = vim.keymap.set
local g = vim.g
if g.neovide then
-- options
g.neovide_scale_factor = 0.7
g.neovide_transparency = 0.9
g.neovide_refresh_rate = 144
-- bindings
local zoomInNeovide = function()
g.neovide_scale_factor = g.neovide_scale_factor + 0.1
end
local zoomOutNeovide = function()
g.neovide_scale_factor = g.neovide_scale_factor - 0.1
end
map("n", "<C-=>", zoomInNeovide, { desc = "Zoom In (Neovide)" })
map("n", "<C-->", zoomOutNeovide, { desc = "Zoom Out (Neovide)" })
end

View File

@ -1,7 +0,0 @@
require("nvchad.options")
local opt = vim.opt
opt.relativenumber = true
opt.scrolloff = 5
opt.guifont = "FiraCode Nerd Font:h12"

View File

@ -1,216 +0,0 @@
local overrides = require("configs.overrides")
local plugins = {
{
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
config = function()
require("configs.conform")
end,
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"williamboman/mason.nvim",
opts = overrides.mason,
},
{
"nvim-telescope/telescope.nvim",
opts = {
defaults = {
winblend = 0,
},
},
},
{
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
version = false,
build = "make",
opts = function()
return require("configs.avante")
end,
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons",
},
},
{
"Shatur/neovim-session-manager",
dependencies = {
"nvim-lua/plenary.nvim",
"stevearc/dressing.nvim",
},
event = "BufWritePost",
cmd = "SessionManager",
},
{
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
opts = function()
return require("configs.noice")
end,
},
{
"neovim/nvim-lspconfig",
config = function()
require("nvchad.configs.lspconfig").defaults()
require("configs.lspconfig")
end,
},
{
"nvimtools/none-ls.nvim",
event = "VeryLazy",
opts = function()
return require("configs.null-ls")
end,
},
{
"windwp/nvim-ts-autotag",
ft = { "javascript", "javascriptreact", "typescript", "typescriptreact" },
config = function()
require("nvim-ts-autotag").setup()
end,
},
{
"wakatime/vim-wakatime",
lazy = false,
},
{
"nvim-treesitter/nvim-treesitter-context",
event = "BufReadPost",
},
{
"Wansmer/treesj",
cmd = { "TSJToggle" },
},
{
"hedyhli/outline.nvim",
lazy = true,
cmd = { "Outline", "OutlineOpen" },
opts = {},
},
{
"folke/trouble.nvim",
cmd = { "Trouble", "TroubleToggle" },
},
{
"folke/todo-comments.nvim",
cmd = { "TodoTrouble", "TodoTelescope" },
config = true,
},
{
"folke/neodev.nvim",
event = "VeryLazy",
config = function()
require("neodev").setup({
library = {
plugins = { "nvim-dap-ui" },
types = true,
},
})
end,
},
{
"mfussenegger/nvim-dap",
config = function()
require("configs.dap")
end,
dependencies = {
"rcarriga/nvim-dap-ui",
"nvim-neotest/nvim-nio",
"theHamsta/nvim-dap-virtual-text",
},
},
{
"nat-418/boole.nvim",
event = "VeryLazy",
config = function()
require("boole").setup()
end,
},
{
"norcalli/nvim-colorizer.lua",
event = "BufReadPost",
config = function()
require("colorizer").setup()
end,
},
-- Language specific plugins
{
"pmizio/typescript-tools.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"neovim/nvim-lspconfig",
},
config = function()
require("configs.ts")
end,
ft = {
"javascript",
"typescript",
"javascriptreact",
"typescriptreact",
},
},
{
"ray-x/go.nvim",
dependencies = {
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
"mfussenegger/nvim-dap",
"rcarriga/nvim-dap-ui",
},
event = { "CmdlineEnter" },
config = function()
require("configs.go")
end,
ft = {
"go",
"gomod",
"gosum",
"gowork",
"gotmpl",
},
build = ':lua require("go.install").update_all_sync()',
},
{
"mrcjkb/rustaceanvim",
config = function()
require("configs.rust")
end,
version = "^4",
dependencies = {
"mfussenegger/nvim-dap",
"rcarriga/nvim-dap-ui",
},
ft = { "rust" },
},
{
"OXY2DEV/markview.nvim",
event = "VeryLazy",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
},
{
"ibhagwan/smartyank.nvim",
event = "VeryLazy",
config = function()
require("configs.smart-yank")
end,
},
}
return plugins