Renamed home to programs, moved definition to user level

This commit is contained in:
2025-09-22 23:35:57 +02:00
parent d3266d1c1d
commit 03aebab782
88 changed files with 236 additions and 731 deletions

View File

@@ -0,0 +1,267 @@
-- Basics
vim.g.mapleader = " "
-- Yank to system clipboard
vim.keymap.set("n", "y", '"+y', { desc = "Yank to clipboard" })
vim.keymap.set("v", "y", '"+y', { desc = "Yank to clipboard" })
vim.keymap.set("n", "Y", '"+Y', { desc = "Yank line to clipboard" })
-- Also make delete operations use system clipboard
vim.keymap.set("n", "d", '"+d', { desc = "Delete to clipboard" })
vim.keymap.set("v", "d", '"+d', { desc = "Delete to clipboard" })
vim.keymap.set("n", "D", '"+D', { desc = "Delete line to clipboard" })
-- Paste from system clipboard
vim.keymap.set("n", "p", '"+p', { desc = "Paste from clipboard" })
vim.keymap.set("v", "p", '"+p', { desc = "Paste from clipboard" })
-- Treesitter
require("nvim-treesitter.configs").setup({
ensure_installed = { "lua", "nix", "python", "javascript", "rust", "rasi" },
sync_install = false,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
parser_install_dir = vim.fn.stdpath("data") .. "/treesitter",
})
vim.opt.runtimepath:append(vim.fn.stdpath("data") .. "/treesitter")
-- Linting
require("lint").linters_by_ft = {}
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
require("lint").try_lint()
end,
})
-- Mason Setup
require("mason").setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
})
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
"nil_ls",
"rust_analyzer",
"pylsp",
},
automatic_installation = true,
})
-- LSP Config
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
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 = "luasnip" },
}, {
{ name = "buffer" },
{ name = "path" },
}),
})
local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {})
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, {})
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
-- Setup language servers
lspconfig.lua_ls.setup({
capabilities = capabilities,
settings = {
Lua = {
runtime = { version = "LuaJIT" },
diagnostics = { globals = { "vim" } },
workspace = { library = vim.api.nvim_get_runtime_file("", true) },
telemetry = { enable = false },
},
},
})
lspconfig.nil_ls.setup({ capabilities = capabilities })
lspconfig.rust_analyzer.setup({ capabilities = capabilities })
lspconfig.pylsp.setup({ capabilities = capabilities })
lspconfig.stylelint_lsp.setup({
cmd = { "stylelint-lsp", "--stdio" },
filetypes = { "css", "scss", "rasi" },
capabilities = vim.lsp.protocol.make_client_capabilities(),
})
-- Conform
require("conform").setup({
formatters_by_ft = {
lua = { "stylua" },
nix = { "nixfmt" },
python = { "black" },
rust = { "rustfmt" },
rasi = { "prettierd" },
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
})
-- Yazi
require("yazi").setup({
open_for_directories = true,
})
vim.keymap.set("n", "<leader>fy", function()
require("yazi").yazi(nil, vim.loop.cwd())
end, { desc = "Open Yazi file manager" })
vim.keymap.set("n", "<leader>fd", function()
require("yazi").yazi(nil, vim.fn.expand("%:p:h"))
end, { desc = "Open Yazi in current file directory" })
-- Telescope
require("telescope").setup()
local telescope = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", telescope.find_files, { desc = "Telescope find files" })
vim.keymap.set("n", "<leader>fg", telescope.live_grep, { desc = "Telescope live grep" })
vim.keymap.set("n", "<leader>fb", telescope.buffers, { desc = "Telescope buffers" })
vim.keymap.set("n", "<leader>fh", telescope.help_tags, { desc = "Telescope help tags" })
-- Styling
require("catppuccin").setup({
flavour = "mocha",
transparent_background = true,
term_colors = true,
integration = {
treesitter = true,
mason = true,
lsp_trouble = true,
which_key = true,
cmp = true,
gitsigns = true,
telescope = true,
nvimtree = true,
dashboard = true,
notify = true,
indent_blankline = true,
toggleterm = true, -- Important for transparent terminals
},
})
vim.cmd.colorscheme("catppuccin")
vim.opt.number = true
vim.opt.cursorline = true
vim.opt.showmode = false
vim.opt.syntax = "enable"
vim.opt.hlsearch = true
vim.opt.incsearch = true
vim.opt.tabstop = 4
vim.opt.termguicolors = true
local colors = require("catppuccin.palettes").get_palette("mocha")
vim.api.nvim_set_hl(0, "LineNr", { fg = colors.text, bg = "NONE" })
vim.api.nvim_set_hl(0, "CursorLineNr", { fg = colors.pink, bg = "NONE", bold = true })
-- ToggleTerm setup
require("toggleterm").setup({
size = 20,
open_mapping = [[<c-\>]],
direction = "float",
float_opts = {
border = "single",
width = 200,
height = 40,
},
})
vim.keymap.set("n", "<leader>h", function()
require("toggleterm").toggle(1, 10, vim.loop.cwd(), "horizontal")
end, { desc = "Toggle terminal (horizontal)" })
vim.keymap.set("n", "<leader>v", function()
require("toggleterm").toggle(2, 60, vim.loop.cwd(), "vertical")
end, { desc = "Toggle terminal (vertical)" })
vim.keymap.set("n", "<leader>ft", function()
require("toggleterm").toggle(3, 20, vim.loop.cwd(), "float")
end, { desc = "Toggle terminal (float)" })
vim.keymap.set("t", "<C-t>", "<Cmd>ToggleTerm<CR>", { desc = "Toggle terminal" })
vim.keymap.set("t", "<C-v>", "<C-\\><C-n>v", { desc = "Exit terminal and enter visual mode" })
-- Statusline
require("lualine").setup({
options = {
theme = "catppuccin",
component_separators = { left = "|", right = "|" },
section_separators = { left = "", right = "" },
},
})
-- Dashboard
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
"⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣯⣿⠿⣟⣷⣯⣛⢿⣿⣿⣾⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿",
"⣿⣿⣿⣿⣿⣿⣿⡿⣵⣿⡿⣴⣽⡟⣳⢿⢽⣽⣕⣽⢿⡿⣿⣟⣿⣿⣿⣿⣿⣿⣿",
"⣿⣿⣿⣷⣿⣿⢟⣫⣿⢟⢟⣾⣾⣿⣿⣞⢳⣻⢞⣎⠿⢞⣊⣿⣞⣿⣿⣿⣿⣿⢽",
"⣿⣿⣿⣿⣿⣏⢯⣿⣏⣏⠔⢇⣿⢢⢆⢀⢆⣧⣼⢻⢰⡧⢻⣝⣏⡸⣧⣾⣿⣿⣿",
"⣿⣿⣿⣿⡟⣻⣿⣿⡾⡿⡼⢸⡝⣝⡳⢢⣧⢳⣳⢷⡇⣗⢺⡺⣿⡧⣿⣿⣿⢿⢿",
"⣿⡿⣿⣼⡼⣿⣿⡗⡧⣧⠁⡝⣧⣳⠅⡾⠈⣎⢮⣧⣿⣿⣗⣷⣻⢷⣏⣼⢏⣺⣿",
"⣿⣿⣿⣻⣿⣿⣿⢧⣿⢹⠉⢷⢿⣧⣲⡏⡀⡈⢆⠳⣿⡿⢿⣿⣱⢿⢫⣷⣝⣿⣿",
"⣿⣿⣿⡯⡟⣿⣿⢽⣡⠟⢿⣮⠁⠙⠛⠈⡴⢿⣿⡷⣬⣽⢽⠧⣷⡏⣿⡇⣧⣽⣿",
"⣿⠟⢻⡧⡇⣿⡇⣇⣆⢄⡜⢃⡀⡀⡀⡀⡀⢎⣁⠁⣸⣗⣸⣿⣧⣼⡿⢹⢿⢾⣿",
"⣿⣷⣾⣿⢻⣿⢧⢻⣽⡀⡀⡀⡀⢄⡀⡀⡀⡀⡀⢀⣷⡸⡟⣿⣶⣻⣧⡛⡱⢝⣿",
"⣿⣿⣿⣿⢸⡿⢚⡜⣿⣇⡀⡀⡀⡀⡀⡀⡀⡀⠚⢁⢣⣜⡿⣿⡇⢼⣿⠨⣸⣿⣿",
"⣿⣄⣿⣗⢾⢻⣧⢿⣾⣿⣦⡀⡀⠑⠚⠉⡀⡀⣤⣿⢨⣿⠗⣻⢣⣿⢹⢈⣽⣿⣿",
"⣿⣿⣿⣿⢎⡄⢿⣞⡇⣿⠹⣿⣶⣀⡀⣀⡴⡩⢸⢏⣿⣿⣶⢻⣾⢏⡞⠡⢽⣇⣾",
"⣿⣿⣿⣮⣼⢬⣦⢿⣳⣌⠧⡉⠈⣇⣛⣁⣈⣼⣿⡸⠫⠛⠐⠛⠕⣙⣻⣬⣼⣿⣿",
"⢟⢿⣿⣿⣿⡢⣃⣪⣭⣡⣤⣶⠟⡿⠿⠿⠿⠛⢁⣿⣿⢩⠉⡀⠈⠓⡝⣿⣿⣿⣿",
"⣾⣿⣿⣿⣿⠞⢔⡣⡴⣾⣿⠓⣤⢧⡼⣉⠠⢤⣿⣿⠇⠃⡀⡀⡀⡀⡸⢿⣾⣿⣿",
"⣿⣿⣿⡿⣺⡸⢗⢠⣇⣿⣿⠊⠃⡀⠉⡀⢠⣿⣿⠟⡸⡀⡀⡀⡀⡀⣃⣬⠽⠿⣿",
"⣿⣿⣿⣿⡇⡏⢸⣿⠟⣽⡇⡀⡀⡀⡀⣴⣟⢭⣾⣿⡇⠎⣠⠒⠉⠈⢀⡀⢨⡋⣿",
"⠛⠛⠛⠋⠃⠓⠚⠛⠘⠛⠃⡀⠊⡀⠛⠛⠛⠂⠛⠛⠓⠁⠚⡀⠂⠒⠒⠐⠒⠋⠛",
}
dashboard.section.buttons.val = {
dashboard.button("e", "[+] New file", ":ene <BAR> startinsert <CR>"),
dashboard.button("f", "[?] Find file", ":Telescope find_files <CR>"),
dashboard.button("r", "[~] Recent files", ":Telescope oldfiles <CR>"),
dashboard.button("y", "[Y] Yazi", ":Yazi<CR>"),
dashboard.button("m", "[M] Mason", ":Mason<CR>"),
dashboard.button("q", "[X] Quit", ":qa<CR>"),
}
dashboard.section.footer.val = "Circuits hum in anticipation of your will."
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
if vim.fn.argc() == 0 then
require("alpha").start()
end
end,
})
alpha.setup(dashboard.config)

View File

@@ -0,0 +1,83 @@
{ pkgs, ... }:
{
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
defaultEditor = true;
#extraPackages = with pkgs; [ ];
plugins = with pkgs.vimPlugins; [
nvim-treesitter
nvim-lint
catppuccin-nvim
mason-nvim
mason-lspconfig-nvim
nvim-lspconfig
nvim-cmp
cmp-nvim-lsp
cmp-buffer
cmp-path
cmp-cmdline
luasnip
lualine-nvim
yazi-nvim
alpha-nvim
cheatsheet-nvim
toggleterm-nvim
# AI Stuff
avante-nvim
plenary-nvim
nui-nvim
dressing-nvim
nvim-web-devicons
img-clip-nvim
render-markdown-nvim
# Add conform.nvim as a custom plugin
(pkgs.vimUtils.buildVimPlugin {
name = "conform-nvim";
src = pkgs.fetchFromGitHub {
owner = "stevearc";
repo = "conform.nvim";
rev = "stable";
sha256 = "sha256-pUF9F5QoDzCZuVRcJEF91M8Qjkh/xosMkf9tRavkmJs=";
};
})
# Add telescope.vim as a custom plugin
(pkgs.vimUtils.buildVimPlugin {
name = "telescope-nvim";
src = pkgs.fetchFromGitHub {
owner = "nvim-telescope";
repo = "telescope.nvim";
rev = "0.1.8";
sha256 = "sha256-e1ulhc4IIvUgpjKQrSqPY4WpXuez6wlxL6Min9U0o5Q=";
};
})
];
extraLuaConfig = builtins.readFile (./. + "/config.lua");
};
home.packages = with pkgs; [
nixfmt-rfc-style
stylua
black
nodePackages.prettier
rustfmt
nodejs
prettierd
stylelint-lsp
# Mason Binarys
lua-language-server
nil
rust-analyzer
python3Packages.python-lsp-server
# Avante
curl
cargo
];
}

View File

@@ -0,0 +1,331 @@
{ pkgs, ... }:
{
programs.nixvim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
# ===================
# Basic Options
# ===================
options = {
number = true;
cursorline = true;
showmode = false;
syntax = "enable";
hlsearch = true;
incsearch = true;
tabstop = 4;
termguicolors = true;
};
globals.mapleader = " ";
keymaps = [
# Clipboard
{
mode = "n";
key = "y";
action = "\"+y";
options.desc = "Yank to clipboard";
}
{
mode = "v";
key = "y";
action = "\"+y";
options.desc = "Yank to clipboard";
}
{
mode = "n";
key = "Y";
action = "\"+Y";
options.desc = "Yank line to clipboard";
}
{
mode = "n";
key = "d";
action = "\"+d";
options.desc = "Delete to clipboard";
}
{
mode = "v";
key = "d";
action = "\"+d";
options.desc = "Delete to clipboard";
}
{
mode = "n";
key = "D";
action = "\"+D";
options.desc = "Delete line to clipboard";
}
{
mode = "n";
key = "p";
action = "\"+p";
options.desc = "Paste from clipboard";
}
{
mode = "v";
key = "p";
action = "\"+p";
options.desc = "Paste from clipboard";
}
];
# ===================
# Plugins
# ===================
plugins = {
# Treesitter
treesitter = {
enable = true;
ensureInstalled = [
"lua"
"nix"
"python"
"javascript"
"rust"
"rasi"
];
};
# Lint
lint.enable = true;
# Mason + LSP
mason.enable = true;
mason-lspconfig = {
enable = true;
ensureInstalled = [
"lua_ls"
"nil_ls"
"rust_analyzer"
"pylsp"
"stylelint_lsp"
];
};
lsp = {
enable = true;
servers = {
lua_ls.settings.Lua = {
runtime.version = "LuaJIT";
diagnostics.globals = [ "vim" ];
telemetry.enable = false;
};
nil_ls.enable = true;
rust_analyzer.enable = true;
pylsp.enable = true;
stylelint_lsp = {
enable = true;
filetypes = [
"css"
"scss"
"rasi"
];
cmd = [
"stylelint-lsp"
"--stdio"
];
};
};
keymaps.lspBuf = {
gd = "definition";
K = "hover";
"<leader>rn" = "rename";
"<leader>ca" = "code_action";
};
};
# Completion
cmp = {
enable = true;
sources = [
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
{ name = "avante_commands"; }
{ name = "avante_mentions"; }
{ name = "buffer"; }
{ name = "path"; }
];
};
luasnip.enable = true;
# Conform
conform-nvim = {
enable = true;
formattersByFt = {
lua = [ "stylua" ];
nix = [ "nixfmt" ];
python = [ "black" ];
rust = [ "rustfmt" ];
rasi = [ "prettierd" ];
};
formatOnSave = {
timeoutMs = 500;
lspFallback = true;
};
};
# Telescope
telescope = {
enable = true;
keymaps = {
"<leader>ff" = "find_files";
"<leader>fg" = "live_grep";
"<leader>fb" = "buffers";
"<leader>fh" = "help_tags";
};
};
# Toggleterm
toggleterm = {
enable = true;
settings = {
size = 20;
direction = "float";
float_opts = {
border = "single";
width = 200;
height = 40;
};
};
};
# Statusline
lualine = {
enable = true;
settings.options = {
theme = "catppuccin";
component_separators = {
left = "|";
right = "|";
};
section_separators = {
left = "";
right = "";
};
};
};
# Dashboard (alpha)
alpha = {
enable = true;
theme = "dashboard";
layout.dashboard = {
section.header.val = [
"⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣯⣿⠿⣟⣷⣯⣛⢿⣿⣿⣾⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿"
"⣿⣿⣿⣿⣿⣿⣿⡿⣵⣿⡿⣴⣽⡟⣳⢿⢽⣽⣕⣽⢿⡿⣿⣟⣿⣿⣿⣿⣿⣿⣿"
"⣿⣿⣿⣷⣿⣿⢟⣫⣿⢟⢟⣾⣾⣿⣿⣞⢳⣻⢞⣎⠿⢞⣊⣿⣞⣿⣿⣿⣿⣿⢽"
"⣿⣿⣿⣿⣿⣏⢯⣿⣏⣏⠔⢇⣿⢢⢆⢀⢆⣧⣼⢻⢰⡧⢻⣝⣏⡸⣧⣾⣿⣿⣿"
"⣿⣿⣿⣿⡟⣻⣿⣿⡾⡿⡼⢸⡝⣝⡳⢢⣧⢳⣳⢷⡇⣗⢺⡺⣿⡧⣿⣿⣿⢿⢿"
"⣿⡿⣿⣼⡼⣿⣿⡗⡧⣧⠁⡝⣧⣳⠅⡾⠈⣎⢮⣧⣿⣿⣗⣷⣻⢷⣏⣼⢏⣺⣿"
"⣿⣿⣿⣻⣿⣿⣿⢧⣿⢹⠉⢷⢿⣧⣲⡏⡀⡈⢆⠳⣿⡿⢿⣿⣱⢿⢫⣷⣝⣿⣿"
"⣿⣿⣿⡯⡟⣿⣿⢽⣡⠟⢿⣮⠁⠙⠛⠈⡴⢿⣿⡷⣬⣽⢽⠧⣷⡏⣿⡇⣧⣽⣿"
"⣿⠟⢻⡧⡇⣿⡇⣇⣆⢄⡜⢃⡀⡀⡀⡀⡀⢎⣁⠁⣸⣗⣸⣿⣧⣼⡿⢹⢿⢾⣿"
"⣿⣷⣾⣿⢻⣿⢧⢻⣽⡀⡀⡀⡀⢄⡀⡀⡀⡀⡀⢀⣷⡸⡟⣿⣶⣻⣧⡛⡱⢝⣿"
"⣿⣿⣿⣿⢸⡿⢚⡜⣿⣇⡀⡀⡀⡀⡀⡀⡀⡀⠚⢁⢣⣜⡿⣿⡇⢼⣿⠨⣸⣿⣿"
"⣿⣄⣿⣗⢾⢻⣧⢿⣾⣿⣦⡀⡀⠑⠚⠉⡀⡀⣤⣿⢨⣿⠗⣻⢣⣿⢹⢈⣽⣿⣿"
"⣿⣿⣿⣿⢎⡄⢿⣞⡇⣿⠹⣿⣶⣀⡀⣀⡴⡩⢸⢏⣿⣿⣶⢻⣾⢏⡞⠡⢽⣇⣾"
"⣿⣿⣿⣮⣼⢬⣦⢿⣳⣌⠧⡉⠈⣇⣛⣁⣈⣼⣿⡸⠫⠛⠐⠛⠕⣙⣻⣬⣼⣿⣿"
"⢟⢿⣿⣿⣿⡢⣃⣪⣭⣡⣤⣶⠟⡿⠿⠿⠿⠛⢁⣿⣿⢩⠉⡀⠈⠓⡝⣿⣿⣿⣿"
"⣾⣿⣿⣿⣿⠞⢔⡣⡴⣾⣿⠓⣤⢧⡼⣉⠠⢤⣿⣿⠇⠃⡀⡀⡀⡀⡸⢿⣾⣿⣿"
"⣿⣿⣿⡿⣺⡸⢗⢠⣇⣿⣿⠊⠃⡀⠉⡀⢠⣿⣿⠟⡸⡀⡀⡀⡀⡀⣃⣬⠽⠿⣿"
"⣿⣿⣿⣿⡇⡏⢸⣿⠟⣽⡇⡀⡀⡀⡀⣴⣟⢭⣾⣿⡇⠎⣠⠒⠉⠈⢀⡀⢨⡋⣿"
"⠛⠛⠛⠋⠃⠓⠚⠛⠘⠛⠃⡀⠊⡀⠛⠛⠛⠂⠛⠛⠓⠁⠚⡀⠂⠒⠒⠐⠒⠋⠛"
];
section.buttons.val = [
{
shortcut = "e";
text = "[+] New file";
command = ":ene <BAR> startinsert <CR>";
}
{
shortcut = "f";
text = "[?] Find file";
command = ":Telescope find_files <CR>";
}
{
shortcut = "r";
text = "[~] Recent files";
command = ":Telescope oldfiles <CR>";
}
{
shortcut = "y";
text = "[Y] Yazi";
command = ":Yazi<CR>";
}
{
shortcut = "m";
text = "[M] Mason";
command = ":Mason<CR>";
}
{
shortcut = "q";
text = "[X] Quit";
command = ":qa<CR>";
}
];
section.footer.val = "Circuits hum in anticipation of your will.";
};
};
# Colorscheme
catppuccin = {
enable = true;
flavour = "mocha";
transparentBackground = true;
integrations = {
treesitter = true;
mason = true;
cmp = true;
telescope = true;
toggleterm = true;
};
};
};
# ===================
# Plugins not in nixvim
# ===================
extraPlugins = with pkgs.vimPlugins; [
yazi-nvim
cheatsheet-nvim
avante-nvim
plenary-nvim
nui-nvim
dressing-nvim
nvim-web-devicons
img-clip-nvim
render-markdown-nvim
(pkgs.vimUtils.buildVimPlugin {
name = "conform-nvim";
src = pkgs.fetchFromGitHub {
owner = "stevearc";
repo = "conform.nvim";
rev = "stable";
sha256 = "sha256-pUF9F5QoDzCZuVRcJEF91M8Qjkh/xosMkf9tRavkmJs=";
};
})
];
};
home.packages = with pkgs; [
nixfmt-rfc-style
stylua
black
nodePackages.prettier
rustfmt
nodejs
prettierd
stylelint-lsp
lua-language-server
nil
rust-analyzer
python3Packages.python-lsp-server
curl
cargo
];
}