From b76db809f2f8634f4ed55c7154b62954061daa77 Mon Sep 17 00:00:00 2001 From: voidarc Date: Fri, 10 Apr 2026 20:55:51 +0100 Subject: [PATCH] added a load of nonsense and fixed the flake --- flake.nix | 25 ++----------- lua/config/binds.lua | 19 +++++++--- lua/plugins/completion/conform.lua | 36 ++++++++++++++++++- lua/plugins/completion/lspconfig.lua | 14 +++++--- lua/plugins/ui/catppuccin.lua | 10 +++++- lua/plugins/utils/convenience.lua | 54 ++++++++++++++++++++++++++++ nvim-pack-lock.json | 28 +++++++++++++++ test.ts | 1 + 8 files changed, 152 insertions(+), 35 deletions(-) create mode 100644 lua/plugins/utils/convenience.lua create mode 100644 test.ts diff --git a/flake.nix b/flake.nix index e0fa78e..b61e05e 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,7 @@ vscode-langservers-extracted emmet-ls rust-analyzer + ast-grep prettier black nixfmt @@ -33,32 +34,10 @@ tree-sitter ripgrep gcc + fzf gnumake imagemagick - luajitPackages.magick - ghostscript luarocks - - (texlive.combine { - inherit (texlive) - scheme-basic - varwidth - preview - mathtools - amsfonts - amscdx - xcolor - dvisvgm - dvipng - wrapfig - standalone - graphicxbox - amsmath - ulem - hyperref - capt-of - ; - }) ]; nvim-wrapped = pkgs.symlinkJoin { diff --git a/lua/config/binds.lua b/lua/config/binds.lua index 0920543..00c06cc 100644 --- a/lua/config/binds.lua +++ b/lua/config/binds.lua @@ -26,9 +26,18 @@ end Keymap("i", "", "") -- C-Backscpace for whole words --- Open Lazygit -Keymap("n", "l", function() - Snacks.lazygit.open() -end) - Keymap("n", "d", "lua vim.diagnostic.open_float()") -- Diagnostics for Linter + +-- Flash keymaps +Keymap("n", "ss", function() + require("flash").jump() +end) +Keymap("n", "S", function() + require("flash").treesitter() +end) +Keymap("n", "r", function() + require("flash").remote() +end) +Keymap("n", "R", function() + require("flash").treesitter_search() +end) diff --git a/lua/plugins/completion/conform.lua b/lua/plugins/completion/conform.lua index 50404d7..850c086 100644 --- a/lua/plugins/completion/conform.lua +++ b/lua/plugins/completion/conform.lua @@ -1,4 +1,7 @@ -vim.pack.add({ { src = "https://github.com/stevearc/conform.nvim", name = "conform" } }) +vim.pack.add({ + { src = "https://github.com/stevearc/conform.nvim", name = "conform" }, + { src = "https://github.com/mfussenegger/nvim-lint", name = "lint" }, +}) require("conform").setup({ formatters_by_ft = { @@ -12,3 +15,34 @@ require("conform").setup({ format_on_save = true, undojoin = true, }) + +local lint = require("lint") + +-- Only show diagnostics close to the cursor +vim.diagnostic.config({ + virtual_text = { + spacing = 4, + prefix = function(diagnostic) + local icons = { + [vim.diagnostic.severity.ERROR] = " ", + [vim.diagnostic.severity.WARN] = "󰉀 ", + [vim.diagnostic.severity.INFO] = " ", + [vim.diagnostic.severity.HINT] = "󰌵 ", + } + return icons[diagnostic.severity] or "" + end, + }, + signs = false, + underline = true, + update_in_insert = false, +}) + +-- Auto-run the linter only for the configured filetypes +vim.api.nvim_create_autocmd("BufWritePost", { + callback = function() + local ft = vim.bo.filetype + if lint.linters_by_ft[ft] then + lint.try_lint() + end + end, +}) diff --git a/lua/plugins/completion/lspconfig.lua b/lua/plugins/completion/lspconfig.lua index 405c7ea..6985c7d 100644 --- a/lua/plugins/completion/lspconfig.lua +++ b/lua/plugins/completion/lspconfig.lua @@ -1,6 +1,7 @@ vim.pack.add({ { src = "https://github.com/neovim/nvim-lspconfig", name = "lspconfig" }, { src = "https://github.com/saghen/blink.cmp", name = "blink" }, + { src = "https://github.com/folke/lazydev.nvim", name = "lazydev" }, }) vim.lsp.config("lua_ls", { @@ -41,10 +42,6 @@ vim.lsp.enable({ vim.o.pumborder = "rounded" require("blink.cmp").setup({ - -- Snippet configuration - -- snippets = { - -- preset = "luasnip", -- Tells blink.cmp to use LuaSnip - -- }, fuzzy = { implementation = "lua" }, @@ -67,11 +64,11 @@ require("blink.cmp").setup({ }, sources = { default = { + -- "lazydev", "lsp", -- (Equivalent to cmp-nvim-lsp) "snippets", -- (Handled by the snippets config, replaces cmp_luasnip source) "buffer", -- (Equivalent to cmp-buffer) "path", -- (Equivalent to cmp-path) - -- "cmdline", -- Generally configured separately, but often included by default }, providers = { -- lazydev = { @@ -83,3 +80,10 @@ require("blink.cmp").setup({ }, }, }) + +vim.api.nvim_create_autocmd("FileType", { + pattern = "lua", + callback = function() + require("lazydev").setup() + end, +}) diff --git a/lua/plugins/ui/catppuccin.lua b/lua/plugins/ui/catppuccin.lua index 2a20a0c..9226ac7 100644 --- a/lua/plugins/ui/catppuccin.lua +++ b/lua/plugins/ui/catppuccin.lua @@ -1,4 +1,7 @@ -vim.pack.add({ { src = "https://github.com/catppuccin/nvim", name = "catppuccin" } }) +vim.pack.add({ + { src = "https://github.com/catppuccin/nvim", name = "catppuccin" }, + { src = "https://github.com/tadaa/vimade", name = "vimade" }, +}) require("catppuccin").setup({ transparent_background = true, -- disables setting the background color. @@ -8,3 +11,8 @@ require("catppuccin").setup({ }, show_end_of_buffer = true, -- shows the '~' characters after the end of buffers }) + +require("vimade").setup({ + recipe = { "minimalist", { animate = true } }, + fadelevel = 0.6, +}) diff --git a/lua/plugins/utils/convenience.lua b/lua/plugins/utils/convenience.lua new file mode 100644 index 0000000..0b89e39 --- /dev/null +++ b/lua/plugins/utils/convenience.lua @@ -0,0 +1,54 @@ +vim.pack.add({ + { src = "https://github.com/okuuva/auto-save.nvim", name = "autosave" }, + { src = "https://github.com/vladdoster/remember.nvim", name = "remember" }, + { src = "https://github.com/Aasim-A/scrollEOF.nvim", name = "scrolleof" }, + { src = "https://github.com/folke/flash.nvim", name = "flash" }, +}) + +require("auto-save").setup({ + enabled = true, + trigger_events = { + immediate_save = { "BufLeave", "FocusLost", "QuitPre", "VimSuspend" }, + defer_save = { "InsertLeave" }, -- save after debounce + cancel_deferred_save = { "InsertEnter" }, -- cancel pending save + }, + debounce_delay = 1000, + noautocmd = true, +}) + +local group = vim.api.nvim_create_augroup("autosave", {}) + +-- Notification to say when a file is saved +vim.api.nvim_create_autocmd("User", { + pattern = "AutoSaveWritePre", + group = group, + callback = function(opts) + if opts.data.saved_buffer ~= nil then + local filename = vim.fn.expand("%:t") + print("Saved '" .. filename .. "' at " .. vim.fn.strftime("%H:%M:%S")) + end + end, +}) + +-- Notification when enabling/disabling autosave for a buffer +vim.api.nvim_create_autocmd("User", { + pattern = "AutoSaveEnable", + group = group, + callback = function(opts) + print("AutoSave enabled") + end, +}) + +vim.api.nvim_create_autocmd("User", { + pattern = "AutoSaveDisable", + group = group, + callback = function(opts) + print("AutoSave disabled") + end, +}) + +-- enable remember +require("remember").setup({}) + +-- enable scrolleof +require("scrollEOF").setup() diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json index 011ae33..d79e3f3 100644 --- a/nvim-pack-lock.json +++ b/nvim-pack-lock.json @@ -1,5 +1,9 @@ { "plugins": { + "autosave": { + "rev": "9aabcb8396224dcbf8d51c0c1d620d88a46e89d7", + "src": "https://github.com/okuuva/auto-save.nvim" + }, "blink": { "rev": "456d38d1cd3743926f329204c2340f3e7840aad6", "src": "https://github.com/saghen/blink.cmp" @@ -16,6 +20,18 @@ "rev": "c72328a5494b4502947a022fe69c0c47e53b6aa6", "src": "https://github.com/nvim-tree/nvim-web-devicons" }, + "flash": { + "rev": "fcea7ff883235d9024dc41e638f164a450c14ca2", + "src": "https://github.com/folke/flash.nvim" + }, + "lazydev": { + "rev": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d", + "src": "https://github.com/folke/lazydev.nvim" + }, + "lint": { + "rev": "eab58b48eb11d7745c11c505e0f3057165902461", + "src": "https://github.com/mfussenegger/nvim-lint" + }, "lspconfig": { "rev": "c588db330592fa477a70d2fee6ba20a57194bdc3", "src": "https://github.com/neovim/nvim-lspconfig" @@ -56,9 +72,21 @@ "rev": "74b06c6c75e4eeb3108ec01852001636d85a932b", "src": "https://github.com/nvim-lua/plenary.nvim" }, + "remember": { + "rev": "85aff6dc0a5adab088ef6b9210585ded31c32c7b", + "src": "https://github.com/vladdoster/remember.nvim" + }, + "scrolleof": { + "rev": "e462b9a07b8166c3e8011f1dcbc6bf68b67cd8d7", + "src": "https://github.com/Aasim-A/scrollEOF.nvim" + }, "treesitter": { "rev": "4916d6592ede8c07973490d9322f187e07dfefac", "src": "https://github.com/nvim-treesitter/nvim-treesitter" + }, + "vimade": { + "rev": "9b2eacd9c97c0bb547f6f3a27e8b5b7a70ad4d03", + "src": "https://github.com/tadaa/vimade" } } } diff --git a/test.ts b/test.ts new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test.ts @@ -0,0 +1 @@ +