Plugin changes

This commit is contained in:
Alexander Gehrke 2025-08-27 15:56:34 +02:00
parent 76a754de23
commit 523fedae4e
10 changed files with 289 additions and 210 deletions

View file

@ -1,3 +0,0 @@
{
"workspace.checkThirdParty": false
}

View file

@ -1,39 +0,0 @@
-- Setup nvim-cmp.
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
--vim.fn["vsnip#anonymous"](args.body)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = "nvim_lsp" },
-- For vsnip user.
{ name = "vsnip" },
-- For luasnip user.
-- { name = 'luasnip' },
-- For ultisnips user.
-- { name = 'ultisnips' },
{ name = "buffer" },
},
})
-- Setup lsp.
metals_config = require("metals").bare_config
metals_config.init_options.statusBarProvider = "on"
metals_config.settings = { showImplicitArguments = true }
metals_config.on_attach = on_attach
metals_config.capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())

View file

@ -1,121 +1,122 @@
return {
{
"hrsh7th/nvim-cmp",
-- load cmp on InsertEnter
event = "InsertEnter",
-- these dependencies will only be loaded when cmp loads
-- dependencies are always lazy-loaded unless specified otherwise
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
-- 'hrsh7th/cmp-vsnip',
-- 'hrsh7th/vim-vsnip',
-- 'hrsh7th/vim-vsnip-integ',
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"onsails/lspkind.nvim",
{
"zbirenbaum/copilot-cmp",
dependencies = {
"hrsh7th/nvim-cmp",
{
"zbirenbaum/copilot.lua",
opts = {
suggestion = { enabled = false },
panel = { enabled = false },
filetypes = {
mail = false,
text = false,
},
},
},
},
config = function()
require("copilot_cmp").setup()
end,
},
},
config = function()
local cmp = require("cmp")
local lspkind = require("lspkind")
local luasnip = require("luasnip")
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
cmp.setup({
snippet = {
expand = function(args)
--vim.fn["vsnip#anonymous"](args.body)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
["<C-y>"] = cmp.mapping.confirm({ select = true }),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<C-CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "copilot" },
}, {
{ name = "buffer", option = { keyword_pattern = [[\k\+]] } },
--{ name = 'path' },
}),
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text", -- show only symbol annotations
maxwidth = 80, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
ellipsis_char = "", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
symbol_map = { Copilot = "" },
}),
},
})
end,
},
}
return {}
--return {
-- {
-- "hrsh7th/nvim-cmp",
-- -- load cmp on InsertEnter
-- event = "InsertEnter",
-- -- these dependencies will only be loaded when cmp loads
-- -- dependencies are always lazy-loaded unless specified otherwise
-- dependencies = {
-- "hrsh7th/cmp-nvim-lsp",
-- "hrsh7th/cmp-buffer",
-- "hrsh7th/cmp-path",
-- "hrsh7th/cmp-cmdline",
-- -- 'hrsh7th/cmp-vsnip',
-- -- 'hrsh7th/vim-vsnip',
-- -- 'hrsh7th/vim-vsnip-integ',
-- "L3MON4D3/LuaSnip",
-- "saadparwaiz1/cmp_luasnip",
-- "onsails/lspkind.nvim",
-- {
-- "zbirenbaum/copilot-cmp",
-- dependencies = {
-- "hrsh7th/nvim-cmp",
-- {
-- "zbirenbaum/copilot.lua",
-- opts = {
-- suggestion = { enabled = false },
-- panel = { enabled = false },
-- filetypes = {
-- mail = false,
-- text = false,
-- },
-- },
-- },
-- },
-- config = function()
-- require("copilot_cmp").setup()
-- end,
-- },
-- },
-- config = function()
-- local cmp = require("cmp")
-- local lspkind = require("lspkind")
-- local luasnip = require("luasnip")
-- local has_words_before = function()
-- unpack = unpack or table.unpack
-- local line, col = unpack(vim.api.nvim_win_get_cursor(0))
-- return col ~= 0
-- and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
-- end
--
-- cmp.setup({
-- snippet = {
-- expand = function(args)
-- --vim.fn["vsnip#anonymous"](args.body)
-- require("luasnip").lsp_expand(args.body)
-- end,
-- },
-- mapping = {
-- ["<C-y>"] = cmp.mapping.confirm({ select = true }),
-- ["<C-b>"] = cmp.mapping.scroll_docs(-4),
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
-- ["<C-Space>"] = cmp.mapping.complete(),
-- ["<C-e>"] = cmp.mapping.abort(),
-- ["<CR>"] = cmp.mapping.confirm({
-- behavior = cmp.ConfirmBehavior.Replace,
-- select = true,
-- }),
-- ["<C-CR>"] = cmp.mapping({
-- i = function(fallback)
-- if cmp.visible() and cmp.get_active_entry() then
-- cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
-- else
-- fallback()
-- end
-- end,
-- s = cmp.mapping.confirm({ select = true }),
-- c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
-- }),
-- ["<Tab>"] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.select_next_item()
-- -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- -- they way you will only jump inside the snippet region
-- elseif luasnip.expand_or_jumpable() then
-- luasnip.expand_or_jump()
-- elseif has_words_before() then
-- cmp.complete()
-- else
-- fallback()
-- end
-- end, { "i", "s" }),
-- ["<S-Tab>"] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.select_prev_item()
-- elseif luasnip.jumpable(-1) then
-- luasnip.jump(-1)
-- else
-- fallback()
-- end
-- end, { "i", "s" }),
-- },
-- sources = cmp.config.sources({
-- { name = "nvim_lsp" },
-- { name = "luasnip" },
-- { name = "copilot" },
-- }, {
-- { name = "buffer", option = { keyword_pattern = [[\k\+]] } },
-- --{ name = 'path' },
-- }),
-- formatting = {
-- format = lspkind.cmp_format({
-- mode = "symbol_text", -- show only symbol annotations
-- maxwidth = 80, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
-- ellipsis_char = "…", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
-- symbol_map = { Copilot = "" },
-- }),
-- },
-- })
-- end,
-- },
--}

View file

@ -1,7 +1,7 @@
return {
"David-Kunz/gen.nvim",
opts = {
model = "mistral", -- The default model to use.
model = "gemma3:12b-it-qat", -- The default model to use.
init = false,
},
cmd = "Gen",

55
lua/plugins/lazydev.lua Normal file
View file

@ -0,0 +1,55 @@
return {
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
{ -- optional blink completion source for require statements and module annotations
"saghen/blink.cmp",
--version = "1.*",
build = "cargo build --release",
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
sources = {
-- add lazydev to your completion providers
default = { "lazydev", "lsp", "path", "snippets", "buffer" },
providers = {
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
-- make lazydev completions top priority (see `:h blink.cmp`)
score_offset = 100,
},
},
},
-- '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 = "super-tab" },
appearance = { nerd_font_variant = "mono" },
completion = {
documentation = { auto_show = false },
list = { selection = { preselect = false, auto_insert = true } },
},
fuzzy = { implementation = "prefer_rust_with_warning" },
ghost_text = { enabled = true },
},
opts_extend = { "sources.default" },
},
}

View file

@ -5,9 +5,7 @@ return {
event = { "BufReadPre", "BufNewFile" },
dependencies = {
{ "folke/neoconf.nvim", cmd = "Neoconf", config = true },
{ "folke/neodev.nvim", opts = {} },
"mason-org/mason.nvim",
"hrsh7th/cmp-nvim-lsp",
},
---@class PluginLspOpts
opts = function()

View file

@ -3,7 +3,7 @@ return {
dependencies = {
"nvim-lua/plenary.nvim",
"mfussenegger/nvim-dap",
"hrsh7th/cmp-nvim-lsp",
--"hrsh7th/cmp-nvim-lsp",
},
ft = { "scala", "sbt" },
config = function()
@ -16,7 +16,7 @@ return {
metals_config.on_attach = function(client, bufnr)
require("metals").setup_dap()
end
metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
--metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
-- Debug settings if you're using nvim-dap
local dap = require("dap")
dap.configurations.scala = {

View file

@ -0,0 +1,76 @@
return {
"jake-stewart/multicursor.nvim",
branch = "1.0",
config = function()
local mc = require("multicursor-nvim")
mc.setup()
local set = vim.keymap.set
-- Add or skip cursor above/below the main cursor.
set({ "n", "x" }, "<leader><up>", function()
mc.lineAddCursor(-1)
end)
set({ "n", "x" }, "<leader><down>", function()
mc.lineAddCursor(1)
end)
set({ "n", "x" }, "<leader><leader><up>", function()
mc.lineSkipCursor(-1)
end)
set({ "n", "x" }, "<leader><leader><down>", function()
mc.lineSkipCursor(1)
end)
-- Add or skip adding a new cursor by matching word/selection
set({ "n", "x" }, "<C-n>", function()
mc.matchAddCursor(1)
end)
set({ "n", "x" }, "<C-s>", function()
mc.matchSkipCursor(1)
end)
set({ "n", "x" }, "<C-S-n>", function()
mc.matchAddCursor(-1)
end)
set({ "n", "x" }, "<C-S-s>", function()
mc.matchSkipCursor(-1)
end)
-- Add and remove cursors with control + left click.
set("n", "<c-leftmouse>", mc.handleMouse)
set("n", "<c-leftdrag>", mc.handleMouseDrag)
set("n", "<c-leftrelease>", mc.handleMouseRelease)
-- Disable and enable cursors.
set({ "n", "x" }, "<c-q>", mc.toggleCursor)
-- Mappings defined in a keymap layer only apply when there are
-- multiple cursors. This lets you have overlapping mappings.
mc.addKeymapLayer(function(layerSet)
-- Select a different cursor as the main one.
layerSet({ "n", "x" }, "<leader>h", mc.prevCursor)
layerSet({ "n", "x" }, "<leader>l", mc.nextCursor)
-- Delete the main cursor.
layerSet({ "n", "x" }, "<leader>x", mc.deleteCursor)
-- Enable and clear cursors using escape.
layerSet("n", "<esc>", function()
if not mc.cursorsEnabled() then
mc.enableCursors()
else
mc.clearCursors()
end
end)
end)
-- Customize how cursors look.
local hl = vim.api.nvim_set_hl
hl(0, "MultiCursorCursor", { reverse = true })
hl(0, "MultiCursorVisual", { link = "Visual" })
hl(0, "MultiCursorSign", { link = "SignColumn" })
hl(0, "MultiCursorMatchPreview", { link = "Search" })
hl(0, "MultiCursorDisabledCursor", { reverse = true })
hl(0, "MultiCursorDisabledVisual", { link = "Visual" })
hl(0, "MultiCursorDisabledSign", { link = "SignColumn" })
end,
}