1
Fork 0
mirror of https://github.com/thegeneralist01/config.git synced 2026-03-07 10:59:55 +01:00

nvim: formatting and minor fixes

This commit is contained in:
TheGeneralist 2025-08-08 13:08:25 +02:00
parent b048858c40
commit 7282fcd409
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4
5 changed files with 225 additions and 217 deletions

View file

@ -1,84 +1,88 @@
return { return {
{ {
"saghen/blink.cmp", "saghen/blink.cmp",
dependencies = { "rafamadriz/friendly-snippets" }, dependencies = { "rafamadriz/friendly-snippets" },
version = "1.*", version = "1.*",
opts = { opts = {
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
-- 'super-tab' for mappings similar to vscode (tab to accept) -- 'super-tab' for mappings similar to vscode (tab to accept)
-- 'enter' for enter to accept -- 'enter' for enter to accept
-- 'none' for no mappings -- 'none' for no mappings
-- --
-- All presets have the following mappings: -- All presets have the following mappings:
-- C-space: Open menu or open docs if already open -- C-space: Open menu or open docs if already open
-- C-n/C-p or Up/Down: Select next/previous item -- C-n/C-p or Up/Down: Select next/previous item
-- C-e: Hide menu -- C-e: Hide menu
-- C-k: Toggle signature help (if signature.enabled = true) -- C-k: Toggle signature help (if signature.enabled = true)
-- --
-- See :h blink-cmp-config-keymap for defining your own keymap -- See :h blink-cmp-config-keymap for defining your own keymap
keymap = { preset = "default" }, keymap = {
preset = "default",
["<Tab>"] = { "select_and_accept" },
["<S-Tab>"] = { "select_next", "fallback_to_mappings" },
},
appearance = { appearance = {
nerd_font_variant = "mono", nerd_font_variant = "mono",
}, },
-- (Default) Only show the documentation popup when manually triggered -- (Default) Only show the documentation popup when manually triggered
completion = { documentation = { auto_show = false } }, completion = { documentation = { auto_show = false } },
-- Default list of enabled providers defined so that you can extend it -- Default list of enabled providers defined so that you can extend it
-- elsewhere in your config, without redefining it, due to `opts_extend` -- elsewhere in your config, without redefining it, due to `opts_extend`
sources = { sources = {
default = { "lsp", "path", "snippets", "buffer" }, default = { "lsp", "path", "snippets", "buffer" },
}, },
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance -- (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, -- 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"` -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
-- --
-- See the fuzzy documentation for more information -- See the fuzzy documentation for more information
fuzzy = { implementation = "prefer_rust_with_warning" }, fuzzy = { implementation = "prefer_rust_with_warning" },
}, },
opts_extend = { "sources.default" }, opts_extend = { "sources.default" },
}, },
-- { -- {
-- 'neovim/nvim-lspconfig', -- 'neovim/nvim-lspconfig',
-- dependencies = { -- dependencies = {
-- 'saghen/blink.cmp', -- 'saghen/blink.cmp',
-- 'williamboman/mason.nvim', -- 'williamboman/mason.nvim',
-- 'mason-org/mason-registry', -- 'mason-org/mason-registry',
-- 'williamboman/mason-lspconfig.nvim', -- 'williamboman/mason-lspconfig.nvim',
-- 'L3MON4D3/LuaSnip', -- 'L3MON4D3/LuaSnip',
-- 'saadparwaiz1/cmp_luasnip', -- 'saadparwaiz1/cmp_luasnip',
-- 'j-hui/fidget.nvim', -- 'j-hui/fidget.nvim',
-- }, -- },
-- --
-- -- example using `opts` for defining servers -- -- example using `opts` for defining servers
-- opts = { -- opts = {
-- servers = { -- servers = {
-- lua_ls = {} -- lua_ls = {}
-- } -- }
-- }, -- },
-- config = function(_, opts) -- config = function(_, opts)
-- require("fidget").setup({}) -- require("fidget").setup({})
-- require("mason").setup() -- require("mason").setup()
-- --
-- local lspconfig = require('mason-lspconfig') -- local lspconfig = require('mason-lspconfig')
-- for server, config in pairs(opts.servers) do -- for server, config in pairs(opts.servers) do
-- -- passing config.capabilities to blink.cmp merges with the capabilities in your -- -- passing config.capabilities to blink.cmp merges with the capabilities in your
-- -- `opts[server].capabilities, if you've defined it -- -- `opts[server].capabilities, if you've defined it
-- print('configuring server:', server) -- print('configuring server:', server)
-- config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) -- config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
-- require("lspconfig")[server].setup(config) -- require("lspconfig")[server].setup(config)
-- end -- end
-- end -- end
-- --
-- example calling setup directly for each LSP -- example calling setup directly for each LSP
-- config = function() -- config = function()
-- local capabilities = require('blink.cmp').get_lsp_capabilities() -- local capabilities = require('blink.cmp').get_lsp_capabilities()
-- local lspconfig = require('lspconfig') -- local lspconfig = require('lspconfig')
-- --
-- lspconfig['lua_ls'].setup({ capabilities = capabilities }) -- lspconfig['lua_ls'].setup({ capabilities = capabilities })
-- end -- end
-- }, -- },
} }

View file

@ -1,101 +1,106 @@
return { return {
{ {
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
main = "ibl", main = "ibl",
---@module "ibl" ---@module "ibl"
---@type ibl.config ---@type ibl.config
opts = {}, opts = {},
}, },
--[[ { --[[ {
'boganworld/crackboard.nvim', 'boganworld/crackboard.nvim',
dependencies = { 'nvim-lua/plenary.nvim' }, dependencies = { 'nvim-lua/plenary.nvim' },
opts = { opts = {
session_key = 'redacted', session_key = 'redacted',
}, },
}, ]] }, ]]
{ {
"onsails/lspkind-nvim", "onsails/lspkind-nvim",
}, },
-- { -- {
-- "ziglang/zig.vim", -- "ziglang/zig.vim",
-- }, -- },
{ {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
name = "plenary", name = "plenary",
}, },
{ {
"stevearc/oil.nvim", "stevearc/oil.nvim",
config = function() config = function()
require("oil").setup() require("oil").setup()
end, end,
}, },
-- { -- {
-- -- https://github.com/zbirenbaum/copilot.lua -- -- https://github.com/zbirenbaum/copilot.lua
-- "zbirenbaum/copilot.lua", -- "zbirenbaum/copilot.lua",
-- cmd = "Copilot", -- cmd = "Copilot",
-- event = "InsertEnter", -- event = "InsertEnter",
-- config = function() -- config = function()
-- require("copilot").setup({ -- require("copilot").setup({
-- panel = { -- panel = {
-- keymap = { -- keymap = {
-- jump_prev = "]]", -- jump_prev = "]]",
-- jump_next = "[[", -- jump_next = "[[",
-- accept = "<Tab>", -- accept = "<Tab>",
-- refresh = "gr", -- refresh = "gr",
-- open = "<M-]>", -- open = "<M-]>",
-- }, -- },
-- }, -- },
-- suggestion = { -- suggestion = {
-- auto_trigger = true, -- auto_trigger = true,
-- keymap = { -- keymap = {
-- accept = "<M-Tab>", -- accept = "<M-Tab>",
-- }, -- },
-- }, -- },
-- }) -- })
-- -- vim.keymap.set("n", "<leader>cpe", "<cmd>Copilot enable<CR>") -- -- vim.keymap.set("n", "<leader>cpe", "<cmd>Copilot enable<CR>")
-- -- vim.keymap.set("n", "<leader>cpd", "<cmd>Copilot disable<CR>") -- -- vim.keymap.set("n", "<leader>cpd", "<cmd>Copilot disable<CR>")
-- end, -- end,
-- }, -- },
{ {
"github/copilot.vim", "github/copilot.vim",
config = function() config = function()
-- set <leader>cpd and <leader>cpe to disable/enable copilot -- set <leader>cpd and <leader>cpe to disable/enable copilot
vim.keymap.set("n", "<leader>cpe", "<cmd>Copilot enable<CR>") vim.keymap.set("n", "<leader>cpe", "<cmd>Copilot enable<CR>")
vim.keymap.set("n", "<leader>cpd", "<cmd>Copilot disable<CR>") vim.keymap.set("n", "<leader>cpd", "<cmd>Copilot disable<CR>")
end, vim.keymap.set("i", "<C-J>", 'copilot#Accept("\\<CR>")', {
}, expr = true,
-- { replace_keycodes = false,
-- "Exafunction/codeium.nvim", })
-- dependencies = { vim.g.copilot_no_tab_map = true
-- "nvim-lua/plenary.nvim", end,
-- "hrsh7th/nvim-cmp", },
-- }, -- {
-- config = function() -- "Exafunction/codeium.nvim",
-- require("codeium").setup({ -- dependencies = {
-- -- https://github.com/Exafunction/codeium.vim -- "nvim-lua/plenary.nvim",
-- }) -- "hrsh7th/nvim-cmp",
-- end -- },
-- }, -- config = function()
{ -- require("codeium").setup({
"ldelossa/gh.nvim", -- -- https://github.com/Exafunction/codeium.vim
dependencies = { -- })
"ldelossa/litee.nvim", -- end
}, -- },
}, {
"eandrju/cellular-automaton.nvim", "ldelossa/gh.nvim",
"gpanders/editorconfig.nvim", dependencies = {
"ldelossa/litee.nvim",
},
},
"eandrju/cellular-automaton.nvim",
"gpanders/editorconfig.nvim",
-- Useful for getting pretty icons, but requires a Nerd Font. -- Useful for getting pretty icons, but requires a Nerd Font.
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
"lambdalisue/nerdfont.vim", "lambdalisue/nerdfont.vim",
"junegunn/vim-easy-align", "junegunn/vim-easy-align",
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
-- Highlight todo, notes, etc in comments -- Highlight todo, notes, etc in comments
{ {
"folke/todo-comments.nvim", "folke/todo-comments.nvim",
event = "VimEnter", event = "VimEnter",
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = { "nvim-lua/plenary.nvim" },
opts = { signs = false }, opts = { signs = false },
}, },
} }

View file

@ -43,7 +43,6 @@ return {
"ts_ls", "ts_ls",
"cssls", "cssls",
"tailwindcss", "tailwindcss",
"pyright",
}, },
handlers = { handlers = {
function(server_name) -- default handler (optional) function(server_name) -- default handler (optional)

View file

@ -5,47 +5,46 @@ These three tabs are necessary when dealing with this nonsense:
- https://github.com/nvimtools/none-ls.nvim - https://github.com/nvimtools/none-ls.nvim
--]] --]]
return { return {
"jay-babu/mason-null-ls.nvim", "jay-babu/mason-null-ls.nvim",
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
dependencies = { dependencies = {
"williamboman/mason.nvim", "williamboman/mason.nvim",
"nvimtools/none-ls.nvim", "nvimtools/none-ls.nvim",
"nvimtools/none-ls-extras.nvim", "nvimtools/none-ls-extras.nvim",
}, },
config = function() config = function()
local null_ls = require("null-ls") local null_ls = require("null-ls")
require("mason-null-ls").setup({ require("mason-null-ls").setup({
ensure_installed = { ensure_installed = {
"stylua", "stylua",
"jq", "jq",
"mypy", "basedpyright",
"ruff", "black",
"black", },
}, handlers = {
handlers = { -- ["mypy"] = function(source_name, methods)
["mypy"] = function(source_name, methods) -- local options = {
local options = { -- extra_args = function()
extra_args = function() -- local command = "which python"
local command = "which python" -- local handle = io.popen(command)
local handle = io.popen(command) -- local python_path = ""
local python_path = "" -- if handle then
if handle then -- python_path = handle:read("*a")
python_path = handle:read("*a") -- python_path = string.gsub(python_path, "\n", "")
python_path = string.gsub(python_path, "\n", "") -- handle:close()
handle:close() -- end
end -- return { "--python-executable", python_path }
return { "--python-executable", python_path } -- end,
end, -- }
} -- null_ls.register(null_ls.builtins.diagnostics.mypy.with(options))
null_ls.register(null_ls.builtins.diagnostics.mypy.with(options)) -- end,
end, --[[ ["ruff"] = function(source_name, methods)
--[[ ["ruff"] = function(source_name, methods)
null_ls.register(null_ls.builtins.diagnostics.ruff) null_ls.register(null_ls.builtins.diagnostics.ruff)
--require('mason-null-ls').default_setup(source_name, methods) -- to maintain default behavior --require('mason-null-ls').default_setup(source_name, methods) -- to maintain default behavior
end, ]] end, ]]
}, },
}) })
null_ls.setup() null_ls.setup()
end, end,
} }

View file

@ -16,10 +16,10 @@ vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv") vim.keymap.set("n", "N", "Nzzzv")
vim.keymap.set("n", "<leader>vwm", function() vim.keymap.set("n", "<leader>vwm", function()
require("vim-with-me").StartVimWithMe() require("vim-with-me").StartVimWithMe()
end) end)
vim.keymap.set("n", "<leader>svwm", function() vim.keymap.set("n", "<leader>svwm", function()
require("vim-with-me").StopVimWithMe() require("vim-with-me").StopVimWithMe()
end) end)
vim.keymap.set("n", "<leader>vs", "<C-w>v") vim.keymap.set("n", "<leader>vs", "<C-w>v")
@ -54,19 +54,19 @@ vim.keymap.set("n", "<leader>vpp", "<cmd>e ~/.dotfiles/nvim/.config/nvim/lua/the
vim.keymap.set("n", "<leader>mr", "<cmd>CellularAutomaton make_it_rain<CR>") vim.keymap.set("n", "<leader>mr", "<cmd>CellularAutomaton make_it_rain<CR>")
vim.keymap.set("n", "<leader><leader>", function() vim.keymap.set("n", "<leader><leader>", function()
vim.cmd("so") vim.cmd("so")
end) end)
vim.keymap.set("n", "zh", "$viBhzf", { vim.keymap.set("n", "zh", "$viBhzf", {
desc = "Fold { block", desc = "Fold { block",
}) })
vim.keymap.set("n", "zj", "$vi[hzf", { vim.keymap.set("n", "zj", "$vi[hzf", {
desc = "Fold [ block", desc = "Fold [ block",
}) })
vim.keymap.set("n", "zk", "$vibhzf", { vim.keymap.set("n", "zk", "$vibhzf", {
desc = "Fold ( block", desc = "Fold ( block",
}) })
vim.keymap.set("n", "ga", "<cmd>EasyAlign<CR>") vim.keymap.set("n", "ga", "<cmd>EasyAlign<CR>")
@ -77,6 +77,7 @@ vim.keymap.set("v", "<", "<gv")
vim.keymap.set("v", ">", ">gv") vim.keymap.set("v", ">", ">gv")
-- Indent with tab -- Indent with tab
vim.keymap.set("i", "<Tab>", "<Tab>")
vim.keymap.set("v", "<Tab>", ">gv") vim.keymap.set("v", "<Tab>", ">gv")
vim.keymap.set("v", "<S-Tab>", "<gv") vim.keymap.set("v", "<S-Tab>", "<gv")
@ -84,9 +85,9 @@ vim.keymap.set("v", "<S-Tab>", "<gv")
vim.keymap.set("n", "<C-w>e", "<C-w>j<C-w>q") vim.keymap.set("n", "<C-w>e", "<C-w>j<C-w>q")
vim.keymap.set("n", "<leader>w", function() vim.keymap.set("n", "<leader>w", function()
vim.ui.input({ prompt = "Enter value for shiftwidth: " }, function(input) vim.ui.input({ prompt = "Enter value for shiftwidth: " }, function(input)
vim.o.shiftwidth = tonumber(input) vim.o.shiftwidth = tonumber(input)
end) end)
end) end)
-- vim.keymap.set("n", "<leader>tc", function() -- vim.keymap.set("n", "<leader>tc", function()
-- -- local file_number = tonumber(vim.fn.input("File number > "), 10) -- -- local file_number = tonumber(vim.fn.input("File number > "), 10)