diff --git a/modules/home/rsydn/programs/neovim.nix b/modules/home/rsydn/programs/neovim.nix index e2fba06..cc1a9fc 100644 --- a/modules/home/rsydn/programs/neovim.nix +++ b/modules/home/rsydn/programs/neovim.nix @@ -10,16 +10,6 @@ withRuby = true; extraPackages = with pkgs; [ - # LSP servers installed via Nix - lua-language-server - nil - pyright - nodePackages.typescript - nodePackages.typescript-language-server - rust-analyzer - gopls - clang-tools - # Formatters stylua nixfmt diff --git a/modules/home/rsydn/programs/nvim/.gitignore b/modules/home/rsydn/programs/nvim/.gitignore deleted file mode 100644 index cc5457a..0000000 --- a/modules/home/rsydn/programs/nvim/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -tt.* -.tests -doc/tags -debug -.repro -foo.* -*.log -data diff --git a/modules/home/rsydn/programs/nvim/.luarc.json b/modules/home/rsydn/programs/nvim/.luarc.json new file mode 100644 index 0000000..99875e2 --- /dev/null +++ b/modules/home/rsydn/programs/nvim/.luarc.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", + "runtime": { + "version": "LuaJIT", + "path": [ + "lua/?.lua", + "lua/?/init.lua" + ] + }, + "diagnostics": { + "globals": ["vim"] + }, + "workspace": { + "library": [ + "${3rd}/luv/library", + "${3rd}/busted/library", + "${3rd}/luassert/library" + ], + "checkThirdParty": false + }, + "completion": { + "callSnippet": "Replace" + }, + "telemetry": { + "enable": false + } +} diff --git a/modules/home/rsydn/programs/nvim/.neoconf.json b/modules/home/rsydn/programs/nvim/.neoconf.json deleted file mode 100644 index 7c48087..0000000 --- a/modules/home/rsydn/programs/nvim/.neoconf.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "neodev": { - "library": { - "enabled": true, - "plugins": true - } - }, - "neoconf": { - "plugins": { - "lua_ls": { - "enabled": true - } - } - } -} diff --git a/modules/home/rsydn/programs/nvim/LICENSE b/modules/home/rsydn/programs/nvim/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/modules/home/rsydn/programs/nvim/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/modules/home/rsydn/programs/nvim/README.md b/modules/home/rsydn/programs/nvim/README.md deleted file mode 100644 index 185280b..0000000 --- a/modules/home/rsydn/programs/nvim/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# 💤 LazyVim - -A starter template for [LazyVim](https://github.com/LazyVim/LazyVim). -Refer to the [documentation](https://lazyvim.github.io/installation) to get started. diff --git a/modules/home/rsydn/programs/nvim/init.lua b/modules/home/rsydn/programs/nvim/init.lua index 2514f9e..0ebd480 100644 --- a/modules/home/rsydn/programs/nvim/init.lua +++ b/modules/home/rsydn/programs/nvim/init.lua @@ -1,2 +1,5 @@ --- bootstrap lazy.nvim, LazyVim and your plugins +-- Load configuration +require("config.options") +require("config.keymaps") +require("config.autocmds") require("config.lazy") diff --git a/modules/home/rsydn/programs/nvim/lua/config/autocmds.lua b/modules/home/rsydn/programs/nvim/lua/config/autocmds.lua index 4221e75..d46a7a1 100644 --- a/modules/home/rsydn/programs/nvim/lua/config/autocmds.lua +++ b/modules/home/rsydn/programs/nvim/lua/config/autocmds.lua @@ -1,8 +1,9 @@ --- Autocmds are automatically loaded on the VeryLazy event --- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua --- --- Add any additional autocmds here --- with `vim.api.nvim_create_autocmd` --- --- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) --- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell") +-- Essential autocommands (minimal) +local autocmd = vim.api.nvim_create_autocmd + +-- Highlight on yank +autocmd("TextYankPost", { + callback = function() + vim.highlight.on_yank() + end, +}) diff --git a/modules/home/rsydn/programs/nvim/lua/config/keymaps.lua b/modules/home/rsydn/programs/nvim/lua/config/keymaps.lua index 2c134f7..6ee10ee 100644 --- a/modules/home/rsydn/programs/nvim/lua/config/keymaps.lua +++ b/modules/home/rsydn/programs/nvim/lua/config/keymaps.lua @@ -1,3 +1,9 @@ --- Keymaps are automatically loaded on the VeryLazy event --- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua --- Add any additional keymaps here +-- Essential keymaps (minimal improvements over default Vim) +local keymap = vim.keymap + +-- Clear search highlight with +keymap.set("n", "", "noh", { desc = "Clear search highlight" }) + +-- Better indenting (stay in visual mode) +keymap.set("v", "<", "", ">gv") diff --git a/modules/home/rsydn/programs/nvim/lua/config/lazy.lua b/modules/home/rsydn/programs/nvim/lua/config/lazy.lua index 749b7e4..c24f16f 100644 --- a/modules/home/rsydn/programs/nvim/lua/config/lazy.lua +++ b/modules/home/rsydn/programs/nvim/lua/config/lazy.lua @@ -13,38 +13,27 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then end end vim.opt.rtp:prepend(lazypath) - +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" require("lazy").setup({ spec = { - -- add LazyVim and import its plugins - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - -- import/override with your plugins + { import = "plugins" }, + { import = "config.lazyvim" }, }, - -- Put the lockfile somewhere writable when the config directory is managed by Nix - lockfile = vim.fn.stdpath("state") .. "/lazy-lock.json", - defaults = { - -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. - -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. - lazy = false, - -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, - -- have outdated releases, which may break your Neovim install. - version = false, -- always use the latest git commit - -- version = "*", -- try installing the latest stable version for plugins that support semver - }, - install = { colorscheme = { "tokyonight", "habamax" } }, - checker = { - enabled = true, -- check for plugin updates periodically - notify = false, -- notify on update - }, -- automatically check for plugin updates + + + install = { colorscheme = { "gruvbox", "habamax" } }, + + checker = { enabled = false }, + change_detection = { notify = false }, performance = { rtp = { - -- disable some rtp plugins disabled_plugins = { "gzip", - -- "matchit", - -- "matchparen", - -- "netrwPlugin", + "matchit", + "matchparen", + "netrwPlugin", "tarPlugin", "tohtml", "tutor", diff --git a/modules/home/rsydn/programs/nvim/lua/config/lazyvim/lsp.lua b/modules/home/rsydn/programs/nvim/lua/config/lazyvim/lsp.lua new file mode 100644 index 0000000..db6ab11 --- /dev/null +++ b/modules/home/rsydn/programs/nvim/lua/config/lazyvim/lsp.lua @@ -0,0 +1,70 @@ +-- Enable language servers defined in nvim-lspconfig using the Nvim 0.11 API. +return { + { + "mason-org/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + local ensure = { + "clangd", + "gopls", + "lua-language-server", + "nil", + "pyright", + "rust-analyzer", + "typescript-language-server", + } + for _, tool in ipairs(ensure) do + if not vim.tbl_contains(opts.ensure_installed, tool) then + table.insert(opts.ensure_installed, tool) + end + end + end, + }, + { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + opts = function(_, opts) + opts.servers = vim.tbl_deep_extend( + "force", + { + lua_ls = {}, + nil_ls = {}, + pyright = {}, + ts_ls = {}, + rust_analyzer = {}, + gopls = {}, + clangd = {}, + }, + opts.servers or {} + ) + end, + config = function(_, opts) + if vim.fn.has("nvim-0.11") == 0 then + vim.notify("nvim-lspconfig requires Neovim 0.11+ for vim.lsp.config", vim.log.levels.ERROR) + return + end + + for name, server_opts in pairs(opts.servers or {}) do + if server_opts ~= false then + local config = type(server_opts) == "table" and vim.deepcopy(server_opts) or {} + + if config.enabled ~= false then + config.enabled = nil + + -- Integrate blink.cmp capabilities with LSP + local has_blink, blink = pcall(require, "blink.cmp") + if has_blink then + config.capabilities = blink.get_lsp_capabilities(config.capabilities) + end + + if next(config) ~= nil then + vim.lsp.config(name, config) + end + + vim.lsp.enable(name) + end + end + end + end, + }, +} diff --git a/modules/home/rsydn/programs/nvim/lua/config/options.lua b/modules/home/rsydn/programs/nvim/lua/config/options.lua index 3ea1454..332532c 100644 --- a/modules/home/rsydn/programs/nvim/lua/config/options.lua +++ b/modules/home/rsydn/programs/nvim/lua/config/options.lua @@ -1,3 +1,38 @@ --- Options are automatically loaded before lazy.nvim startup --- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua --- Add any additional options here +-- Minimal essential options +local opt = vim.opt + +-- Leader keys +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Line numbers +opt.number = true +opt.relativenumber = true + +-- Indentation +opt.tabstop = 2 +opt.shiftwidth = 2 +opt.expandtab = true +opt.smartindent = true + +-- Search +opt.ignorecase = true +opt.smartcase = true + +-- UI +opt.termguicolors = true +opt.signcolumn = "yes" +opt.cursorline = true + +-- Splits +opt.splitbelow = true +opt.splitright = true + +-- Clipboard +opt.clipboard = "unnamedplus" + +-- Undo +opt.undofile = true + +-- Mouse +opt.mouse = "a" diff --git a/modules/home/rsydn/programs/nvim/lua/plugins/coding.lua b/modules/home/rsydn/programs/nvim/lua/plugins/coding.lua new file mode 100644 index 0000000..3468c0f --- /dev/null +++ b/modules/home/rsydn/programs/nvim/lua/plugins/coding.lua @@ -0,0 +1,84 @@ +return { + -- Auto pairs + -- Automatically inserts a matching closing character + -- when you type an opening character like `"`, `[`, or `(`. + { + "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, + }, + config = function(_, opts) + LazyVim.mini.pairs(opts) + end, + }, + + -- Improves comment syntax, lets Neovim handle multiple + -- types of comments for a single language, and relaxes rules + -- for uncommenting. + { + "folke/ts-comments.nvim", + event = "VeryLazy", + opts = {}, + }, + + -- Extends the a & i text objects, this adds the ability to select + -- arguments, function calls, text within quotes and brackets + { + "nvim-mini/mini.ai", + event = "VeryLazy", + opts = function() + local ai = require("mini.ai") + return { + n_lines = 500, + custom_textobjects = { + o = ai.gen_spec.treesitter({ + a = { "@block.outer", "@conditional.outer", "@loop.outer" }, + i = { "@block.inner", "@conditional.inner", "@loop.inner" }, + }), + f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }), + c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }), + t = { "<(%p%w-)%f[^<%w][^<>]->.*()$" }, + d = { "%f[%d]%d+" }, + e = { { "%u[%l%d]+%f[^%l%d]", "%f[%S][%l%d]+%f[^%l%d]" }, "^().*()$" }, + g = LazyVim.mini.ai_buffer, + u = ai.gen_spec.function_call(), + U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), + }, + } + end, + config = function(_, opts) + require("mini.ai").setup(opts) + LazyVim.on_load("which-key.nvim", function() + vim.schedule(function() + LazyVim.mini.ai_whichkey(opts) + end) + end) + end, + }, + + -- Configures LuaLS to support auto-completion and type checking + -- while editing your Neovim configuration. + { + "folke/lazydev.nvim", + ft = "lua", + cmd = "LazyDev", + opts = { + library = { + { path = "${3rd}/luv/library", words = { "vim.uv" } }, + { path = "LazyVim", words = { "LazyVim" } }, + { path = "snacks.nvim", words = { "Snacks" } }, + { path = "lazy.nvim", words = { "LazyVim" } }, + }, + }, + }, +} diff --git a/modules/home/rsydn/programs/nvim/lua/plugins/colorscheme.lua b/modules/home/rsydn/programs/nvim/lua/plugins/colorscheme.lua index 539e01a..4ac478e 100644 --- a/modules/home/rsydn/programs/nvim/lua/plugins/colorscheme.lua +++ b/modules/home/rsydn/programs/nvim/lua/plugins/colorscheme.lua @@ -1,15 +1,71 @@ return { + -- gruvbox { "ellisonleao/gruvbox.nvim", + lazy = true, priority = 1000, + opts = {}, + }, + + -- tokyonight + { + "folke/tokyonight.nvim", + lazy = true, + opts = { style = "moon" }, + }, + + -- catppuccin + { + "catppuccin/nvim", + lazy = false, + priority = 1000, + name = "catppuccin", opts = { - terminal_colors = true, - transparent_mode = false, + lsp_styles = { + underlines = { + errors = { "undercurl" }, + hints = { "undercurl" }, + warnings = { "undercurl" }, + information = { "undercurl" }, + }, + }, + -- integrations = { + -- aerial = true, + -- alpha = true, + -- cmp = true, + -- dashboard = true, + -- flash = true, + -- fzf = true, + -- grug_far = true, + -- gitsigns = true, + -- headlines = true, + -- illuminate = true, + -- indent_blankline = { enabled = true }, + -- leap = true, + -- lsp_trouble = true, + -- mason = true, + -- mini = true, + -- navic = { enabled = true, custom_bg = "lualine" }, + -- neotest = true, + -- neotree = true, + -- noice = true, + -- notify = true, + -- snacks = true, + -- telescope = true, + -- treesitter_context = true, + -- which_key = true, + -- }, }, - config = function(_, opts) - require("gruvbox").setup(opts) - vim.o.background = "dark" - vim.cmd.colorscheme("gruvbox") - end, + -- specs = { + -- { + -- "akinsho/bufferline.nvim", + -- optional = true, + -- opts = function(_, opts) + -- if (vim.g.colors_name or ""):find("catppuccin") then + -- opts.highlights = require("catppuccin.special.bufferline").get_theme() + -- end + -- end, + -- }, + -- }, }, } diff --git a/modules/home/rsydn/programs/nvim/lua/plugins/completion.lua b/modules/home/rsydn/programs/nvim/lua/plugins/completion.lua new file mode 100644 index 0000000..d9f297e --- /dev/null +++ b/modules/home/rsydn/programs/nvim/lua/plugins/completion.lua @@ -0,0 +1,44 @@ +return { + -- Modern completion engine with built-in fuzzy matching + { + "saghen/blink.cmp", + dependencies = { + "rafamadriz/friendly-snippets", + }, + version = "1.*", + event = "InsertEnter", + opts = { + -- Keymap preset options: 'default' | 'super-tab' | 'enter' + keymap = { preset = "default" }, + + appearance = { + -- Use mono nerd font variant + nerd_font_variant = "mono", + }, + + -- Default completion sources + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, + + completion = { + documentation = { + auto_show = true, + auto_show_delay_ms = 500, + }, + menu = { + draw = { + columns = { { "label", "label_description", gap = 1 }, { "kind_icon", "kind" } }, + }, + }, + }, + + -- Fuzzy matching implementation + -- Options: "prefer_rust_with_warning" | "rust" | "lua" + fuzzy = { + implementation = "prefer_rust_with_warning", + }, + }, + opts_extend = { "sources.default" }, + }, +} diff --git a/modules/home/rsydn/programs/nvim/lua/plugins/file-explorer.lua b/modules/home/rsydn/programs/nvim/lua/plugins/file-explorer.lua new file mode 100644 index 0000000..b9672f5 --- /dev/null +++ b/modules/home/rsydn/programs/nvim/lua/plugins/file-explorer.lua @@ -0,0 +1,60 @@ +return { + -- Telescope - Fuzzy finder over lists + { + "nvim-telescope/telescope.nvim", + tag = "0.1.8", + dependencies = { + "nvim-lua/plenary.nvim", + }, + cmd = "Telescope", + keys = { + { "ff", "Telescope find_files", desc = "Find Files" }, + { "fg", "Telescope live_grep", desc = "Live Grep" }, + { "fb", "Telescope buffers", desc = "Buffers" }, + { "fh", "Telescope help_tags", desc = "Help Tags" }, + }, + opts = { + defaults = { + mappings = { + i = { + [""] = "which_key", + }, + }, + }, + }, + }, + + -- Telescope FZF native - Better sorting performance + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + dependencies = { "nvim-telescope/telescope.nvim" }, + config = function() + require("telescope").load_extension("fzf") + end, + }, + + -- Neo-tree - File explorer tree + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + "nvim-tree/nvim-web-devicons", + }, + cmd = "Neotree", + keys = { + { "e", "Neotree toggle", desc = "Toggle Neo-tree" }, + { "o", "Neotree focus", desc = "Focus Neo-tree" }, + }, + opts = { + filesystem = { + follow_current_file = { + enabled = true, + }, + use_libuv_file_watcher = true, + }, + }, + }, +} diff --git a/modules/home/rsydn/programs/nvim/lua/plugins/linting.lua b/modules/home/rsydn/programs/nvim/lua/plugins/linting.lua new file mode 100644 index 0000000..28dbe19 --- /dev/null +++ b/modules/home/rsydn/programs/nvim/lua/plugins/linting.lua @@ -0,0 +1,48 @@ +return { + { + "mfussenegger/nvim-lint", + event = { "BufReadPost", "BufNewFile", "BufWritePost" }, + opts = { + events = { "BufWritePost", "BufReadPost", "InsertLeave" }, + linters_by_ft = { + -- Add linters per filetype here + -- fish = { "fish" }, + -- javascript = { "eslint_d" }, + -- python = { "ruff" }, + }, + linters = {}, + }, + config = function(_, opts) + local lint = require("lint") + + -- Merge custom linter configs + for name, linter in pairs(opts.linters) do + if type(linter) == "table" and type(lint.linters[name]) == "table" then + lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter) + else + lint.linters[name] = linter + end + end + + lint.linters_by_ft = opts.linters_by_ft + + -- Debounced lint function + local function debounce_lint() + local timer = vim.uv.new_timer() + return function() + timer:start(100, 0, vim.schedule_wrap(lint.try_lint)) + end + end + + local lint_fn = debounce_lint() + + -- Create autocommand for linting + vim.api.nvim_create_autocmd(opts.events, { + group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }), + callback = function() + lint_fn() + end, + }) + end, + }, +} diff --git a/modules/home/rsydn/programs/nvim/lua/plugins/lsp.lua b/modules/home/rsydn/programs/nvim/lua/plugins/lsp.lua deleted file mode 100644 index 1196cf1..0000000 --- a/modules/home/rsydn/programs/nvim/lua/plugins/lsp.lua +++ /dev/null @@ -1,29 +0,0 @@ --- Declare language servers provided via Nix so LazyVim skips Mason installs. -return { - { - "mason-org/mason.nvim", - opts = function(_, opts) - opts.ensure_installed = {} - end, - }, - { - "neovim/nvim-lspconfig", - opts = function(_, opts) - opts.servers = opts.servers or {} - local servers = { - lua_ls = { mason = false }, - nil_ls = { mason = false }, - pyright = { mason = false }, - tsserver = { mason = false }, - rust_analyzer = { mason = false }, - gopls = { mason = false }, - clangd = { mason = false }, - } - - for server, server_opts in pairs(servers) do - local existing = opts.servers[server] or {} - opts.servers[server] = vim.tbl_deep_extend("force", existing, server_opts) - end - end, - }, -} diff --git a/modules/home/rsydn/programs/nvim/lua/plugins/mini.lua b/modules/home/rsydn/programs/nvim/lua/plugins/mini.lua deleted file mode 100644 index 9167146..0000000 --- a/modules/home/rsydn/programs/nvim/lua/plugins/mini.lua +++ /dev/null @@ -1,6 +0,0 @@ --- Override mini.pick with the new repository location -return { - { - "nvim-mini/mini.pick", - }, -} diff --git a/modules/home/rsydn/programs/nvim/lua/plugins/smear-cursor.lua b/modules/home/rsydn/programs/nvim/lua/plugins/smear-cursor.lua deleted file mode 100644 index 2916f2b..0000000 --- a/modules/home/rsydn/programs/nvim/lua/plugins/smear-cursor.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - { - "sphamba/smear-cursor.nvim", - opts = {}, - }, -} diff --git a/modules/home/rsydn/programs/nvim/lua/plugins/treesitter.lua b/modules/home/rsydn/programs/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..5bbd4a1 --- /dev/null +++ b/modules/home/rsydn/programs/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,42 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + version = false, + build = ":TSUpdate", + event = { "BufReadPost", "BufNewFile" }, + cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, + opts = { + highlight = { enable = true }, + indent = { enable = true }, + ensure_installed = { + "bash", + "c", + "diff", + "html", + "javascript", + "jsdoc", + "json", + "jsonc", + "lua", + "luadoc", + "luap", + "markdown", + "markdown_inline", + "printf", + "python", + "query", + "regex", + "toml", + "tsx", + "typescript", + "vim", + "vimdoc", + "xml", + "yaml", + }, + }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, + }, +} diff --git a/modules/home/rsydn/programs/nvim/lua/plugins/ui.lua b/modules/home/rsydn/programs/nvim/lua/plugins/ui.lua new file mode 100644 index 0000000..60b5122 --- /dev/null +++ b/modules/home/rsydn/programs/nvim/lua/plugins/ui.lua @@ -0,0 +1,174 @@ +return { + -- Better UI for messages, cmdline and the popupmenu + { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + lsp = { + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + routes = { + { + filter = { + event = "msg_show", + any = { + { find = "%d+L, %d+B" }, + { find = "; after #%d+" }, + { find = "; before #%d+" }, + }, + }, + view = "mini", + }, + }, + presets = { + bottom_search = true, + command_palette = true, + long_message_to_split = true, + }, + }, + keys = { + { "sn", "", desc = "+noice" }, + { "snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" }, + { "snh", function() require("noice").cmd("history") end, desc = "Noice History" }, + { "sna", function() require("noice").cmd("all") end, desc = "Noice All" }, + { "snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" }, + }, + dependencies = { + "MunifTanjim/nui.nvim", + }, + }, + + -- Statusline + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + options = { + theme = "auto", + globalstatus = true, + disabled_filetypes = { statusline = { "dashboard", "alpha", "starter" } }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch" }, + lualine_c = { + { + "diagnostics", + symbols = { + error = " ", + warn = " ", + info = " ", + hint = " ", + }, + }, + { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, + { "filename", path = 1, symbols = { modified = " ", readonly = "", unnamed = "" } }, + }, + lualine_x = { + { + "diff", + symbols = { + added = " ", + modified = " ", + removed = " ", + }, + }, + }, + lualine_y = { + { "progress", separator = " ", padding = { left = 1, right = 0 } }, + { "location", padding = { left = 0, right = 1 } }, + }, + lualine_z = { + function() + return " " .. os.date("%R") + end, + }, + }, + extensions = { "lazy" }, + } + end, + }, + + -- Bufferline + { + "akinsho/bufferline.nvim", + event = "VeryLazy", + keys = { + { "bp", "BufferLineTogglePin", desc = "Toggle Pin" }, + { "bP", "BufferLineGroupClose ungrouped", desc = "Delete Non-Pinned Buffers" }, + { "bo", "BufferLineCloseOthers", desc = "Delete Other Buffers" }, + { "br", "BufferLineCloseRight", desc = "Delete Buffers to the Right" }, + { "bl", "BufferLineCloseLeft", desc = "Delete Buffers to the Left" }, + { "", "BufferLineCyclePrev", desc = "Prev Buffer" }, + { "", "BufferLineCycleNext", desc = "Next Buffer" }, + { "[b", "BufferLineCyclePrev", desc = "Prev Buffer" }, + { "]b", "BufferLineCycleNext", desc = "Next Buffer" }, + }, + opts = { + options = { + close_command = function(n) require("mini.bufremove").delete(n, false) end, + right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end, + diagnostics = "nvim_lsp", + always_show_bufferline = false, + offsets = { + { + filetype = "neo-tree", + text = "Neo-tree", + highlight = "Directory", + text_align = "left", + }, + }, + }, + }, + dependencies = { + { + "nvim-mini/mini.bufremove", + keys = { + { "bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" }, + { "bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" }, + }, + opts = {}, + }, + }, + }, + + -- Indent guides + { + "lukas-reineke/indent-blankline.nvim", + event = { "BufReadPost", "BufNewFile" }, + opts = { + indent = { + char = "│", + tab_char = "│", + }, + scope = { show_start = false, show_end = false }, + exclude = { + filetypes = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + }, + }, + main = "ibl", + }, + + -- Icons + { + "nvim-tree/nvim-web-devicons", + lazy = true, + }, +} diff --git a/modules/home/rsydn/programs/nvim/stylua.toml b/modules/home/rsydn/programs/nvim/stylua.toml deleted file mode 100644 index 5d6c50d..0000000 --- a/modules/home/rsydn/programs/nvim/stylua.toml +++ /dev/null @@ -1,3 +0,0 @@ -indent_type = "Spaces" -indent_width = 2 -column_width = 120 \ No newline at end of file