From 7282fcd409ce48cf53ad61034fc232510b2785fd Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Fri, 8 Aug 2025 13:08:25 +0200 Subject: [PATCH] nvim: formatting and minor fixes --- .../nvim/lua/thegeneralist/lazy/blink.lua | 158 +++++++-------- .../nvim/lua/thegeneralist/lazy/init.lua | 187 +++++++++--------- .../nvim/lua/thegeneralist/lazy/lsp.lua | 1 - .../nvim/lua/thegeneralist/lazy/nullls.lua | 77 ++++---- .../dotfiles/nvim/lua/thegeneralist/remap.lua | 19 +- 5 files changed, 225 insertions(+), 217 deletions(-) diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua index 3fc3e92..dcdc4c3 100644 --- a/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua @@ -1,84 +1,88 @@ return { - { - "saghen/blink.cmp", - dependencies = { "rafamadriz/friendly-snippets" }, - version = "1.*", - opts = { - -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) - -- 'super-tab' for mappings similar to vscode (tab to accept) - -- 'enter' for enter to accept - -- 'none' for no mappings - -- - -- All presets have the following mappings: - -- 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) - -- - -- See :h blink-cmp-config-keymap for defining your own keymap - keymap = { preset = "default" }, + { + "saghen/blink.cmp", + dependencies = { "rafamadriz/friendly-snippets" }, + version = "1.*", + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- 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) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { + preset = "default", + [""] = { "select_and_accept" }, + [""] = { "select_next", "fallback_to_mappings" }, + }, - appearance = { - nerd_font_variant = "mono", - }, + appearance = { + nerd_font_variant = "mono", + }, - -- (Default) Only show the documentation popup when manually triggered - completion = { documentation = { auto_show = false } }, + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = false } }, - -- Default list of enabled providers defined so that you can extend it - -- elsewhere in your config, without redefining it, due to `opts_extend` - sources = { - default = { "lsp", "path", "snippets", "buffer" }, - }, + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + 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" }, - }, + -- (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" }, + }, - -- { - -- 'neovim/nvim-lspconfig', - -- dependencies = { - -- 'saghen/blink.cmp', - -- 'williamboman/mason.nvim', - -- 'mason-org/mason-registry', - -- 'williamboman/mason-lspconfig.nvim', - -- 'L3MON4D3/LuaSnip', - -- 'saadparwaiz1/cmp_luasnip', - -- 'j-hui/fidget.nvim', - -- }, - -- - -- -- example using `opts` for defining servers - -- opts = { - -- servers = { - -- lua_ls = {} - -- } - -- }, - -- config = function(_, opts) - -- require("fidget").setup({}) - -- require("mason").setup() - -- - -- local lspconfig = require('mason-lspconfig') - -- for server, config in pairs(opts.servers) do - -- -- passing config.capabilities to blink.cmp merges with the capabilities in your - -- -- `opts[server].capabilities, if you've defined it - -- print('configuring server:', server) - -- config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) - -- require("lspconfig")[server].setup(config) - -- end - -- end - -- - -- example calling setup directly for each LSP - -- config = function() - -- local capabilities = require('blink.cmp').get_lsp_capabilities() - -- local lspconfig = require('lspconfig') - -- - -- lspconfig['lua_ls'].setup({ capabilities = capabilities }) - -- end - -- }, + -- { + -- 'neovim/nvim-lspconfig', + -- dependencies = { + -- 'saghen/blink.cmp', + -- 'williamboman/mason.nvim', + -- 'mason-org/mason-registry', + -- 'williamboman/mason-lspconfig.nvim', + -- 'L3MON4D3/LuaSnip', + -- 'saadparwaiz1/cmp_luasnip', + -- 'j-hui/fidget.nvim', + -- }, + -- + -- -- example using `opts` for defining servers + -- opts = { + -- servers = { + -- lua_ls = {} + -- } + -- }, + -- config = function(_, opts) + -- require("fidget").setup({}) + -- require("mason").setup() + -- + -- local lspconfig = require('mason-lspconfig') + -- for server, config in pairs(opts.servers) do + -- -- passing config.capabilities to blink.cmp merges with the capabilities in your + -- -- `opts[server].capabilities, if you've defined it + -- print('configuring server:', server) + -- config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) + -- require("lspconfig")[server].setup(config) + -- end + -- end + -- + -- example calling setup directly for each LSP + -- config = function() + -- local capabilities = require('blink.cmp').get_lsp_capabilities() + -- local lspconfig = require('lspconfig') + -- + -- lspconfig['lua_ls'].setup({ capabilities = capabilities }) + -- end + -- }, } diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/init.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/init.lua index fb7a1a6..6cc7027 100644 --- a/modules/dotfiles/nvim/lua/thegeneralist/lazy/init.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/init.lua @@ -1,101 +1,106 @@ return { - { - "lukas-reineke/indent-blankline.nvim", - main = "ibl", - ---@module "ibl" - ---@type ibl.config - opts = {}, - }, - --[[ { + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + ---@module "ibl" + ---@type ibl.config + opts = {}, + }, + --[[ { 'boganworld/crackboard.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { session_key = 'redacted', }, }, ]] - { - "onsails/lspkind-nvim", - }, - -- { - -- "ziglang/zig.vim", - -- }, - { - "nvim-lua/plenary.nvim", - name = "plenary", - }, - { - "stevearc/oil.nvim", - config = function() - require("oil").setup() - end, - }, - -- { - -- -- https://github.com/zbirenbaum/copilot.lua - -- "zbirenbaum/copilot.lua", - -- cmd = "Copilot", - -- event = "InsertEnter", - -- config = function() - -- require("copilot").setup({ - -- panel = { - -- keymap = { - -- jump_prev = "]]", - -- jump_next = "[[", - -- accept = "", - -- refresh = "gr", - -- open = "", - -- }, - -- }, - -- suggestion = { - -- auto_trigger = true, - -- keymap = { - -- accept = "", - -- }, - -- }, - -- }) - -- -- vim.keymap.set("n", "cpe", "Copilot enable") - -- -- vim.keymap.set("n", "cpd", "Copilot disable") - -- end, - -- }, - { - "github/copilot.vim", - config = function() - -- set cpd and cpe to disable/enable copilot - vim.keymap.set("n", "cpe", "Copilot enable") - vim.keymap.set("n", "cpd", "Copilot disable") - end, - }, - -- { - -- "Exafunction/codeium.nvim", - -- dependencies = { - -- "nvim-lua/plenary.nvim", - -- "hrsh7th/nvim-cmp", - -- }, - -- config = function() - -- require("codeium").setup({ - -- -- https://github.com/Exafunction/codeium.vim - -- }) - -- end - -- }, - { - "ldelossa/gh.nvim", - dependencies = { - "ldelossa/litee.nvim", - }, - }, - "eandrju/cellular-automaton.nvim", - "gpanders/editorconfig.nvim", + { + "onsails/lspkind-nvim", + }, + -- { + -- "ziglang/zig.vim", + -- }, + { + "nvim-lua/plenary.nvim", + name = "plenary", + }, + { + "stevearc/oil.nvim", + config = function() + require("oil").setup() + end, + }, + -- { + -- -- https://github.com/zbirenbaum/copilot.lua + -- "zbirenbaum/copilot.lua", + -- cmd = "Copilot", + -- event = "InsertEnter", + -- config = function() + -- require("copilot").setup({ + -- panel = { + -- keymap = { + -- jump_prev = "]]", + -- jump_next = "[[", + -- accept = "", + -- refresh = "gr", + -- open = "", + -- }, + -- }, + -- suggestion = { + -- auto_trigger = true, + -- keymap = { + -- accept = "", + -- }, + -- }, + -- }) + -- -- vim.keymap.set("n", "cpe", "Copilot enable") + -- -- vim.keymap.set("n", "cpd", "Copilot disable") + -- end, + -- }, + { + "github/copilot.vim", + config = function() + -- set cpd and cpe to disable/enable copilot + vim.keymap.set("n", "cpe", "Copilot enable") + vim.keymap.set("n", "cpd", "Copilot disable") + vim.keymap.set("i", "", 'copilot#Accept("\\")', { + expr = true, + replace_keycodes = false, + }) + vim.g.copilot_no_tab_map = true + end, + }, + -- { + -- "Exafunction/codeium.nvim", + -- dependencies = { + -- "nvim-lua/plenary.nvim", + -- "hrsh7th/nvim-cmp", + -- }, + -- config = function() + -- require("codeium").setup({ + -- -- https://github.com/Exafunction/codeium.vim + -- }) + -- end + -- }, + { + "ldelossa/gh.nvim", + dependencies = { + "ldelossa/litee.nvim", + }, + }, + "eandrju/cellular-automaton.nvim", + "gpanders/editorconfig.nvim", - -- Useful for getting pretty icons, but requires a Nerd Font. - { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, - "lambdalisue/nerdfont.vim", - "junegunn/vim-easy-align", - "rcarriga/nvim-notify", + -- Useful for getting pretty icons, but requires a Nerd Font. + { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, + "lambdalisue/nerdfont.vim", + "junegunn/vim-easy-align", + "rcarriga/nvim-notify", - -- Highlight todo, notes, etc in comments - { - "folke/todo-comments.nvim", - event = "VimEnter", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = { signs = false }, - }, + -- Highlight todo, notes, etc in comments + { + "folke/todo-comments.nvim", + event = "VimEnter", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { signs = false }, + }, } diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua index c094741..0f781d0 100644 --- a/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua @@ -43,7 +43,6 @@ return { "ts_ls", "cssls", "tailwindcss", - "pyright", }, handlers = { function(server_name) -- default handler (optional) diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua index 7c30498..76b9b9c 100644 --- a/modules/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua @@ -5,47 +5,46 @@ These three tabs are necessary when dealing with this nonsense: - https://github.com/nvimtools/none-ls.nvim --]] return { - "jay-babu/mason-null-ls.nvim", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - "williamboman/mason.nvim", - "nvimtools/none-ls.nvim", - "nvimtools/none-ls-extras.nvim", - }, - config = function() - local null_ls = require("null-ls") - require("mason-null-ls").setup({ - ensure_installed = { - "stylua", - "jq", - "mypy", - "ruff", - "black", - }, - handlers = { - ["mypy"] = function(source_name, methods) - local options = { - extra_args = function() - local command = "which python" - local handle = io.popen(command) - local python_path = "" - if handle then - python_path = handle:read("*a") - python_path = string.gsub(python_path, "\n", "") - handle:close() - end - return { "--python-executable", python_path } - end, - } - null_ls.register(null_ls.builtins.diagnostics.mypy.with(options)) - end, - --[[ ["ruff"] = function(source_name, methods) + "jay-babu/mason-null-ls.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "williamboman/mason.nvim", + "nvimtools/none-ls.nvim", + "nvimtools/none-ls-extras.nvim", + }, + config = function() + local null_ls = require("null-ls") + require("mason-null-ls").setup({ + ensure_installed = { + "stylua", + "jq", + "basedpyright", + "black", + }, + handlers = { + -- ["mypy"] = function(source_name, methods) + -- local options = { + -- extra_args = function() + -- local command = "which python" + -- local handle = io.popen(command) + -- local python_path = "" + -- if handle then + -- python_path = handle:read("*a") + -- python_path = string.gsub(python_path, "\n", "") + -- handle:close() + -- end + -- return { "--python-executable", python_path } + -- end, + -- } + -- null_ls.register(null_ls.builtins.diagnostics.mypy.with(options)) + -- end, + --[[ ["ruff"] = function(source_name, methods) null_ls.register(null_ls.builtins.diagnostics.ruff) --require('mason-null-ls').default_setup(source_name, methods) -- to maintain default behavior end, ]] - }, - }) + }, + }) - null_ls.setup() - end, + null_ls.setup() + end, } diff --git a/modules/dotfiles/nvim/lua/thegeneralist/remap.lua b/modules/dotfiles/nvim/lua/thegeneralist/remap.lua index 8766e4d..41b94c0 100755 --- a/modules/dotfiles/nvim/lua/thegeneralist/remap.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/remap.lua @@ -16,10 +16,10 @@ vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "N", "Nzzzv") vim.keymap.set("n", "vwm", function() - require("vim-with-me").StartVimWithMe() + require("vim-with-me").StartVimWithMe() end) vim.keymap.set("n", "svwm", function() - require("vim-with-me").StopVimWithMe() + require("vim-with-me").StopVimWithMe() end) vim.keymap.set("n", "vs", "v") @@ -54,19 +54,19 @@ vim.keymap.set("n", "vpp", "e ~/.dotfiles/nvim/.config/nvim/lua/the vim.keymap.set("n", "mr", "CellularAutomaton make_it_rain") vim.keymap.set("n", "", function() - vim.cmd("so") + vim.cmd("so") end) vim.keymap.set("n", "zh", "$viBhzf", { - desc = "Fold { block", + desc = "Fold { block", }) vim.keymap.set("n", "zj", "$vi[hzf", { - desc = "Fold [ block", + desc = "Fold [ block", }) vim.keymap.set("n", "zk", "$vibhzf", { - desc = "Fold ( block", + desc = "Fold ( block", }) vim.keymap.set("n", "ga", "EasyAlign") @@ -77,6 +77,7 @@ vim.keymap.set("v", "<", "", ">gv") -- Indent with tab +vim.keymap.set("i", "", "") vim.keymap.set("v", "", ">gv") vim.keymap.set("v", "", "", "e", "jq") vim.keymap.set("n", "w", function() - vim.ui.input({ prompt = "Enter value for shiftwidth: " }, function(input) - vim.o.shiftwidth = tonumber(input) - end) + vim.ui.input({ prompt = "Enter value for shiftwidth: " }, function(input) + vim.o.shiftwidth = tonumber(input) + end) end) -- vim.keymap.set("n", "tc", function() -- -- local file_number = tonumber(vim.fn.input("File number > "), 10)