From a2c3a2b9c765e542e3a69c09ce04d22651729d26 Mon Sep 17 00:00:00 2001 From: Alejandro Laguna Date: Fri, 9 Oct 2026 12:05:45 +0200 Subject: [PATCH] feat: init dotfiles --- ghostty/config | 37 +++++ nvim/init.lua | 13 ++ nvim/lazy-lock.json | 40 +++++ nvim/lua/autocmds.lua | 39 +++++ nvim/lua/keymaps.lua | 16 ++ nvim/lua/notes.lua | 1 + nvim/lua/options.lua | 55 +++++++ nvim/lua/plugins.lua | 86 ++++++++++ nvim/lua/plugins/cmp.lua | 67 ++++++++ nvim/lua/plugins/colorscheme.lua | 3 + nvim/lua/plugins/conform.lua | 35 ++++ nvim/lua/plugins/gitsigns.lua | 13 ++ nvim/lua/plugins/latex.lua | 13 ++ nvim/lua/plugins/lazydev.lua | 9 ++ nvim/lua/plugins/lsp.lua | 251 +++++++++++++++++++++++++++++ nvim/lua/plugins/obsidian.lua | 15 ++ nvim/lua/plugins/presence.lua | 131 +++++++++++++++ nvim/lua/plugins/startup.lua | 0 nvim/lua/plugins/supermaven.lua | 20 +++ nvim/lua/plugins/telescope.lua | 59 +++++++ nvim/lua/plugins/todo_comments.lua | 6 + nvim/lua/plugins/treesitter.lua | 47 ++++++ nvim/lua/plugins/vimwiki.lua | 8 + nvim/lua/plugins/which_key.lua | 49 ++++++ nvim/lua/plugins/zig-lamp.lua | 24 +++ 25 files changed, 1037 insertions(+) create mode 100644 ghostty/config create mode 100644 nvim/init.lua create mode 100644 nvim/lazy-lock.json create mode 100644 nvim/lua/autocmds.lua create mode 100644 nvim/lua/keymaps.lua create mode 100644 nvim/lua/notes.lua create mode 100644 nvim/lua/options.lua create mode 100644 nvim/lua/plugins.lua create mode 100644 nvim/lua/plugins/cmp.lua create mode 100644 nvim/lua/plugins/colorscheme.lua create mode 100644 nvim/lua/plugins/conform.lua create mode 100644 nvim/lua/plugins/gitsigns.lua create mode 100644 nvim/lua/plugins/latex.lua create mode 100644 nvim/lua/plugins/lazydev.lua create mode 100644 nvim/lua/plugins/lsp.lua create mode 100644 nvim/lua/plugins/obsidian.lua create mode 100644 nvim/lua/plugins/presence.lua create mode 100644 nvim/lua/plugins/startup.lua create mode 100644 nvim/lua/plugins/supermaven.lua create mode 100644 nvim/lua/plugins/telescope.lua create mode 100644 nvim/lua/plugins/todo_comments.lua create mode 100644 nvim/lua/plugins/treesitter.lua create mode 100644 nvim/lua/plugins/vimwiki.lua create mode 100644 nvim/lua/plugins/which_key.lua create mode 100644 nvim/lua/plugins/zig-lamp.lua diff --git a/ghostty/config b/ghostty/config new file mode 100644 index 0000000000000000000000000000000000000000..4c72101aab509323415d50623f3712d224c53cde --- /dev/null +++ b/ghostty/config @@ -0,0 +1,37 @@ +font-family = MonoLisa +font-size = 11 +font-variation = wght=500 + +font-feature = -calt,-liga,-dlig + +window-padding-x = 5 +window-padding-y = 5 + +bell-features = no-audio + +foreground = #d8d8d8 +background = #171717 + +palette = 0=#606060 +palette = 1=#df9a98 +palette = 2=#719672 +palette = 3=#e0bb71 +palette = 4=#96bbdc +palette = 5=#dfbdbc +palette = 6=#97bcbc +palette = 7=#d8d8d8 +palette = 8=#757575 +palette = 9=#e07798 +palette = 10=#97bb98 +palette = 11=#ffdd98 +palette = 12=#badcfb +palette = 13=#ffbebc +palette = 14=#96ddde +palette = 15=#e9e9e9 + +cursor-color = #d8d8d8 +cursor-text = #4a4a4a + +cursor-style = block +cursor-style-blink = true +shell-integration-features = no-cursor diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000000000000000000000000000000000000..207191141f03cc9b5ec3168dedb85a7960730381 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,13 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = " " +vim.g.have_nerd_font = false + +require("options") +require("keymaps") +require("autocmds") +require("plugins") +require("notes") + +--vim.cmd.colorscheme("nordbones") +vim.g.seoul256_background = 233 +vim.cmd.colorscheme("seoul256") diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..165668534f8462f195a68d2b72858a3496963617 --- /dev/null +++ b/nvim/lazy-lock.json @@ -0,0 +1,40 @@ +{ + "LuaSnip": { "branch": "master", "commit": "0abc8f390b278c3b4aabc4c004ac8a088b65cf24" }, + "beside.nvim": { "branch": "main", "commit": "ce2f889718f13b22eb8cdeb6738a74f7bbea06a4" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" }, + "cord": { "branch": "master", "commit": "85f295e43550bc968b66d95d8bfd6e12bb17df08" }, + "fidget.nvim": { "branch": "main", "commit": "9e0201673e08e997e7cf52afca5565c70bd117f3" }, + "gitsigns.nvim": { "branch": "main", "commit": "070a5d7b985546cc57e1fc61e5bc507fecac6045" }, + "julia-vim": { "branch": "master", "commit": "52b30547346b21bc93acda28d626795667f9e087" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" }, + "luvit-meta": { "branch": "main", "commit": "7edcd52ac6f2acc2f83f0cc27ac989a142408fbf" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "b3298993d55fa194279b5eb9dbfb3a43da65cadf" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" }, + "mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" }, + "nvim-cmp": { "branch": "main", "commit": "2ffe79f1f021def8dd1fcd81deb16f1bb0d989f3" }, + "nvim-lspconfig": { "branch": "master", "commit": "a9bb4d5f4276aa5cddc015faa3ecc5a7b5a26b14" }, + "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, + "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, + "screenkey.nvim": { "branch": "main", "commit": "16390931d847b1d5d77098daccac4e55654ac9e2" }, + "seoul256.vim": { "branch": "master", "commit": "0357ff3e44faab66c98bc98dfc89c834e37012da" }, + "supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" }, + "tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "b25b749b9db64d375d782094e2b9dce53ad53a40" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "transparent.nvim": { "branch": "main", "commit": "e00ca1cf09caef575edf8da7e5a8b9193893b4c7" }, + "vim-blade": { "branch": "master", "commit": "9534101808cc320eef003129a40cab04b026a20c" }, + "vim-markdown": { "branch": "master", "commit": "1bc9d0cd8e1cc3e901b0a49c2b50a843f1c89397" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "vim-table-mode": { "branch": "master", "commit": "bb025308a45c67c7c8f0763ba37bc2ee3f534df0" }, + "vimtex": { "branch": "master", "commit": "16a5609d17a436db7f48046d91747fd6a9d75c74" }, + "vimwiki": { "branch": "dev", "commit": "a54a3002e229c4b43d69ced170ff77663a5b2c40" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }, + "zen-mode.nvim": { "branch": "main", "commit": "8564ce6d29ec7554eb9df578efa882d33b3c23a7" }, + "zig-lamp": { "branch": "main", "commit": "0654299f5150b2a420212e34f86a96c7dbae31e2" } +} diff --git a/nvim/lua/autocmds.lua b/nvim/lua/autocmds.lua new file mode 100644 index 0000000000000000000000000000000000000000..dcf32182bf9b8b6910b2335bb1d51fbf6803c07d --- /dev/null +++ b/nvim/lua/autocmds.lua @@ -0,0 +1,39 @@ +vim.api.nvim_create_autocmd("TextYankPost", { + desc = "Highlight when yanking (copying) text", + group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) + +-- Forcefully stop treesitter for markdown to prevent crashes +vim.api.nvim_create_autocmd("FileType", { + pattern = { "markdown" }, + callback = function(args) + pcall(vim.treesitter.stop, args.buf) + end, +}) + +--local function pdf_of(file) +-- return vim.fn.fnamemodify(file, ":r") .. ".pdf" +--end +-- +--vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, { +-- pattern = "*.typ", +-- callback = function() +-- local file = vim.fn.expand("%:p") +-- local pdf = pdf_of(file) +-- +-- vim.fn.jobstart({ +-- "typst", +-- "compile", +-- file, +-- pdf, +-- }, { detach = true }) +-- +-- vim.fn.jobstart({ +-- "sioyek", +-- pdf, +-- }, { detach = true }) +-- end, +--}) diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua new file mode 100644 index 0000000000000000000000000000000000000000..f209991cd936037889ab44c65483c1af61670a04 --- /dev/null +++ b/nvim/lua/keymaps.lua @@ -0,0 +1,16 @@ +vim.keymap.set("n", "", "nohlsearch") +vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) + +vim.keymap.set("n", "cd", ":cd %:h") + +vim.keymap.set("t", "", "", { desc = "Exit terminal mode" }) + +vim.keymap.set("n", "", 'echo "Use h to move!!"') +vim.keymap.set("n", "", 'echo "Use l to move!!"') +vim.keymap.set("n", "", 'echo "Use k to move!!"') +vim.keymap.set("n", "", 'echo "Use j to move!!"') + +vim.keymap.set("n", "", "", { desc = "Move focus to the left window" }) +vim.keymap.set("n", "", "", { desc = "Move focus to the right window" }) +vim.keymap.set("n", "", "", { desc = "Move focus to the lower window" }) +vim.keymap.set("n", "", "", { desc = "Move focus to the upper window" }) diff --git a/nvim/lua/notes.lua b/nvim/lua/notes.lua new file mode 100644 index 0000000000000000000000000000000000000000..83bdbc0d2591ae37621a15bebbb89cf91e805a30 --- /dev/null +++ b/nvim/lua/notes.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "zz", ":ZenMode") diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua new file mode 100644 index 0000000000000000000000000000000000000000..c787eb1a89dc428d588f9af47b9718b11fab57cb --- /dev/null +++ b/nvim/lua/options.lua @@ -0,0 +1,55 @@ +vim.opt.termguicolors = true +vim.opt.colorcolumn = "100" +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.mouse = "a" +vim.opt.showmode = false +vim.opt.guicursor = "n-v-i-c:block-Cursor" +vim.opt.signcolumn = "yes" +vim.opt.cursorline = true +vim.opt.scrolloff = 10 + +vim.api.nvim_set_hl(0, "Comment", { italic = true }) + +vim.schedule(function() + vim.opt.clipboard = "unnamedplus" +end) + +vim.opt.breakindent = true +vim.opt.undofile = true +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.updatetime = 250 +vim.opt.timeoutlen = 300 + +vim.opt.splitright = true +vim.opt.splitbelow = true + +vim.opt.list = true +vim.opt.listchars = { tab = "ยป ", trail = "ยท", nbsp = "โฃ" } +vim.opt.inccommand = "split" + +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.diagnostic.config({ + signs = true, + virtual_text = true, + update_in_insert = false, + severity_sort = true, +}) + +vim.opt.conceallevel = 1 + +-- Failsafe: Completely block treesitter from starting on markdown +-- This prevents crashes in Neovim 0.12+ hovers/files +local original_ts_start = vim.treesitter.start +vim.treesitter.start = function(bufnr, lang) + local buf = bufnr or vim.api.nvim_get_current_buf() + local ft = lang or vim.bo[buf].filetype + if ft == "markdown" or ft == "markdown_inline" then + return false + end + return original_ts_start(bufnr, lang) +end diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua new file mode 100644 index 0000000000000000000000000000000000000000..a4fd7b1b1da8a7bcaada4c5b4f5ed539a554c0dc --- /dev/null +++ b/nvim/lua/plugins.lua @@ -0,0 +1,86 @@ +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 + error("Error cloning lazy.nvim:\n" .. out) + end +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + "tpope/vim-sleuth", + -- Lua + { + "folke/zen-mode.nvim", + opts = { + window = { + width = 100, -- width of the Zen window + }, + }, + }, + + { + "preservim/vim-markdown", + dependencies = { "godlygeek/tabular" }, + init = function() + vim.g.vim_markdown_folding_disabled = 1 + vim.g.vim_markdown_no_default_key_mappings = 1 + end, + }, + "dhruvasagar/vim-table-mode", + "xiyaowong/transparent.nvim", + "jwalton512/vim-blade", + "Bilal2453/luvit-meta", + "JuliaEditorSupport/julia-vim", + -- { + -- "norcalli/nvim-colorizer.lua", + -- config = function() + -- require("colorizer").setup({ + -- "*", + -- css = { rgb_fn = true }, + -- html = { mode = "foreground" }, + -- }) + -- end, + -- }, + { + "NStefan002/screenkey.nvim", + lazy = false, + version = "*", -- or branch = "main", to use the latest commit + }, + { import = "plugins.presence" }, + { import = "plugins.gitsigns" }, + { import = "plugins.which_key" }, + { import = "plugins.telescope" }, + { import = "plugins.lazydev" }, + { import = "plugins.lsp" }, + { import = "plugins.conform" }, + { import = "plugins.cmp" }, + { import = "plugins.colorscheme" }, + { import = "plugins.todo_comments" }, + { import = "plugins.treesitter" }, + { import = "plugins.latex" }, + { import = "plugins.zig-lamp" }, + { import = "plugins.vimwiki" }, + { import = "plugins.supermaven" }, + -- { import = "plugins.obsidian" }, +}, { + ui = { + icons = vim.g.have_nerd_font and {} or { + cmd = "โŒ˜", + config = "๐Ÿ› ", + event = "๐Ÿ“…", + ft = "๐Ÿ“‚", + init = "โš™", + keys = "๐Ÿ—", + plugin = "๐Ÿ”Œ", + runtime = "๐Ÿ’ป", + require = "๐ŸŒ™", + source = "๐Ÿ“„", + start = "๐Ÿš€", + task = "๐Ÿ“Œ", + lazy = "๐Ÿ’ค ", + }, + }, +}) diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000000000000000000000000000000000000..d6de47b8c7f94aa94731c076d6aa40415da453b7 --- /dev/null +++ b/nvim/lua/plugins/cmp.lua @@ -0,0 +1,67 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + + dependencies = { + { + "L3MON4D3/LuaSnip", + build = (function() + if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then + return + end + return "make install_jsregexp" + end)(), + }, + + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", + }, + + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + + luasnip.config.setup({}) + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + + completion = { + completeopt = "menu,menuone,noinsert", + }, + + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete({}), + + [""] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { "i", "s" }), + }), + + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + { name = "buffer" }, + }, + }) + end, +} diff --git a/nvim/lua/plugins/colorscheme.lua b/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000000000000000000000000000000000000..1dfef795181c4126e9ea85b8cf173e8a6df8e445 --- /dev/null +++ b/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,3 @@ +return { + "junegunn/seoul256.vim", +} diff --git a/nvim/lua/plugins/conform.lua b/nvim/lua/plugins/conform.lua new file mode 100644 index 0000000000000000000000000000000000000000..27aa42eba0200c090ff5b17b8dc5923c3c690922 --- /dev/null +++ b/nvim/lua/plugins/conform.lua @@ -0,0 +1,35 @@ +return { + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + keys = { + { + "f", + function() + require("conform").format({ async = true, lsp_format = "fallback" }) + end, + mode = "", + desc = "[F]ormat buffer", + }, + }, + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + local disable_filetypes = { c = true, cpp = true } + local lsp_format_opt + if disable_filetypes[vim.bo[bufnr].filetype] then + lsp_format_opt = "never" + else + lsp_format_opt = "fallback" + end + return { + timeout_ms = 500, + lsp_format = lsp_format_opt, + } + end, + formatters_by_ft = { + lua = { "stylua" }, + haskell = { "fourmolu" }, + }, + }, +} diff --git a/nvim/lua/plugins/gitsigns.lua b/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000000000000000000000000000000000000..821bf98d4a2f407cd78f18860c37b94b823533e8 --- /dev/null +++ b/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,13 @@ +return { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "_" }, + topdelete = { text = "โ€พ" }, + changedelete = { text = "~" }, + }, + current_line_blame = true, + }, +} diff --git a/nvim/lua/plugins/latex.lua b/nvim/lua/plugins/latex.lua new file mode 100644 index 0000000000000000000000000000000000000000..f8c85e218496543e5cd4a7c51c8b0952de5310ac --- /dev/null +++ b/nvim/lua/plugins/latex.lua @@ -0,0 +1,13 @@ +return { + { + "lervag/vimtex", + ft = { "tex", "bib" }, + init = function() + vim.g.vimtex_view_method = "zathura" + vim.g.vimtex_compiler_method = "latexmk" + vim.g.vimtex_compiler_latexmk = { + options = { "-pdf", "-interaction=nonstopmode", "-synctex=1" }, + } + end, + }, +} diff --git a/nvim/lua/plugins/lazydev.lua b/nvim/lua/plugins/lazydev.lua new file mode 100644 index 0000000000000000000000000000000000000000..c2168758389fef1739fccd2c7285040d72884701 --- /dev/null +++ b/nvim/lua/plugins/lazydev.lua @@ -0,0 +1,9 @@ +return { + "folke/lazydev.nvim", + ft = "lua", + opts = { + library = { + { path = "luvit-meta/library", words = { "vim%.uv" } }, + }, + }, +} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000000000000000000000000000000000000..c77fa71aa1c40b6925ba53c7cbde1c26ba877564 --- /dev/null +++ b/nvim/lua/plugins/lsp.lua @@ -0,0 +1,251 @@ +return { + "neovim/nvim-lspconfig", + + dependencies = { + { "williamboman/mason.nvim", config = true }, + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + { "j-hui/fidget.nvim", opts = {} }, + "hrsh7th/cmp-nvim-lsp", + }, + + config = function() + ---------------------------------------------------------------------- + -- LSP Attach + ---------------------------------------------------------------------- + + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), + + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or "n" + + vim.keymap.set(mode, keys, func, { + buffer = event.buf, + desc = "LSP: " .. desc, + }) + end + + ------------------------------------------------------------------ + -- Keymaps + ------------------------------------------------------------------ + + map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition") + map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences") + map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation") + map("D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition") + map("ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols") + map("ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols") + + map("rn", vim.lsp.buf.rename, "[R]e[n]ame") + map("ca", vim.lsp.buf.code_action, "[C]ode [A]ction", { "n", "x" }) + + map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") + + ------------------------------------------------------------------ + -- Client + ------------------------------------------------------------------ + + local client = vim.lsp.get_client_by_id(event.data.client_id) + + ------------------------------------------------------------------ + -- Document Highlight + ------------------------------------------------------------------ + + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then + local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false }) + + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd("LspDetach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }), + + callback = function(event2) + vim.lsp.buf.clear_references() + + vim.api.nvim_clear_autocmds({ + group = "kickstart-lsp-highlight", + buffer = event2.buf, + }) + end, + }) + end + + ------------------------------------------------------------------ + -- Inlay Hints + ------------------------------------------------------------------ + + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then + map("th", function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })) + end, "[T]oggle Inlay [H]ints") + end + end, + }) + + ---------------------------------------------------------------------- + -- Capabilities + ---------------------------------------------------------------------- + + local capabilities = vim.lsp.protocol.make_client_capabilities() + + capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities()) + + ---------------------------------------------------------------------- + -- Servers + ---------------------------------------------------------------------- + + local servers = { + lua_ls = { + settings = { + Lua = { + completion = { + callSnippet = "Replace", + }, + }, + }, + }, + + texlab = { + settings = { + texlab = { + build = { + executable = "latexmk", + args = { + "-pdf", + "-interaction=nonstopmode", + "-synctex=1", + "%f", + }, + onSave = true, + }, + + forwardSearch = { + executable = "zathura", + args = { + "--synctex-forward", + "%l:1:%f", + "%p", + }, + }, + + chktex = { + onOpenAndSave = true, + onEdit = false, + }, + }, + }, + }, + + zls = { + settings = { + zls = { + zig_exe_path = "/usr/bin/zig", + }, + }, + }, + + hls = { + filetypes = { + "haskell", + "lhaskell", + "cabal", + }, + + settings = { + haskell = { + checkProject = true, + diagnosticsOnChange = true, + completionSnippetsOn = true, + maxCompletions = 40, + }, + }, + }, + } + + ---------------------------------------------------------------------- + -- Mason + ---------------------------------------------------------------------- + + require("mason").setup() + + -- Mason names for servers in the `servers` table + local server_to_mason = { + lua_ls = "lua-language-server", + texlab = "texlab", + zls = "zls", + hls = "haskell-language-server", + } + + local ensure_installed = {} + for server_name, _ in pairs(servers) do + table.insert(ensure_installed, server_to_mason[server_name] or server_name) + end + + vim.list_extend(ensure_installed, { + "stylua", + "fourmolu", + }) + + require("mason-tool-installer").setup({ + ensure_installed = ensure_installed, + }) + + ---------------------------------------------------------------------- + -- Mason LSPConfig + ---------------------------------------------------------------------- + + require("mason-lspconfig").setup({ + handlers = { + -- Skip julials here as it is handled manually + ["julials"] = function() end, + + -- Default handler for all other servers + function(server_name) + local server_opts = servers[server_name] or {} + + -- Merge capabilities + server_opts.capabilities = + vim.tbl_deep_extend("force", {}, capabilities, server_opts.capabilities or {}) + + -- Use new Neovim 0.11+ APIs: + -- config() defines/extends the configuration + -- enable() starts/attaches based on filetype and root detection + vim.lsp.config(server_name, server_opts) + vim.lsp.enable(server_name) + end, + }, + }) + + ---------------------------------------------------------------------- + -- Julia + ---------------------------------------------------------------------- + + vim.lsp.config("julials", { + cmd = { + "julia", + "--startup-file=no", + "--history-file=no", + "-e", + "using LanguageServer, SymbolServer; runserver()", + }, + + filetypes = { "julia" }, + + capabilities = capabilities, + }) + + vim.lsp.enable("julials") + end, +} diff --git a/nvim/lua/plugins/obsidian.lua b/nvim/lua/plugins/obsidian.lua new file mode 100644 index 0000000000000000000000000000000000000000..0b1b69f90f4d2db4765d5fbe44f4b2f11216650c --- /dev/null +++ b/nvim/lua/plugins/obsidian.lua @@ -0,0 +1,15 @@ +return { + "obsidian-nvim/obsidian.nvim", + version = "*", -- use latest release, remove to use latest commit + ---@module 'obsidian' + ---@type obsidian.config + opts = { + legacy_commands = false, -- this will be removed in 4.0.0 + workspaces = { + { + name = "personal", + path = "~/personal/vault", + }, + }, + }, +} diff --git a/nvim/lua/plugins/presence.lua b/nvim/lua/plugins/presence.lua new file mode 100644 index 0000000000000000000000000000000000000000..c2a52eb2a172967e7ad9042c3f9ae686690a0fa9 --- /dev/null +++ b/nvim/lua/plugins/presence.lua @@ -0,0 +1,131 @@ +return { + "vyfor/cord.nvim", + name = "cord", + config = function() + require("cord").setup({ + enabled = true, + log_level = vim.log.levels.OFF, + editor = { + client = "neovim", + tooltip = "neovim", + icon = nil, + }, + display = { + theme = "atom", + flavor = "accent", + swap_fields = false, + swap_icons = false, + }, + timestamp = { + enabled = true, + reset_on_idle = false, + reset_on_change = false, + }, + idle = { + enabled = false, + timeout = 300000, + show_status = true, + ignore_focus = true, + unidle_on_focus = true, + smart_idle = true, + details = "Idling", + state = nil, + tooltip = "๐Ÿ’ค", + icon = nil, + }, + text = { + default = nil, + workspace = function(opts) + return "in " .. opts.workspace + end, + viewing = function(opts) + return "viewing " .. opts.filename + end, + editing = function(opts) + return "editing " .. opts.filename + end, + file_browser = function(opts) + return "browsing files in " .. opts.name + end, + plugin_manager = function(opts) + return "managing plugins in " .. opts.name + end, + lsp = function(opts) + return "configuring LSP in " .. opts.name + end, + docs = function(opts) + return "reading " .. opts.name + end, + vcs = function(opts) + return "committing changes in " .. opts.name + end, + notes = function(opts) + return "taking notes in " .. opts.name + end, + debug = function(opts) + return "debugging in " .. opts.name + end, + test = function(opts) + return "testing in " .. opts.name + end, + diagnostics = function(opts) + return "fixing problems in " .. opts.name + end, + games = function(opts) + return "playing " .. opts.name + end, + terminal = function(opts) + return "running commands in " .. opts.name + end, + dashboard = "home", + }, + buttons = nil, + -- buttons = { + -- { + -- label = 'View Repository', + -- url = function(opts) return opts.repo_url end, + -- }, + -- }, + assets = nil, + variables = nil, + hooks = { + ready = nil, + shutdown = nil, + pre_activity = nil, + post_activity = nil, + idle_enter = nil, + idle_leave = nil, + workspace_change = nil, + }, + plugins = nil, + advanced = { + plugin = { + autocmds = true, + cursor_update = "on_hold", + match_in_mappings = true, + }, + server = { + update = "fetch", + pipe_path = nil, + executable_path = nil, + timeout = 300000, + }, + discord = { + reconnect = { + enabled = false, + interval = 5000, + initial = true, + }, + }, + workspace = { + root_markers = { + ".git", + ".hg", + ".svn", + }, + limit_to_cwd = false, + }, + }, + }) + end, +} diff --git a/nvim/lua/plugins/startup.lua b/nvim/lua/plugins/startup.lua new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/nvim/lua/plugins/supermaven.lua b/nvim/lua/plugins/supermaven.lua new file mode 100644 index 0000000000000000000000000000000000000000..94f28b23d64d96de70567576b05b235590f21d2f --- /dev/null +++ b/nvim/lua/plugins/supermaven.lua @@ -0,0 +1,20 @@ +return { + "supermaven-inc/supermaven-nvim", + config = function() + require("supermaven-nvim").setup({ + keymaps = { + accept_suggestion = "", + clear_suggestion = "", + accept_word = "", + }, + ignore_filetypes = { cpp = true }, -- you can add filetypes here to ignore + color = { + suggestion_color = "#5c534f", + cterm = 244, + }, + log_level = "info", -- set to "off" to disable logging completely + disable_inline_completion = false, -- disables inline completion for use with cmp + disable_keymaps = false, -- disables built in keymaps for more manual control + }) + end, +} diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000000000000000000000000000000000000..db98e5617eacf6f3aec0e26098f551096a0fe46e --- /dev/null +++ b/nvim/lua/plugins/telescope.lua @@ -0,0 +1,59 @@ +return { + "nvim-telescope/telescope.nvim", + event = "VimEnter", + branch = "0.1.x", + dependencies = { + "nvim-lua/plenary.nvim", + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + cond = function() + return vim.fn.executable("make") == 1 + end, + }, + { "nvim-telescope/telescope-ui-select.nvim" }, + { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, + }, + config = function() + require("telescope").setup({ + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown(), + }, + }, + }) + + pcall(require("telescope").load_extension, "fzf") + pcall(require("telescope").load_extension, "ui-select") + + local builtin = require("telescope.builtin") + vim.keymap.set("n", "sh", builtin.help_tags, { desc = "[S]earch [H]elp" }) + vim.keymap.set("n", "sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) + vim.keymap.set("n", "sf", builtin.find_files, { desc = "[S]earch [F]iles" }) + vim.keymap.set("n", "ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" }) + vim.keymap.set("n", "sw", builtin.grep_string, { desc = "[S]earch current [W]ord" }) + vim.keymap.set("n", "sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) + vim.keymap.set("n", "sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" }) + vim.keymap.set("n", "sr", builtin.resume, { desc = "[S]earch [R]esume" }) + vim.keymap.set("n", "s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + vim.keymap.set("n", "", builtin.buffers, { desc = "[ ] Find existing buffers" }) + + vim.keymap.set("n", "/", function() + builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ + winblend = 10, + previewer = false, + })) + end, { desc = "[/] Fuzzily search in current buffer" }) + + vim.keymap.set("n", "s/", function() + builtin.live_grep({ + grep_open_files = true, + prompt_title = "Live Grep in Open Files", + }) + end, { desc = "[S]earch [/] in Open Files" }) + + vim.keymap.set("n", "sn", function() + builtin.find_files({ cwd = vim.fn.stdpath("config") }) + end, { desc = "[S]earch [N]eovim files" }) + end, +} diff --git a/nvim/lua/plugins/todo_comments.lua b/nvim/lua/plugins/todo_comments.lua new file mode 100644 index 0000000000000000000000000000000000000000..b47cb518fe1d21d06788ee5b699460e91c5c9e14 --- /dev/null +++ b/nvim/lua/plugins/todo_comments.lua @@ -0,0 +1,6 @@ +return { + "folke/todo-comments.nvim", + event = "VimEnter", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { signs = false }, +} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000000000000000000000000000000000000..d4ccc23ebec2344a827a035ba805fa76416f9ba2 --- /dev/null +++ b/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,47 @@ +return { + "nvim-treesitter/nvim-treesitter", + version = false, -- Last release is way too old + build = ":TSUpdate", + -- event = { "BufReadPost", "BufNewFile" }, + lazy = false, -- Keep false to ensure loading for Neo-tree + main = "nvim-treesitter.configs", -- Lazy handles the require logic here + branch = "master", -- Explicitly force the stable branch + opts = { + ensure_installed = { + "lua", + "vim", + "vimdoc", + "query", + "python", + "c", + "cpp", + "csv", + "json", + }, + ignore_install = { "markdown", "markdown_inline" }, + auto_install = false, + highlight = { + enable = true, + -- Disable treesitter for markdown to prevent crashes + disable = { "markdown", "markdown_inline", "bash" }, + additional_vim_regex_highlighting = { "markdown" }, + }, + + indent = { + enable = true, + disable = { "markdown", "markdown_inline" }, + }, + injections = { + enable = false, + }, + }, + -- Fallback config to handle edge cases + config = function(_, opts) + -- Protective call: If treesitter fails to load, don't crash neovim + local status_ok, configs = pcall(require, "nvim-treesitter.configs") + if not status_ok then + return + end + configs.setup(opts) + end, +} diff --git a/nvim/lua/plugins/vimwiki.lua b/nvim/lua/plugins/vimwiki.lua new file mode 100644 index 0000000000000000000000000000000000000000..ab81b0ff7b17ce4b1a2717959350d64fdbe1d7c8 --- /dev/null +++ b/nvim/lua/plugins/vimwiki.lua @@ -0,0 +1,8 @@ +return { + "vimwiki/vimwiki", + init = function() + vim.g.vimwiki_path = "~/personal/zk" + vim.g.vimwiki_syntax = "markdown" + vim.g.vimwiki_ext = "md" + end, +} diff --git a/nvim/lua/plugins/which_key.lua b/nvim/lua/plugins/which_key.lua new file mode 100644 index 0000000000000000000000000000000000000000..69e37a858e35a8c473737d7e3f2005b59995374a --- /dev/null +++ b/nvim/lua/plugins/which_key.lua @@ -0,0 +1,49 @@ +return { + "folke/which-key.nvim", + event = "VimEnter", + opts = { + icons = { + mappings = vim.g.have_nerd_font, + keys = vim.g.have_nerd_font and {} or { + Up = " ", + Down = " ", + Left = " ", + Right = " ", + C = " ", + M = " ", + D = " ", + S = " ", + CR = " ", + Esc = " ", + ScrollWheelDown = " ", + ScrollWheelUp = " ", + NL = " ", + BS = " ", + Space = " ", + Tab = " ", + F1 = "", + F2 = "", + F3 = "", + F4 = "", + F5 = "", + F6 = "", + F7 = "", + F8 = "", + F9 = "", + F10 = "", + F11 = "", + F12 = "", + }, + }, + + spec = { + { "c", group = "[C]ode", mode = { "n", "x" } }, + { "d", group = "[D]ocument" }, + { "r", group = "[R]ename" }, + { "s", group = "[S]earch" }, + { "w", group = "[W]orkspace" }, + { "t", group = "[T]oggle" }, + { "h", group = "Git [H]unk", mode = { "n", "v" } }, + }, + }, +} diff --git a/nvim/lua/plugins/zig-lamp.lua b/nvim/lua/plugins/zig-lamp.lua new file mode 100644 index 0000000000000000000000000000000000000000..79e5331ebdf58392b7f239f40b6c28a1b5cfd1d0 --- /dev/null +++ b/nvim/lua/plugins/zig-lamp.lua @@ -0,0 +1,24 @@ +return { + "jinzhongjia/zig-lamp", + event = "VeryLazy", + -- Optional but recommended: build the local FFI lib to enable faster/safer verification & formatting + build = ":ZigLampBuild async", + dependencies = { + "nvim-lua/plenary.nvim", + }, + init = function() + -- Backward-compatible global vars (all optional) + -- Auto-install ZLS: timeout in milliseconds; set to nil to disable + vim.g.zig_lamp_zls_auto_install = nil + -- Fallback to system zls when no local match is found + vim.g.zig_lamp_fall_back_sys_zls = nil + -- Extra LSP options merged into defaults + vim.g.zig_lamp_zls_lsp_opt = {} + -- ZLS server settings (overrides built-in recommendations) + vim.g.zig_lamp_zls_settings = {} + -- Help text color for the package panel + vim.g.zig_lamp_pkg_help_fg = "#CF5C00" + -- Timeout (ms) used by `zig fetch` when retrieving url hashes + vim.g.zig_lamp_zig_fetch_timeout = 5000 + end, +}