- new neovim config

This commit is contained in:
Erik Mertens
2025-06-24 18:12:40 +02:00
commit 5942a17ff5
14 changed files with 513 additions and 0 deletions

7
init.lua Normal file
View File

@ -0,0 +1,7 @@
require("settings")
require("ui")
-- require("vue")
require("pluginmanager")

18
lazy-lock.json Normal file
View File

@ -0,0 +1,18 @@
{
"blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" },
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"kanagawa-paper.nvim": { "branch": "master", "commit": "b0df20cca3b7087c06f241983b488190cc8e23af" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"mini.nvim": { "branch": "main", "commit": "1b32a3f61f1f649cadc748bd4b7a32b4b4785d29" },
"nvim-lspconfig": { "branch": "master", "commit": "5e0e9c00d51fcb7efef0d4c49023f9593b38661e" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
"nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}

30
lua/pluginmanager.lua Normal file
View File

@ -0,0 +1,30 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
-- "https://git.erik.mertens.digital/erik/nvim-rpgle.git"
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

5
lua/plugins/autotag.lua Normal file
View File

@ -0,0 +1,5 @@
return {
"windwp/nvim-ts-autotag",
opts = {}
}

49
lua/plugins/blink.lua Normal file
View File

@ -0,0 +1,49 @@
return {
'saghen/blink.cmp',
-- optional: provides snippets for the snippet source
dependencies = { 'rafamadriz/friendly-snippets' },
version = '1.*',
---@module 'blink.cmp'
---@type blink.cmp.Config
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' },
appearance = {
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = 'normal'
},
-- (Default) Only show the documentation popup when manually triggered
completion = { documentation = { auto_show = true } },
-- 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" }
}

View File

@ -0,0 +1,9 @@
return {
"thesimonho/kanagawa-paper.nvim",
lazy = false,
priority = 1000,
init = function()
vim.cmd.colorscheme("kanagawa-paper-ink")
end,
opts = {...},
}

132
lua/plugins/lspconfig.lua Normal file
View File

@ -0,0 +1,132 @@
return { -- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs and related tools to stdpath for neovim
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Useful status updates for LSP.
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ 'j-hui/fidget.nvim', opts = {} },
},
config = function()
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(event)
local map = function(keys, func, desc)
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
-- map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
map('gd', function() vim.lsp.buf.definition() end, '[G]oto [D]efinition')
-- map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
-- map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
-- map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
-- map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
map('<leader>bf', vim.lsp.buf.format, '[B]uffer [F]ormat')
-- The following two autocommands are used to highlight references of the
-- word under your cursor when your cursor rests there for a little while.
-- See `:help CursorHold` for information about when this is executed
--
-- When you move your cursor, the highlights will be cleared (the second autocommand).
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
buffer = event.buf,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
buffer = event.buf,
callback = vim.lsp.buf.clear_references,
})
end
-- autoformat
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = event.buf,
callback = function()
vim.lsp.buf.format { async = false, id = event.data.client_id }
end,
})
end,
})
-- Ensure the servers and tools above are installed
-- To check the current status of installed tools and/or manually install
-- other tools, you can run
-- :Mason
--
-- You can press `g?` for help in this menu
require('mason').setup()
-- You can add other tools here that you want Mason to install
-- for you, so that they are available from within Neovim.
require('mason-tool-installer').setup {}
require('mason-lspconfig').setup {}
vim.lsp.config("lua_ls", {
settings = {
Lua = {
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-- diagnostics = { disable = { 'missing-fields' } },
diagnostics = { globals = { "vim", "require" } },
workspace = {
library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.stdpath("config") .. "/lua"] = true
}
}
},
}
})
-- local vue_path = vim.fn.stdpath("data") ..
-- "/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@vue/typescript-plugin"
local vue_path = vim.fn.stdpath("data") ..
"/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@vue/typescript-plugin"
vim.lsp.config('ts_ls', {
init_options = {
plugins = {
{
name = "@vue/typescript-plugin",
-- location = vim.fn.stdpath("data") .. "/erikcustom/language-tools/packages/typescript-plugin",
-- /mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@vue/typescript-plugin
location = vue_path,
languages = { "javascript", "typescript", "vue" },
},
},
settings = {
typescript = {
tsserver = {
useSyntaxServer = false,
},
inlayHints = {
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
},
},
filetypes = {
"javascript",
"typescript",
"vue",
},
})
end,
}

39
lua/plugins/mini.lua Normal file
View File

@ -0,0 +1,39 @@
return {
"echasnovski/mini.nvim",
config = function()
require("mini.statusline").setup({
use_icons = true,
content = {
active = function()
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
local git = MiniStatusline.section_git({ trunc_width = 75 })
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 })
local filename = MiniStatusline.section_filename({ trunc_width = 40 })
local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
local location = MiniStatusline.section_location({ trunc_width = 75 })
local search = MiniStatusline.section_searchcount({ trunc_width = 75 })
local lsp = MiniStatusline.section_lsp({ trunc_width = 75 })
local recording = vim.fn.reg_recording()
if recording:len() > 0 then
recording = "Rec: " .. recording
end
return MiniStatusline.combine_groups({
{ hl = mode_hl, strings = { mode } },
{ hl = mode_hl, strings = { recording } },
{ hl = 'MiniStatuslineDevinfo', strings = { git, diagnostics } },
'%<', -- Mark general truncate point
{ hl = 'MiniStatuslineFilename', strings = { filename } },
'%=', -- End left alignment
{ hl = 'MiniStatuslineDevinfo', strings = { lsp } },
{ hl = 'MiniStatuslineFileinfo', strings = { fileinfo } },
{ hl = mode_hl, strings = { search, location } },
})
end
}
})
require("mini.tabline").setup()
require("mini.pairs").setup()
require("mini.colors").setup()
end
}

27
lua/plugins/telescope.lua Normal file
View File

@ -0,0 +1,27 @@
return {
"nvim-telescope/telescope.nvim", tag = "0.1.8",
dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" },
opts = function()
local builtin = require('telescope.builtin')
vim.keymap.set('n', "<leader>ff", builtin.find_files, {desc = "[F]ind [F]iles"})
vim.keymap.set('n', "<leader>fg", builtin.live_grep, {desc = "[F]ind [G]rep"})
vim.keymap.set('n', "<leader>fb", builtin.buffers, {desc = "[F]ind [B]uffers"})
vim.keymap.set('n', "<leader>fh", builtin.help_tags, {desc = "[F]ind [H]elp"})
vim.keymap.set('n', "<leader>fd", builtin.diagnostics, {desc = "[F]ind [D]iagnostics"})
vim.keymap.set('n', "<leader>fo", builtin.resume, {desc = "[F]ind [O]Resume"})
end,
-- keys = {
-- { "<leader>ff", require("telescope.builtin").find_files, desc = "[F]ind [F]iles" },
-- { "<leader>fg", require("telescope.builtin").live_grep, desc = "[F]ind [G]rep" },
-- { "<leader>fb", require("telescope.builtin").buffers, desc = "[F]ind [B]uffers" },
-- { "<leader>fh", require("telescope.builtin").help_tags, desc = "[F]ind [H]elp" },
-- { "<leader>fd", require("telescope.builtin").diagnostics, desc = "[F]ind [D]iagnostics" },
-- { "<leader>fo", require("telescope.builtin").resume, desc = "[F]ind [O]Resume" },
-- {
-- "<leader>fp",
-- function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
-- desc = "[F]ind [P]lugin file",
-- },
-- },
}

View File

@ -0,0 +1,12 @@
return {
"nvim-treesitter/nvim-treesitter",
branch = 'master',
lazy = false,
build = ":TSUpdate",
event = { "BufRead" },
opts = { -- Das Plugin bietet noch diverse weitere Optionen.
indent = { enable = true }, -- Automatische Einrückungen mit Tree-sitter
highlight = { enable = true }, -- Das Syntax-Highlighting einschalten
auto_install = true, -- Highlighting-Daten automatisch installieren
}
}

20
lua/plugins/whichkey.lua Normal file
View File

@ -0,0 +1,20 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
opts = {},
config = function()
local wk = require("which-key")
wk.add({
{ "<leader>f", group = "Telescope" }
})
end,
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
}

73
lua/settings.lua Normal file
View File

@ -0,0 +1,73 @@
-- Keymaps
-- Copy
vim.api.nvim_set_keymap("n", "<C-v>", '"+gp', { noremap = true })
vim.api.nvim_set_keymap("i", "<C-v>", '<Esc>"+gp', { noremap = true })
-- Paste
vim.api.nvim_set_keymap("v", "<C-c>", '"+y', { noremap = true })
vim.api.nvim_set_keymap("n", "<C-c>", '"+yy', { noremap = true })
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.opt.breakindent = true
vim.opt.signcolumn = 'yes'
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' }
vim.cmd 'set formatoptions+=r'
vim.cmd 'set formatoptions+=]'
vim.cmd 'set diffopt+=iwhite'
vim.o.hidden = true
vim.o.tabstop = 4;
vim.o.shiftwidth = 4;
vim.o.smarttab = true
vim.wo.number = true
vim.wo.relativenumber = true
vim.o.scrolloff = 6
vim.o.sidescrolloff = 8
vim.bo.autoindent = true
vim.bo.smartindent = true
vim.o.title = true
vim.o.hlsearch = true
vim.o.inccommand = "nosplit"
vim.o.inccommand = "nosplit"
vim.o.mouse = "a"
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.cursorline = false
vim.o.pumblend = 30
vim.o.cmdheight = 0
vim.o.showcmdloc = "statusline"
vim.o.statusline = "%<%f\\ %h%m%r%=%-14.(%l,%c%V%)\\ %P"
vim.o.expandtab = true
vim.o.laststatus = 3
vim.o.breakindent = true
vim.o.showbreak = "=>"
-- setup sign symbols
local signs = { Error = "", Warn = "", Hint = "💡", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
-- -- terminal mode
-- if jit.os == "Windows" then
-- vim.o.shell = [[C:\Users\mertens\AppData\Local\Programs\Git\bin\bash.exe]]
-- vim.api.nvim_set_keymap("t", "<Esc>", [[<C-\><C-n>]], { noremap = true, silent = true, desc = "Exit terminal mode" })
--
-- vim.o.backupdir = "C:\\Users\\mertens\\AppData\\Local\\nvim-data\\backup"
-- end
vim.diagnostic.config({ virtual_lines = { current_line = true } })

74
lua/ui.lua Normal file
View File

@ -0,0 +1,74 @@
function Change_font_size(delta)
local iter = 0
local font_name = "JetBrains Mono" -- Backup name
local font_size = 12 -- Backup Size
for part in vim.api.nvim_get_option_value("guifont", {}):gmatch("([^:h]+)") do
if iter == 0 then
font_name = part
else
font_size = part
end
iter = iter + 1
end
font_size = font_size + delta
-- print("Fontsize: " .. font_size)
vim.print('Changing font size to: ' .. font_size)
vim.api.nvim_set_option_value("guifont", font_name .. ':h' .. font_size, { scope = "global"})
end
if vim.g.nvui then
vim.cmd('NvuiAnimationsEnabled 1')
vim.cmd('NvuiSnapshotLimit 8')
vim.cmd('NvuiScrollAnimationDuration 0.2')
vim.cmd('NvuiScrollFrametime 16')
vim.cmd('NvuiMoveAnimationDuration 0.3')
vim.cmd('NvuiCursorAnimationDuration 0.1')
vim.cmd('NvuiCursorFrametime 16')
vim.cmd('NvuiFrameless 0')
end
if vim.g.neovide then
-- vim.o.guifont = "Maple Mono:h13"
vim.o.guifont = "MonaspiceNe Nerd Font"
vim.g.neovide_floating_shadow = true
vim.g.neovide_floating_z_height = 10
vim.g.neovide_light_angle_degrees = 45
vim.g.neovide_light_radius = 5
vim.g.neovide_normal_opacity = 0.7
vim.g.neovide_window_blurred = true
vim.g.neovide_floating_border_radius = 0.5
vim.g.neovide_cursor_antialiasing = true
vim.g.neovide_title_background_color = string.format(
"%x",
vim.api.nvim_get_hl(0, {id=vim.api.nvim_get_hl_id_by_name("Normal")}).bg
)
vim.g.neovide_title_text_color = string.format(
"%x",
vim.api.nvim_get_hl(0, {id=vim.api.nvim_get_hl_id_by_name("Normal")}).fg
)
vim.o.titlestring = 'nvim'
vim.g.neovide_scale_factor = 1.0
local change_scale_factor = function(delta)
vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta
vim.print('Changing scale to: ' .. vim.g.neovide_scale_factor)
end
vim.api.nvim_set_keymap("n", "<C-+>", "", { noremap = true, desc = "Increase font size", callback = function () change_scale_factor(1.1) end })
vim.api.nvim_set_keymap("n", "<C-->", "", { noremap = true, desc = "Decrease font size", callback = function () change_scale_factor(1 / 1.1) end })
end
if vim.g.nvui then
vim.o.guifont = "Maple Mono:h13"
vim.api.nvim_set_keymap("n", "<C-+>", "", { noremap = true, desc = "Increase font size", callback = function () Change_font_size(1) end })
vim.api.nvim_set_keymap("n", "<C-->", "", { noremap = true, desc = "Decrease font size", callback = function () Change_font_size(-1) end })
end

18
lua/vue.lua Normal file
View File

@ -0,0 +1,18 @@
local langtoolpath = vim.fn.stdpath("data") .. "/erikcustom/language-tools"
if not vim.uv.fs_stat(langtoolpath) then
local langtoolrepo = "https://github.com/vuejs/language-tools"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=master", langtoolrepo, langtoolpath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone language-tools:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end