From a6f768ee6a3cc5feed6e91b7b30897675c04fefc Mon Sep 17 00:00:00 2001 From: pancakes Date: Fri, 31 Oct 2025 01:08:15 +1000 Subject: [PATCH] Add Neovim config --- justfile | 11 ++- nvim/.config/nvim/after/ftplugin/markdown.lua | 4 + nvim/.config/nvim/init.lua | 10 +++ nvim/.config/nvim/lazy-lock.json | 27 ++++++ nvim/.config/nvim/lua/config/autocmd.lua | 14 +++ nvim/.config/nvim/lua/config/keymaps.lua | 36 ++++++++ nvim/.config/nvim/lua/config/lazy.lua | 35 ++++++++ nvim/.config/nvim/lua/config/lsp.lua | 90 +++++++++++++++++++ nvim/.config/nvim/lua/config/options.lua | 45 ++++++++++ nvim/.config/nvim/lua/plugins/barbar.lua | 42 +++++++++ nvim/.config/nvim/lua/plugins/blink-cmp.lua | 33 +++++++ nvim/.config/nvim/lua/plugins/colorscheme.lua | 14 +++ nvim/.config/nvim/lua/plugins/gitsigns.lua | 32 +++++++ nvim/.config/nvim/lua/plugins/lazydev.lua | 12 +++ nvim/.config/nvim/lua/plugins/lualine.lua | 5 ++ .../nvim/lua/plugins/mason-lspconfig.lua | 66 ++++++++++++++ nvim/.config/nvim/lua/plugins/mini.lua | 18 ++++ nvim/.config/nvim/lua/plugins/noice.lua | 28 ++++++ .../nvim/lua/plugins/nvim-treesitter.lua | 41 +++++++++ nvim/.config/nvim/lua/plugins/plenary.lua | 3 + .../nvim/lua/plugins/render-markdown.lua | 26 ++++++ nvim/.config/nvim/lua/plugins/snacks.lua | 55 ++++++++++++ .../nvim/lua/plugins/todo-comments.lua | 13 +++ nvim/.config/nvim/lua/plugins/trouble.lua | 47 ++++++++++ nvim/.config/nvim/lua/plugins/ts-comments.lua | 5 ++ nvim/.config/nvim/lua/plugins/which-key.lua | 14 +++ 26 files changed, 725 insertions(+), 1 deletion(-) create mode 100644 nvim/.config/nvim/after/ftplugin/markdown.lua create mode 100644 nvim/.config/nvim/init.lua create mode 100644 nvim/.config/nvim/lazy-lock.json create mode 100644 nvim/.config/nvim/lua/config/autocmd.lua create mode 100644 nvim/.config/nvim/lua/config/keymaps.lua create mode 100644 nvim/.config/nvim/lua/config/lazy.lua create mode 100644 nvim/.config/nvim/lua/config/lsp.lua create mode 100644 nvim/.config/nvim/lua/config/options.lua create mode 100644 nvim/.config/nvim/lua/plugins/barbar.lua create mode 100644 nvim/.config/nvim/lua/plugins/blink-cmp.lua create mode 100644 nvim/.config/nvim/lua/plugins/colorscheme.lua create mode 100644 nvim/.config/nvim/lua/plugins/gitsigns.lua create mode 100644 nvim/.config/nvim/lua/plugins/lazydev.lua create mode 100644 nvim/.config/nvim/lua/plugins/lualine.lua create mode 100644 nvim/.config/nvim/lua/plugins/mason-lspconfig.lua create mode 100644 nvim/.config/nvim/lua/plugins/mini.lua create mode 100644 nvim/.config/nvim/lua/plugins/noice.lua create mode 100644 nvim/.config/nvim/lua/plugins/nvim-treesitter.lua create mode 100644 nvim/.config/nvim/lua/plugins/plenary.lua create mode 100644 nvim/.config/nvim/lua/plugins/render-markdown.lua create mode 100644 nvim/.config/nvim/lua/plugins/snacks.lua create mode 100644 nvim/.config/nvim/lua/plugins/todo-comments.lua create mode 100644 nvim/.config/nvim/lua/plugins/trouble.lua create mode 100644 nvim/.config/nvim/lua/plugins/ts-comments.lua create mode 100644 nvim/.config/nvim/lua/plugins/which-key.lua diff --git a/justfile b/justfile index f569295..4cab3d5 100644 --- a/justfile +++ b/justfile @@ -9,7 +9,7 @@ _echowarning text: @echo -e "{{ style("warning") }}{{ text }}{{ NORMAL }}" # Full auto installation -full-auto: packages dev-setup fish-shell yazi-file-manager fastfetch +full-auto: packages dev-setup fish-shell nvim-editor yazi-file-manager fastfetch # Fuller auto (graphical) installation full-auto-gui: full-auto kitty-terminal niri-window-manager @@ -100,6 +100,15 @@ niri-window-manager: @just _echowarning "\n3) Enabling GNOME display manager service" sudo systemctl enable gdm +# Neovim text editor +[group("essentials")] +nvim-editor: + @just _echowarning "1) Installing Neovim and related tools" + paru -S lazygit luarocks neovim tree-sitter + + @just _echowarning "\n2) Stowing Neovim config" + stow nvim + [group("other")] syncthing-file-sync: @just _echowarning "1) Installing Syncthing" diff --git a/nvim/.config/nvim/after/ftplugin/markdown.lua b/nvim/.config/nvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..813b172 --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/markdown.lua @@ -0,0 +1,4 @@ +vim.opt_local.linebreak = true +vim.opt_local.spell = true +vim.opt_local.textwidth = 80 +vim.opt_local.wrap = true diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua new file mode 100644 index 0000000..c74e604 --- /dev/null +++ b/nvim/.config/nvim/init.lua @@ -0,0 +1,10 @@ +-- load plugins +require("config.lazy") + +-- load configs +require("config.autocmd") +require("config.keymaps") +require("config.options") +require("config.lsp") + + diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..f61940c --- /dev/null +++ b/nvim/.config/nvim/lazy-lock.json @@ -0,0 +1,27 @@ +{ + "SchemaStore.nvim": { "branch": "main", "commit": "3b0d7d781589ce98ce577202d25d07741ffcf479" }, + "barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" }, + "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, + "lazy.nvim": { "branch": "main", "commit": "f0f5bbb9e5bfae5e6468f9359ffea3d151418176" }, + "lazydev.nvim": { "branch": "main", "commit": "c2dfe354571a8255c5d3e96a9a4c297c89ce2347" }, + "lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "3590d66effccc7376d8c3dbe45e8291f9fed2843" }, + "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, + "mini.pairs": { "branch": "main", "commit": "b9aada8c0e59f2b938e98fbf4eae0799eba96ad9" }, + "noice.nvim": { "branch": "main", "commit": "5099348591f7d3ba9e547b1e631c694c65bbe0b9" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-lspconfig": { "branch": "master", "commit": "87d30189b24caa496b54affd65594a309ac6d929" }, + "nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "render-markdown.nvim": { "branch": "main", "commit": "10126effbafb74541b69219711dfb2c631e7ebf8" }, + "snacks.nvim": { "branch": "main", "commit": "6ca541747c09962f87fc42b858249e4f9d2bbf2d" }, + "todo-comments.nvim": { "branch": "main", "commit": "411503d3bedeff88484de572f2509c248e499b38" }, + "tokyonight.nvim": { "branch": "main", "commit": "2642dbb83333e0575d1c3436e1d837926871c5fb" }, + "trouble.nvim": { "branch": "main", "commit": "d7494d8bc563f8ae8b3f35d78c7478cf842b0ab9" }, + "ts-comments.nvim": { "branch": "main", "commit": "123a9fb12e7229342f807ec9e6de478b1102b041" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/nvim/.config/nvim/lua/config/autocmd.lua b/nvim/.config/nvim/lua/config/autocmd.lua new file mode 100644 index 0000000..84ea0d0 --- /dev/null +++ b/nvim/.config/nvim/lua/config/autocmd.lua @@ -0,0 +1,14 @@ +vim.api.nvim_create_autocmd("BufWritePost", { + desc = "Format buffer on write", + callback = function() + vim.lsp.buf.format() + end, +}) + +vim.api.nvim_create_autocmd("TextYankPost", { + desc = "Highlight text on yank", + group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) diff --git a/nvim/.config/nvim/lua/config/keymaps.lua b/nvim/.config/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..6394fb6 --- /dev/null +++ b/nvim/.config/nvim/lua/config/keymaps.lua @@ -0,0 +1,36 @@ +local opts = { noremap = true } + +Snacks.keymap.set("n", "l", "Lazy", { desc = "Open Lazy menu" }) + +Snacks.keymap.set("n", "", "zz", { desc = "Move view down and center on line" }) +Snacks.keymap.set("n", "", "zz", { desc = "Move view up and center on line" }) + +Snacks.keymap.set("n", "", "wincmd h") +Snacks.keymap.set("n", "", "wincmd j") +Snacks.keymap.set("n", "", "wincmd k") +Snacks.keymap.set("n", "", "wincmd l") + +Snacks.keymap.set("v", "<", "", ">gv", opts) + +Snacks.keymap.set("n", "", "nohl", { desc = "Clear search", silent = true }) + +Snacks.keymap.set("n", "y", '"+yy', { desc = "Copy line to system clipboard" }) +Snacks.keymap.set("v", "y", '"+y', { desc = "Copy selection to system clipboard" }) +Snacks.keymap.set("n", "Y", "%y +", { desc = "Copy buffer to system clipboard" }) +Snacks.keymap.set("n", "p", '"+p', { desc = "Paste after from system clipboard" }) +Snacks.keymap.set("n", "P", '"+P', { desc = "Paste before from system clipboard" }) + +Snacks.keymap.set("n", "f", vim.lsp.buf.format, { desc = "Format buffer" }) + +Snacks.keymap.set("n", "Q", "qa", { desc = "Quit Nvim" }) + +Snacks.keymap.set("n", "uh", function() + local enabled = vim.lsp.inlay_hint.is_enabled() + if enabled then + print("Disabling inlay hints") + else + print("Enabling inlay hints") + end + vim.lsp.inlay_hint.enable(not enabled) +end, { desc = "Toggle inlay hints" }) diff --git a/nvim/.config/nvim/lua/config/lazy.lua b/nvim/.config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..2add6ce --- /dev/null +++ b/nvim/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,35 @@ +-- 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) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "tokyonight" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/nvim/.config/nvim/lua/config/lsp.lua b/nvim/.config/nvim/lua/config/lsp.lua new file mode 100644 index 0000000..78b4f60 --- /dev/null +++ b/nvim/.config/nvim/lua/config/lsp.lua @@ -0,0 +1,90 @@ +vim.diagnostic.config({ + float = true, + virtual_lines = true, +}) + +-- JSON +vim.lsp.config("jsonls", { + -- lazy-load schemastore when needed + before_init = function(_, new_config) + new_config.settings.json.schemas = new_config.settings.json.schemas or {} + vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas()) + end, + settings = { + json = { + format = { enable = true }, + validate = { enable = true }, + }, + }, +}) + +-- Lua +vim.lsp.config("lua_ls", { + settings = { + Lua = { + hint = true, + }, + } +}) + +-- Python +vim.lsp.config("basedpyright", { + settings = { + basedpyright = { + analysis = { + inlayHints = { + callArgumentNamesMatching = true, + functionReturnTypes = true, + genericTypes = true, + }, + }, + }, + }, +}) + +vim.lsp.config("ruff", { + cmd_env = { RUFF_TRACE = "messages" }, + init_options = { + settings = { + logLevel = "error", + }, + }, +}) + +-- YAML +vim.lsp.config("yamlls", { + -- Have to add this for yamlls to understand that we support line folding + capabilities = { + textDocument = { + foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, + }, + }, + }, + -- lazy-load schemastore when needed + before_init = function(_, new_config) + new_config.settings.yaml.schemas = vim.tbl_deep_extend( + "force", + new_config.settings.yaml.schemas or {}, + require("schemastore").yaml.schemas() + ) + end, + settings = { + redhat = { telemetry = { enabled = false } }, + yaml = { + keyOrdering = false, + format = { + enable = true, + }, + validate = true, + schemaStore = { + -- Must disable built-in schemaStore support to use + -- schemas from SchemaStore.nvim plugin + enable = false, + -- Avoid TypeError: Cannot read properties of undefined (reading 'length') + url = "", + }, + }, + }, +}) diff --git a/nvim/.config/nvim/lua/config/options.lua b/nvim/.config/nvim/lua/config/options.lua new file mode 100644 index 0000000..f34f18b --- /dev/null +++ b/nvim/.config/nvim/lua/config/options.lua @@ -0,0 +1,45 @@ +vim.g.editorconfig = true -- respect editorconfig files +vim.g.snacks_animate = false -- disable snacks.nvim animations + +-- appearance +vim.opt.background = "dark" -- +vim.opt.colorcolumn = "80" -- highlight column 80 +vim.opt.cursorline = true -- highlight line the cursor is on +vim.opt.number = true -- enable line numbers +vim.opt.signcolumn = "yes" -- prevent constant shifting when LSP is enabled +vim.opt.scrolloff = 8 -- add 8 rows of padding when scrolling +vim.opt.termguicolors = true -- + +-- files +vim.opt.backup = false -- disable backups +vim.opt.swapfile = false -- disable swapping +vim.opt.undofile = true -- enable persistent undo + +-- indents +vim.opt.autoindent = true -- +vim.opt.expandtab = true -- use spaces when pressing tab +vim.opt.shiftwidth = 4 -- +vim.opt.smartindent = true -- improve indenting +vim.opt.softtabstop = 4 -- +vim.opt.tabstop = 4 -- indent with 4 spaces + +-- inputs +vim.g.clipboard = "wl-copy" -- use wayland wl-copy for clipboard +vim.opt.backspace = { "eol", "indent", "start" } -- improve backspace +vim.opt.mouse = "a" -- enable mouse in all modes +vim.opt.updatetime = 100 -- reduce latency + +-- search +vim.opt.hlsearch = true -- +vim.opt.ignorecase = true -- ignore case when searching +vim.opt.inccommand = "split" -- preview substitutions in a split +vim.opt.incsearch = true -- preview searches while typing +vim.opt.smartcase = true -- don't ignore case when capitals are used + +-- splits +vim.opt.splitbelow = true -- vertical splits open below +vim.opt.splitright = true -- horizontal splits open to the right + +-- wrapping +vim.opt.wrap = false -- wrapping disabled +vim.opt.showbreak = "> " -- indicate when a line is wrapped diff --git a/nvim/.config/nvim/lua/plugins/barbar.lua b/nvim/.config/nvim/lua/plugins/barbar.lua new file mode 100644 index 0000000..b45d73f --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/barbar.lua @@ -0,0 +1,42 @@ +return { + "romgrk/barbar.nvim", + version = "^1.0.0", + lazy = false, + init = function() vim.g.barbar_auto_setup = false end, + keys = { + -- move to previous/next + { "", "BufferPrevious", noremap = true, silent = true }, + { "", "BufferNext", noremap = true, silent = true }, + -- reorder to previous/next + { "", "BufferMovePrevious", noremap = true, silent = true }, + { "", "BufferMoveNext", noremap = true, silent = true }, + -- move to buffer at position + { "", "BufferGoto 1", noremap = true, silent = true }, + { "", "BufferGoto 2", noremap = true, silent = true }, + { "", "BufferGoto 3", noremap = true, silent = true }, + { "", "BufferGoto 4", noremap = true, silent = true }, + { "", "BufferGoto 5", noremap = true, silent = true }, + { "", "BufferGoto 6", noremap = true, silent = true }, + { "", "BufferGoto 7", noremap = true, silent = true }, + { "", "BufferGoto 8", noremap = true, silent = true }, + { "", "BufferGoto 9", noremap = true, silent = true }, + { "", "BufferLast", noremap = true, silent = true }, + -- close buffer + { "", "BufferClose", noremap = true, silent = true }, + -- picking mode + { "", "BufferPick", noremap = true, silent = true }, + { "", "BufferPickDelete", noremap = true, silent = true }, + }, + opts = { + animation = false, + tabpages = true, + focus_on_close = "previous", + sidebar_filetypes = { + NvimTree = true, + }, + }, + dependencies = { + "lewis6991/gitsigns.nvim", + "nvim-tree/nvim-web-devicons", + }, +} diff --git a/nvim/.config/nvim/lua/plugins/blink-cmp.lua b/nvim/.config/nvim/lua/plugins/blink-cmp.lua new file mode 100644 index 0000000..141cca2 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/blink-cmp.lua @@ -0,0 +1,33 @@ +return { + 'saghen/blink.cmp', + version = '1.*', + --- @module 'blink.cmp' + --- @type blink.cmp.Cnfig + opts = { + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + keymap = { preset = 'super-tab' }, + + appearance = { + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'normal' + }, + + signature = { enabled = true }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" } + }, + opts_extend = { "sources.default" }, + dependencies = { 'rafamadriz/friendly-snippets' }, +} diff --git a/nvim/.config/nvim/lua/plugins/colorscheme.lua b/nvim/.config/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..ca2e4fb --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,14 @@ +return { + { + "folke/tokyonight.nvim", + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins + opts = { + transparent = true, + }, + config = function(_, opts) + require("tokyonight").setup(opts) + vim.cmd([[colorscheme tokyonight]]) + end, + } +} diff --git a/nvim/.config/nvim/lua/plugins/gitsigns.lua b/nvim/.config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..e226d79 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,32 @@ +return { + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = { + on_attach = function() + local gs = package.loaded.gitsigns + local map = Snacks.keymap.set + + map("n", "gs", gs.stage_hunk, { desc = "Stage hunk" }) + map("v", "gs", function() + gs.stage_hunk({ vim.fn.line("."), vim.fn.line(".") }) + end, { desc = "Stage hunk" }) + map("n", "gr", gs.reset_hunk, { desc = "Reset hunk" }) + map("v", "gr", function() + gs.reset_hunk({ vim.fn.line("."), vim.fn.line(".") }) + end, { desc = "Reset hunk" }) + map("n", "gu", gs.undo_stage_hunk, { desc = "Undo stage hunk" }) + + map("n", "gS", gs.stage_buffer, { desc = "Stage buffer" }) + map("n", "gR", gs.reset_buffer, { desc = "Reset buffer" }) + + map("n", "gp", gs.preview_hunk, { desc = "Preview hunk" }) + map("n", "gbl", function() gs.blame_line({ full = true }) end, { desc = "Blame line" }) + map("n", "gB", gs.toggle_current_line_blame, { desc = "Toggle line blame" }) + + map("n", "gd", gs.diffthis, { dsc = "Diff this" }) + map("n", "gD", function() gs.diffthis("~") end, { desc = "Diff this ~" }) + map("n", "]h", gs.next_hunk, { desc = "Next hunk" }) + map("n", "[h", gs.prev_hunk, { desc = "Previous hunk" }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/lazydev.lua b/nvim/.config/nvim/lua/plugins/lazydev.lua new file mode 100644 index 0000000..1c825c7 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lazydev.lua @@ -0,0 +1,12 @@ +return { + "folke/lazydev.nvim", + ft = "lua", + cmd = "LazyDev", + opts = { + library = { + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + { path = "snacks.nvim", words = { "Snacks" } }, + { path = "lazy.nvim", words = { "LazyVim" } }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/lualine.lua b/nvim/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..b9257c9 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,5 @@ +return { + 'nvim-lualine/lualine.nvim', + opts = {}, + dependencies = { 'nvim-tree/nvim-web-devicons' }, +} diff --git a/nvim/.config/nvim/lua/plugins/mason-lspconfig.lua b/nvim/.config/nvim/lua/plugins/mason-lspconfig.lua new file mode 100644 index 0000000..290e636 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/mason-lspconfig.lua @@ -0,0 +1,66 @@ +return { + "mason-org/mason-lspconfig.nvim", + opts = {}, + dependencies = { + { + "mason-org/mason.nvim", + keys = { + { "m", "Mason", desc = "Open mason" } + }, + config = function() + require("mason").setup() + + local lsps = { + -- Docker + "docker-compose-language-service", + "dockerfile-language-server", + -- HTML + "emmet-language-server", + "html-lsp", + -- JavaScript + "eslint-lsp", + -- JSON + "json-lsp", + -- Lua + "lua-language-server", + -- Markdown + "markdownlint-cli2", + "marksman", + -- Python + "basedpyright", + "ruff", + -- Rust + "rust-analyzer", + -- TOML + "taplo", + -- YAML + "yaml-language-server", + } + + -- automatically install required LSPs at startup + local mr = require("mason-registry") + mr.refresh(function() + for _, value in ipairs(lsps) do + local p = mr.get_package(value) + if not p:is_installed() and p:is_installable() then + print("Installing LSP: " .. value) + p:install(nil, function(success, receipt) + if success then + print("Installed LSP: " .. receipt.name) + else + error("Failed to install LSP: " .. value) + end + end) + end + end + end) + end, + }, + "neovim/nvim-lspconfig", + { + "b0o/SchemaStore.nvim", + lazy = true, + version = false, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/mini.lua b/nvim/.config/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..112ebda --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/mini.lua @@ -0,0 +1,18 @@ +return { + { + "nvim-mini/mini.pairs", + event = "VeryLazy", + opts = { + modes = { insert = true, command = true, terminal = false }, + -- skip autopair when next character is one of these + skip_next = [=[[%w%%%'%[%"%.%`%$]]=], + -- skip autopair when the cursor is inside these treesitter nodes + skip_ts = { "string" }, + -- skip autopair when next character is closing pair + -- and there are more closing pairs than opening pairs + skip_unbalanced = true, + -- better deal with markdown code blocks + markdown = true, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/noice.lua b/nvim/.config/nvim/lua/plugins/noice.lua new file mode 100644 index 0000000..ee49699 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/noice.lua @@ -0,0 +1,28 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp + }, + }, + presets = { + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + "rcarriga/nvim-notify", + } +} diff --git a/nvim/.config/nvim/lua/plugins/nvim-treesitter.lua b/nvim/.config/nvim/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..0a4b4ed --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,41 @@ +return { + "nvim-treesitter/nvim-treesitter", + branch = "master", + lazy = false, + build = ":TSUpdate", + opts = { + ensure_installed = { + "bash", + "comment", + "css", + "csv", + "diff", + "dockerfile", + "git_rebase", + "gitignore", + "html", + "ini", + "javascript", + "json5", + "just", + "kdl", + "lua", + "markdown", + "markdown_inline", + "ninja", + "printf", + "python", + "rst", + "rust", + "toml", + "typescript", + "vim", + "xml", + "yaml", + }, + auto_install = true, + fold = {enable=true}, + indent = {enable=true}, + highlight = {enable = true}, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/plenary.lua b/nvim/.config/nvim/lua/plugins/plenary.lua new file mode 100644 index 0000000..d2c1874 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/plenary.lua @@ -0,0 +1,3 @@ +return { + "nvim-lua/plenary.nvim" +} diff --git a/nvim/.config/nvim/lua/plugins/render-markdown.lua b/nvim/.config/nvim/lua/plugins/render-markdown.lua new file mode 100644 index 0000000..31aa4a8 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/render-markdown.lua @@ -0,0 +1,26 @@ +return { + "MeanderingProgrammer/render-markdown.nvim", + opts = { + completions = { lsp = { enabled = true } }, + heading = { + enabled = true, + sign = false, + position = "inline", + }, + paragraph = { enabled = true }, + code = { + enabled = true, + sign = false, + }, + dash = { enabled = true }, + bullet = { enabled = true }, + checkbox = { enabled = true }, + quote = {enabled=true}, + pipe_table = {enabled=true}, + link = {enabled=true}, + }, + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons" + }, +} diff --git a/nvim/.config/nvim/lua/plugins/snacks.lua b/nvim/.config/nvim/lua/plugins/snacks.lua new file mode 100644 index 0000000..873fecc --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/snacks.lua @@ -0,0 +1,55 @@ +return { + "folke/snacks.nvim", + lazy = false, + prioerity = 1000, + opts = { + bigfile = { enabled = true }, + explorer = { + replace_netrw = true, -- Replace netrw with the snacks explorer + trash = true, -- Use the system trash when deleting files + }, + indent = { enabled = true }, + input = { enabled = true }, + notifier = { enabled = true }, + picker = { + enabled = true, + matchers = { + cwd_bonus = true, + frequency = true, + }, + sources = { + explorer = { + + }, + }, + }, + scope = { enabled = true }, + scroll = { enabled = true }, + statuscolumn = { enabled = false }, -- we set this in options.lua + words = { enabled = true }, + }, + keys = { + { + "n", + function() + Snacks.picker.notifications() + end, + desc = "Notification History" + }, + { "un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" }, + + { ",", function() Snacks.picker.buffers() end, desc = "Buffers" }, + { "/", function() Snacks.picker.grep() end, desc = "Grep" }, + { "W", function() Snacks.picker.grep_word() end, desc = "Grep word" }, + { ":", function() Snacks.picker.command_history() end, desc = "Command History" }, + { "n", function() Snacks.picker.notifications() end, desc = "Notification History" }, + { "e", function() Snacks.explorer() end, desc = "File Explorer" }, + { "C", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Open config files" }, + { "h", function() Snacks.picker.help() end, desc = "Help" }, + + { "lg", function() Snacks.lazygit() end, desc = "Open Lazygit" }, + { "gl", function() Snacks.lazygit.log() end, desc = "Open git log in Lazygit" }, + + { "dB", function() Snacks.bufdelete() end, desc = "Delete buffer" } + }, +} diff --git a/nvim/.config/nvim/lua/plugins/todo-comments.lua b/nvim/.config/nvim/lua/plugins/todo-comments.lua new file mode 100644 index 0000000..08c7f56 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/todo-comments.lua @@ -0,0 +1,13 @@ +return { + "folke/todo-comments.nvim", + cmd = { "TodoTrouble", "TodoTelescope" }, + opts = {}, + keys = { + { "]t", function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" }, + { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous Todo Comment" }, + { "xt", "Trouble todo toggle", desc = "Todo (Trouble)" }, + { "xT", "Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}}", desc = "Todo/Fix/Fixme (Trouble)" }, + { "st", "TodoTelescope", desc = "Todo" }, + { "sT", "TodoTelescope keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme" }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/trouble.lua b/nvim/.config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..b43e289 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,47 @@ +return { + "folke/trouble.nvim", + cmd = { "Trouble" }, + opts = { + modes = { + lsp = { + win = { position = "right" }, + }, + }, + }, + keys = { + { "xx", "Trouble diagnostics toggle", desc = "Diagnostics (Trouble)" }, + { "xX", "Trouble diagnostics toggle filter.buf=0", desc = "Buffer Diagnostics (Trouble)" }, + { "cs", "Trouble symbols toggle", desc = "Symbols (Trouble)" }, + { "cS", "Trouble lsp toggle", desc = "LSP references/definitions/... (Trouble)" }, + { "xL", "Trouble loclist toggle", desc = "Location List (Trouble)" }, + { "xQ", "Trouble qflist toggle", desc = "Quickfix List (Trouble)" }, + { + "[q", + function() + if require("trouble").is_open() then + require("trouble").prev({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cprev) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = "Previous Trouble/Quickfix Item", + }, + { + "]q", + function() + if require("trouble").is_open() then + require("trouble").next({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cnext) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = "Next Trouble/Quickfix Item", + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/ts-comments.lua b/nvim/.config/nvim/lua/plugins/ts-comments.lua new file mode 100644 index 0000000..a450236 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/ts-comments.lua @@ -0,0 +1,5 @@ +return { + "folke/ts-comments.nvim", + event = "VeryLazy", + opts = {}, +} diff --git a/nvim/.config/nvim/lua/plugins/which-key.lua b/nvim/.config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..7276c2b --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,14 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = {}, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, +}