Migrate vim to neovim (min v0.11)

Install newest vim-releases via appimage from github-page!
This commit is contained in:
2025-08-10 07:58:09 +02:00
parent ca4e45b4aa
commit 24f7891460
26 changed files with 781 additions and 252 deletions

View File

@@ -0,0 +1,67 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp", -- language server as completion source
"hrsh7th/cmp-buffer", -- buffers as completion source
"hrsh7th/cmp-path", -- paths as completion source
"hrsh7th/cmp-cmdline", -- cmdline as completion source
"hrsh7th/cmp-nvim-lsp-signature-help", -- emphasize current parameter in completions
"L3MON4D3/LuaSnip", -- I use luasnip anyway
"saadparwaiz1/cmp_luasnip", -- luasnip completion source
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_snipmate").lazy_load()
require("luasnip.loaders.from_lua").lazy_load()
local has_words_before = function ()
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)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
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 = {
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
},
})
end,
}

View File

@@ -0,0 +1,4 @@
return {
"mattn/emmet-vim",
config = function() end,
}

View File

@@ -0,0 +1,22 @@
return {
{
"tpope/vim-fugitive",
lazy = false,
keys = {
-- replaced by telescope
-- { "<Leader>gg", "<Cmd>Ggrep ", desc = "Git grep" },
{ "<Leader>gb", "<Cmd>G blame<CR>", desc = "Git blame" },
{ "<Leader>gll", "<Cmd>G log --graph --format='%h (%ar) %s :: %aN <%aE>'<CR>", desc = "Git blame" },
{ "<Leader>glx", "<Cmd>Gclog -- %<CR>" },
{ "<Leader>gl0", "<Cmd>0Gclog -- %<CR>" },
},
},
-- Github integration for :GBrowse
{ "tpope/vim-rhubarb" },
-- Gitea integration for :GBrowse
{ "borissov/fugitive-gitea" },
-- Gitlab integration for :GBrowse
{ "shumphrey/fugitive-gitlab.vim" },
-- Bitbucket integration for :GBrowse
{ "tommcdo/vim-fubitive" },
}

View File

@@ -0,0 +1,25 @@
local function my_attach_change(bufnr)
local gs = require "gitsigns"
vim.keymap.set("n", "<Leader>tb", gs.toggle_current_line_blame, { buffer = bufnr })
end
return {
"lewis6991/gitsigns.nvim",
lazy = false,
opts = {
on_attach = my_attach_change,
signs = {
add = { text = "+" },
change = { text = "~" },
delete = { text = "-" },
topdelete = { text = "-" },
},
signs_staged = {
add = { text = "+" },
change = { text = "~" },
delete = { text = "-" },
topdelete = { text = "-" },
},
word_diff = false
},
}

View File

@@ -0,0 +1,24 @@
return {
"junegunn/goyo.vim",
dependencies = {
"junegunn/limelight.vim",
"nvim-lualine/lualine.nvim",
},
lazy = false,
config = function ()
vim.keymap.set("n", "<Leader>gg", function()
require('lualine').hide()
vim.cmd([[Goyo]])
vim.cmd([[Limelight!! 0.8]])
end)
end
-- "pocco81/true-zen.nvim",
-- config = function ()
-- vim.keymap.set("n", "<Leader>gwg", function()
-- vim.cmd([[TZAtaraxis]])
-- end)
-- vim.keymap.set("n", "<Leader>gww", function()
-- require('lualine').hide()
-- end)
-- end
}

View File

@@ -0,0 +1,20 @@
return {
{
-- "lifepillar/vim-gruvbox8",
-- priority = 1000, --ensure loading before other plugins
-- opts = {},
-- config = function()
-- vim.g.gruvbox_contrast_dark = "hard"
-- --vim.cmd("colorscheme gruvbox8")
-- end,
--}, {
"ellisonleao/gruvbox.nvim",
priority = 1000,
opts = {
contrast = "hard",
},
config = function()
vim.cmd("colorscheme gruvbox")
end
}
}

View File

@@ -0,0 +1,115 @@
local on_attach = function(_, bufnr)
local ts = require("telescope.builtin")
local opts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set("n", "<Leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<Leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "ge", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "gf", function() vim.lsp.buf.format { async = true } end, opts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
vim.keymap.set("n", "gk", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "gK", vim.lsp.buf.signature_help, opts)
vim.keymap.set("n", "gn", function() vim.diagnostic.jump({ count = 1, float = true }) end, opts)
vim.keymap.set("n", "gN", function() vim.diagnostic.jump({ count = -1, float = true }) end, opts)
vim.keymap.set("n", "gr", ts.lsp_references, opts)
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
end
return {
"mason-org/mason-lspconfig.nvim",
dependencies = {
{ "mason-org/mason.nvim", opts = {} },
"neovim/nvim-lspconfig",
"nvim-telescope/telescope.nvim",
"hrsh7th/nvim-cmp", -- IMPORTANT: autocomplete must be configured correctly!
-- {
-- 'stevearc/dressing.nvim',
-- opts = {},
-- event='VeryLazy'
-- }
},
opts = {},
config = function()
local masonlsp = require("mason-lspconfig")
masonlsp.setup({
-- possibilities: https://mason-registry.dev/registry/list
ensure_installed = {
"bashls",
"cssls",
"docker_language_server",
"eslint",
"gopls",
"harper_ls",
"html",
"jsonls",
"lua_ls",
"terraformls",
"ts_ls",
"vue_ls",
},
})
local vue_language_server_path = vim.fn.expand '$MASON/packages' ..
'/vue-language-server' .. '/node_modules/@vue/language-server'
local vue_plugin = {
name = '@vue/typescript-plugin',
location = vue_language_server_path,
languages = { 'vue' },
configNamespace = 'typescript',
}
local home_dir = os.getenv('HOME')
local capabilities = require("cmp_nvim_lsp").default_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
local opts = {
on_attach = on_attach,
capabilities = capabilities,
}
-- A list of language-server-configs https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
vim.lsp.config("bashls", opts)
vim.lsp.config("cssls", opts)
vim.lsp.config("docker_language_server", opts)
vim.lsp.config("eslint", {})
vim.lsp.config("gopls", opts)
vim.lsp.config("harper_ls", { -- spelling and grammer checks
on_attach = on_attach,
capabilities = capabilities,
filetypes = { "markdown", "asciidoc", "text", "vimwiki" },
})
vim.lsp.config("html", opts)
vim.lsp.config("jsonls", opts)
vim.lsp.config("lua_ls", {
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" }
},
telemetry = { enable = false },
}
}
})
vim.lsp.config("terraformls", opts)
vim.lsp.config("ts_ls", {
on_attach = on_attach,
capabilities = capabilities,
init_options = {
plugins = {
vue_plugin,
},
},
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
})
vim.lsp.config('vue_ls', opts)
vim.lsp.enable({
"cssls",
"eslint",
"html",
"harper_ls",
"jsonls",
"lua_ls",
"terraformls",
"ts_ls",
"vue_ls",
})
end,
}

View File

@@ -0,0 +1,15 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = {
'nvim-tree/nvim-web-devicons'
},
opts = {
sections = {
lualine_c = { { "filename", path = 1 } },
},
inactive_sections = {
lualine_c = { { 'filename', path = 1 } },
},
},
}

View File

@@ -0,0 +1,4 @@
return {
"L3MON4D3/LuaSnip",
version = "v2.*", -- just because the docs mention it
}

View File

@@ -0,0 +1,7 @@
return {
-- add closing parenthesis automatically
"windwp/nvim-autopairs",
event = "InsertEnter",
config = true,
opts = {},
}

View File

@@ -0,0 +1,16 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
'nvim-lua/plenary.nvim'
-- do not forget to install ripgrep!!!
-- https://github.com/nvim-telescope/telescope.nvim/issues/522#issuecomment-1374795374
},
opts = {
},
config = function()
local ts = require("telescope.builtin")
vim.keymap.set("n", "<C-p>", ts.find_files)
vim.keymap.set("n", "<Leader>fg", ts.live_grep)
vim.keymap.set("n", "<Leader>ff", ts.oldfiles)
end,
}

View File

@@ -0,0 +1,116 @@
local function my_attach_change(bufnr)
local api = require "nvim-tree.api"
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
api.config.mappings.default_on_attach(bufnr)
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
vim.keymap.set("n", "I", api.tree.toggle_hidden_filter, opts("Toggle Filter: Dotfiles"))
-- vim.keymap.set("n", "O", function()
-- api.node.open.edit()
-- current = api.tree.get_node_under_cursor()
-- if current.type ~= "directory" then
-- api.tree.close()
-- end
-- end, opts("Open and clode Tree"))
-- vim.keymap.set("n", "o", api.node.open.edit, opts("Open"))
-- add my most used NERDTree mappings
-- vim.keymap.set("n", "ma", api.fs.create, opts("NERDTree add a childnode"))
-- vim.keymap.set("n", "mc", function() api.fs.copy.node(); api.fs.paste(); end, opts("NERDTree copy the current node"))
-- vim.keymap.set("n", "md", api.fs.remove, opts("NERDTree delete the current node"))
-- vim.keymap.set("n", "mm", api.fs.rename_full, opts("NERDTree move the current node"))
-- vim.keymap.set("n", "mo", api.node.run.system, opts("NERDTree open the current node with system editor"))
end
return {
{
"nvim-tree/nvim-tree.lua",
lazy = false,
keys = {
{ "<Leader>e", "<CMD>NvimTreeFindFile<CR>", desc = "NvimTree" },
{ "<Leader>E", "<CMD>NvimTreeClose<CR>", desc = "Close NvimTree" },
},
opts = {
on_attach = my_attach_change,
filters = {
dotfiles = true,
git_ignored = false,
},
view = {
signcolumn = "no",
width = 40,
},
renderer = {
-- root_folder_label = ":~",
-- root_folder_label = ":.",
root_folder_label = function(path)
return vim.fn.fnamemodify(path, ":h:t") .. "/" .. vim.fn.fnamemodify(path, ":t") .. "/"
end,
group_empty = true,
icons = {
padding = {
icon = " ",
},
--padding = {
-- folder_arrow = " ",
-- icon = "",
--},
--show = {
-- file = false,
-- folder = false,
-- folder_arrow = true,
--},
--glyphs = {
-- folder = {
-- arrow_closed = "▸ ",
-- arrow_open = "▾ ",
-- },
-- git = {
-- unstaged = "✗ ",
-- staged = "✓ ",
-- unmerged = " ",
-- renamed = "➜ ",
-- untracked = "★ ",
-- deleted = " ",
-- ignored = "◌ ",
-- },
--},
},
},
diagnostics = {
enable = true,
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
},
init = function()
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
end,
},
{
"nvim-tree/nvim-web-devicons",
},
-- {
-- "scrooloose/nerdtree",
-- init = function()
-- vim.g.NERDTreeGitStatusShowIgnored = 1
-- vim.cmd([[let NERDTreeMinimalUI=1]])
-- vim.cmd([[let NERDTreeDirArrows=1]])
-- vim.cmd([[let NERDTreeAutoDeleteBuffer=1]])
-- -- vim.keymap.set("n", "<Leader>n", ":NERDTreeToggle<CR>")
-- end,
-- keys = {
-- { "<Leader>e", "<CMD>NERDTreeFocus<CR>", desc = "NERDTree" },
-- },
-- },
-- {
-- "Xuyuanp/nerdtree-git-plugin",
-- },
}

View File

@@ -0,0 +1,20 @@
return {
"nvim-treesitter/nvim-treesitter",
lazy = false,
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = "all",
ignore_install = { "ipkg" },
sync_install = false,
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
})
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
--vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()"
vim.opt.foldmethod = "expr"
end,
}

View File

@@ -0,0 +1,10 @@
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], {})
vim.keymap.set('t', '<C-d>', [[<C-\><C-n><Cmd>ToggleTerm<CR>]], {})
return {
"akinsho/toggleterm.nvim",
opts = {},
keys = {
{ "<C-d>", [[<Cmd>ToggleTerm<CR>]] },
},
}

View File

@@ -0,0 +1,8 @@
return {
-- add closing HTML tags automatically
"windwp/nvim-ts-autotag",
lazy = false,
config = function()
require 'nvim-ts-autotag'.setup()
end,
}

View File

@@ -0,0 +1,30 @@
local wikipath = "~/Development/nemoinho/gitea.nehrke.info/nemoinho/vimwiki/"
--vim.cmd("let g:vimwiki_list = [{'path': '~/Development/nemoinho/gitea.nehrke.info/nemoinho/vimwiki/' }]")
vim.g.vimwiki_table_mappings = 0
vim.g.vimwiki_list = { { path = wikipath, auto_export = 1 } }
vim.g.vimwiki_autowriteall = 0
vim.g.vimwiki_url_maxsave = 0
local vimwikiconfig = vim.api.nvim_create_augroup('configgroup', { clear = true })
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = "diary.wiki",
group = vimwikiconfig,
callback = function() vim.cmd([[VimwikiDiaryGenerateLinks]]) end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "vimwiki",
group = vimwikiconfig,
callback = function()
vim.opt_local.wrap = true
vim.opt_local.number = false
vim.opt_local.relativenumber = false
vim.keymap.set("n", "<Leader>ws", function()
vim.cmd("call system('sleep 2 && cd " .. wikipath .. " && git add . && git commit -m " .. '"Auto commit"' .. " && git push')")
end)
vim.keymap.set("n", "<Leader>we", "<Cmd>VimwikiMakeDiaryNote<CR>")
end,
})
return {
"vimwiki/vimwiki",
config = function() end,
}

View File

@@ -0,0 +1,4 @@
return {
"folke/which-key.nvim",
opts = {},
}