From 1fe92c532bd3206a95e1a58f88689719d6612b4d Mon Sep 17 00:00:00 2001 From: devaine Date: Sun, 26 Oct 2025 19:41:13 -0500 Subject: [PATCH] fix(config): new config, it's been a while --- init.lua | 2 + lazy-lock.json | 22 +++++++++ lua/config/lazy.lua | 28 ++++++++++++ lua/config/vim.lua | 54 ++++++++++++++++++++++ lua/plugins/completion.lua | 39 ++++++++++++++++ lua/plugins/dev-utils.lua | 84 +++++++++++++++++++++++++++++++++++ lua/plugins/discord.lua | 16 +++++++ lua/plugins/file-explorer.lua | 18 ++++++++ lua/plugins/formatter.lua | 38 ++++++++++++++++ lua/plugins/lsp.lua | 75 +++++++++++++++++++++++++++++++ lua/plugins/ui.lua | 9 ++++ 11 files changed, 385 insertions(+) create mode 100644 init.lua create mode 100644 lazy-lock.json create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/vim.lua create mode 100644 lua/plugins/completion.lua create mode 100644 lua/plugins/dev-utils.lua create mode 100644 lua/plugins/discord.lua create mode 100644 lua/plugins/file-explorer.lua create mode 100644 lua/plugins/formatter.lua create mode 100644 lua/plugins/lsp.lua create mode 100644 lua/plugins/ui.lua diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..0d0f23b --- /dev/null +++ b/init.lua @@ -0,0 +1,2 @@ +require("config.vim") +require("config.lazy") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..e792b6a --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,22 @@ +{ + "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, + "conform.nvim": { "branch": "master", "commit": "9fd3d5e0b689ec1bf400c53cbbec72c6fdf24081" }, + "cord.nvim": { "branch": "master", "commit": "1aadec47743e6cfe77ae6860a5b4305a465f03be" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" }, + "lazy.nvim": { "branch": "main", "commit": "ed4dc336a73c18da6fea6e1cf7ad6e1b76d281eb" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1d77bd86e1c3eaa777010c95dad455b83823f247" }, + "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "8cdd6b1940f333c1dd085526a9c45b30fb2dbf50" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" }, + "nvim-eslint": { "branch": "main", "commit": "e052854a05c0e247c0fc886bcff7c8ef9d54c2b9" }, + "nvim-highlight-colors": { "branch": "main", "commit": "e0c4a58ec8c3ca7c92d3ee4eb3bc1dd0f7be317e" }, + "nvim-lspconfig": { "branch": "master", "commit": "a9b2fb560c4ab22c10728fd5149dbd7b62aa4f69" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }, + "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" } +} diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..321c7c5 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,28 @@ +-- Bootstrap lazy.nvim +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 +end +vim.opt.rtp:prepend(lazypath) + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- plugin import + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + install = {}, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/lua/config/vim.lua b/lua/config/vim.lua new file mode 100644 index 0000000..5701619 --- /dev/null +++ b/lua/config/vim.lua @@ -0,0 +1,54 @@ +-- set the leader +vim.g.mapleader = " " + +-- neovim/vim variables +local opt = vim.opt +local keybind = vim.keymap.set + +-- basic +opt.relativenumber = true +opt.number = true +opt.termguicolors = true + +-- indentation +opt.tabstop = 2 +opt.softtabstop = 0 +opt.shiftwidth = 2 +opt.smarttab = true +opt.smartindent = true + +-- searches +opt.incsearch = true + +-- mapleader +vim.g.mapleader = " " + +-- keybinds +keybind("n", "hh", "lua vim.diagnostic.setqflist()", { desc = "LSP Diagonistics" }) + +-- buffer keybinds +keybind("n", "bb", "bprevious", { desc = "Switch to previous buffer" }) +keybind("n", "nn", "bnext", { desc = "Switch to next buffer" }) +keybind("n", ",,", "bdel", { desc = "Delete Buffer" }) + +-- visual mode keybinds +keybind("v", "ii", '"+y', { desc = "Copy to clipboard ( + yank)" }) +keybind("v", "<", "", ">gv", { desc = "Indent right and reselect" }) +keybind("v", "", ":m '<-2gv", { desc = "Move selection up" }) +keybind("v", "", ":m '>+1gv", { desc = "Move selection down" }) + +-- friend keybinds +keybind("i", "jk", "", { desc = "Keybind set for Justin" }) + +-- file explorer +keybind("n", "mm", "Neotree toggle", { desc = "Toggle File Explorer" }) +keybind("n", "jj", "Neotree action=focus", { desc = "Focus on file explorer" }) + +-- file handling +opt.backup = false +opt.writebackup = false +opt.swapfile = false +opt.undofile = true +opt.undodir = vim.fn.expand("~/.nvim/undodir") +opt.autoread = true diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua new file mode 100644 index 0000000..5cbb26a --- /dev/null +++ b/lua/plugins/completion.lua @@ -0,0 +1,39 @@ +return { + { + "saghen/blink.cmp", + dependencies = { + { "rafamadriz/friendly-snippets" }, + }, + version = "1.*", + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + + opts = { + keymap = { + preset = "none", + [''] = { 'select_next', 'fallback' }, + [''] = { 'select_prev', 'fallback' }, + [""] = { 'select_and_accept', 'fallback' }, + [''] = { 'hide', 'fallback' } + }, + + completion = { + documentation = { + auto_show = true, + treesitter_highlighting = true + }, + menu = { auto_show = true }, + ghost_text = { enabled = true } + }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + + signature = { enabled = true }, + + fuzzy = { implementation = "prefer_rust_with_warning" } + } + } +} diff --git a/lua/plugins/dev-utils.lua b/lua/plugins/dev-utils.lua new file mode 100644 index 0000000..6b422c0 --- /dev/null +++ b/lua/plugins/dev-utils.lua @@ -0,0 +1,84 @@ +return { + -- Parser that does syntax highlighting + { + "nvim-treesitter/nvim-treesitter", + branch = 'master', + lazy = false, + build = ":TSUpdate", + config = function () + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "lua", + "cpp", + "java", + "javascript", + "bash", + "python", + "typescript", + "css", + "html", + "jsdoc", + "http", + "sql", + "ssh_config", + "json", + "tsx", + "xml", + "yaml", + "nginx", + "gitcommit", + "gitignore", + "cmake" + }, + indent = { enable = true }, + highlight = { enable = true } + }) + end + }, + + -- Allows pairs for {}, '', "", () + { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = true, + opts = {} + }, + + -- Allows automatic tagging on HTML or JSON (E.g:
test
) + { + "windwp/nvim-ts-autotag", + config = function() + require("nvim-ts-autotag").setup() + end, + }, + + -- Provides highlighting on TODO's, E.g: + -- NOTE: This is a note. + -- WARN: This is warning note. + -- TODO: This is a to-do note. + -- FIX: This is a fix note. + -- PERF: This is a performance note. + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("todo-comments").setup() + end, + }, + + -- Allows highlighting for hexadecimal colors for RGB characters. + -- E.g: #FFFFFF + { + "brenoprata10/nvim-highlight-colors", + config = function() + require("nvim-highlight-colors").setup() + end, + }, + + -- Shows line(s) indicating indentation. + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = {}, + }, +} diff --git a/lua/plugins/discord.lua b/lua/plugins/discord.lua new file mode 100644 index 0000000..023548d --- /dev/null +++ b/lua/plugins/discord.lua @@ -0,0 +1,16 @@ +-- Just Discord Rich Presence for Neovim, neat huh? +return { + "vyfor/cord.nvim", + build = ":Cord update", + config = function() + require("cord").setup({ + display = { + flavor = "dark", + }, + text = { + default = "programming most likely", + workspace = "", + }, + }) + end, +} diff --git a/lua/plugins/file-explorer.lua b/lua/plugins/file-explorer.lua new file mode 100644 index 0000000..4f2494d --- /dev/null +++ b/lua/plugins/file-explorer.lua @@ -0,0 +1,18 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + "nvim-tree/nvim-web-devicons", + }, + lazy = false, + opts = { + window = { + mappings = { + ["P"] = "toggle_preview", + } + } + }, +} + diff --git a/lua/plugins/formatter.lua b/lua/plugins/formatter.lua new file mode 100644 index 0000000..fc6139a --- /dev/null +++ b/lua/plugins/formatter.lua @@ -0,0 +1,38 @@ +-- Formatter plugin, helps with formatting code on saving the file. + +return { + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + + -- This will provide type hinting with LuaLS + ---@module "conform" + ---@type conform.setupOpts + opts = { + formatters_by_ft = { + lua = { "stylua" }, + python = { "black" }, + javascript = { "prettier" }, -- add stop_after_first for n > 1 + typescript = { "prettier" }, + sh = { "shfmt", "shellcheck" }, + bash = { "shfmt", "shellcheck" }, + }, + formatters = { + prettier = { + prepend_args = function() + return { "" } + end, + }, + }, + default_format_opts = { + lsp_format = "fallback", + }, + format_on_save = { + timeout_ms = 500, + }, + }, + + init = function() + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" + end, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..7c23c3a --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,75 @@ +return { + { + "mason-org/mason.nvim", + dependencies = { + "mason-org/mason-lspconfig.nvim", + }, + opts = function() + require("mason").setup() + require("mason-lspconfig").setup({ + -- Ensure the install of these language servers + ensure_installed = { + "lua_ls", + "clangd", + "bashls", + "ts_ls", + "cssls", + "html", + "tailwindcss", + "pylsp", + }, + }) + end, + }, + { + "neovim/nvim-lspconfig", + lazy = false, + config = function() + local caps = vim.lsp.protocol.make_client_capabilities() + local capabilities = require("blink.cmp").get_lsp_capabilities(caps) + capabilities.textDocument.completion.completionItem.snippetSupport = true + + vim.lsp.config("*", { + capabilities = capabilities, + }) + + vim.lsp.config("lua_ls", { + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + }, + }, + }) + + vim.lsp.config("ts_ls", { + init_options = { preferences = { disableSuggestions = false } }, + }) + + vim.lsp.enable({ + "lua_ls", + "clangd", + "bashls", + "ts_ls", + "cssls", + "html", + "tailwindcss", + "pylsp", + }) + end, + }, + + { + "esmuellert/nvim-eslint", + config = function() + require("nvim-eslint").setup({ + settings = { + workingDirectory = function(bufnr) + return { directory = vim.fs.root(bufnr, { "package.json" }) } + end, + }, + }) + end, + }, +} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua new file mode 100644 index 0000000..f110257 --- /dev/null +++ b/lua/plugins/ui.lua @@ -0,0 +1,9 @@ +return { + -- Colorscheme + { + "rebelot/kanagawa.nvim", + config = function() + vim.cmd([[colorscheme kanagawa-dragon]]) + end, + } +}