Integrate neovim config into home-manager, separate external configs under config/

This commit is contained in:
2026-04-07 18:28:22 +02:00
parent d9ef3b056e
commit 5403b4988e
49 changed files with 7286 additions and 50 deletions

View File

@@ -0,0 +1,26 @@
-- cmp
local cmp = require('cmp')
cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' }, },
{ { name = 'buffer' }, }
)
})

View File

@@ -0,0 +1,30 @@
local dap = require('dap')
local dap_python = require('dap-python')
dap_python.setup('uv') -- or wherever your debugpy-enabled python is
dap.adapters.python = {
type = 'server',
host = '127.0.0.1',
port = 5678,
}
dap.configurations.python = {
{
type = 'python',
request = 'attach',
name = "Attach to remote",
connect = {
host = "127.0.0.1",
port = 5678,
},
mode = "remote",
pathMappings = {
{
localRoot = vim.fn.getcwd(),
remoteRoot = "/home/mmc-user/fair-psgg"
}
},
},
}

View File

@@ -0,0 +1,26 @@
-- nvim-dap
vim.keymap.set('n', '<Leader>dc', function() require('dap').continue() end)
vim.keymap.set('n', '<Leader>dn', function() require('dap').step_over() end)
vim.keymap.set('n', '<Leader>di', function() require('dap').step_into() end)
vim.keymap.set('n', '<Leader>do', function() require('dap').step_out() end)
vim.keymap.set('n', '<Leader>db', function() require('dap').toggle_breakpoint() end)
--vim.keymap.set('n', '<Leader>dB', function() require('dap').set_breakpoint() end)
--vim.keymap.set('n', '<Leader>lp', function() require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end)
vim.keymap.set('n', '<Leader>dr', function() require('dap').repl.open() end)
--vim.keymap.set('n', '<Leader>dl', function() require('dap').run_last() end)
vim.keymap.set({'n', 'v'}, '<Leader>dh', function()
require('dap.ui.widgets').hover()
end)
vim.keymap.set({'n', 'v'}, '<Leader>dp', function()
require('dap.ui.widgets').preview()
end)
vim.keymap.set('n', '<Leader>df', function()
local widgets = require('dap.ui.widgets')
widgets.centered_float(widgets.frames)
end)
vim.keymap.set('n', '<Leader>ds', function()
local widgets = require('dap.ui.widgets')
widgets.centered_float(widgets.scopes)
end)

View File

@@ -0,0 +1,15 @@
local dap = require("dap")
local dapui = require("dapui")
dapui.setup() -- Use defaults, or customize below
-- Auto-open and close UI with debugger
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end

View File

@@ -0,0 +1,3 @@
-- vim-fugitive
vim.keymap.set("n", "<leader>g", vim.cmd.Git)

View File

@@ -0,0 +1,6 @@
-- gruvbox theme
vim.g.gruvbox_improved_strings = 1
vim.g.gruvbox_improved_warnings = 1
vim.cmd("silent! colorscheme gruvbox")

View File

@@ -0,0 +1,12 @@
-- harpoon
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
vim.keymap.set("n", "<leader>a", mark.add_file)
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
vim.keymap.set("n", "<C-j>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<C-k>", function() ui.nav_file(2) end)
vim.keymap.set("n", "<C-l>", function() ui.nav_file(3) end)
vim.keymap.set("n", "<C-ö>", function() ui.nav_file(4) end)

View File

@@ -0,0 +1,46 @@
vim.api.nvim_create_autocmd('LspAttach', {
desc = 'LSP actions',
callback = function()
local bufmap = function(mode, lhs, rhs)
local opts = {buffer = true}
vim.keymap.set(mode, lhs, rhs, opts)
end
-- Displays hover information about the symbol under the cursor
bufmap('n', 'K', vim.lsp.buf.hover)
-- Jump to the definition
bufmap('n', 'gd', vim.lsp.buf.definition)
-- Jump to declaration
bufmap('n', 'gD', vim.lsp.buf.declaration)
-- Lists all the implementations for the symbol under the cursor
bufmap('n', 'gi', vim.lsp.buf.implementation)
-- Jumps to the definition of the type symbol
bufmap('n', 'go', vim.lsp.buf.type_definition)
-- Lists all the references
bufmap('n', 'gr', vim.lsp.buf.references)
-- Displays a function's signature information
bufmap('n', 'gs', vim.lsp.buf.signature_help)
-- Renames all references to the symbol under the cursor
bufmap('n', '<F2>', vim.lsp.buf.rename)
-- Selects a code action available at the current cursor position
bufmap('n', '<F4>', vim.lsp.buf.code_action)
-- Show diagnostics in a floating window
bufmap('n', 'gl', vim.diagnostic.open_float)
-- Move to the previous diagnostic
bufmap('n', '[d', vim.diagnostic.goto_prev)
-- Move to the next diagnostic
bufmap('n', ']d', vim.diagnostic.goto_next)
end
})

View File

@@ -0,0 +1,46 @@
-- nvim-lspconfig
local lspconfig = require("lspconfig")
-- set capabilities
local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
-- lua --
local on_init_lua_ls = function(client)
local path = client.workspace_folders[1].name
if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
return
end
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
runtime = {
version = 'LuaJIT'
},
-- Make the server aware of Neovim runtime files
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME
}
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
-- library = vim.api.nvim_get_runtime_file("", true)
}
})
end
lspconfig.lua_ls.setup({
on_init = on_init_lua_ls,
settings = { Lua = {} },
capabilities = lsp_capabilities,
})
-- python --
lspconfig.pyright.setup({
capabilities = lsp_capabilities,
})
lspconfig.ruff.setup({ init_options = { settings = {} } })
-- golang --
lspconfig.gopls.setup({
capabilities = lsp_capabilities,
})

View File

@@ -0,0 +1,9 @@
-- telescope.nvim
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})

View File

@@ -0,0 +1,7 @@
-- nvim-treesitter.lua
local treesitter_configs = require('nvim-treesitter.configs')
treesitter_configs.setup({
ensure_installed = { "bash", "c", "lua", "vim", "vimdoc", "markdown", "markdown_inline", "html", "python", "css" },
})

View File

@@ -0,0 +1,5 @@
-- vimwiki
--vim.keymap.set("n", "<leader>ww", ":e ~/Documents/notes/index.wiki<CR>")
vim.cmd("let g:vimwiki_list = [{'path': '~/Documents/notes/', 'syntax': 'markdown', 'ext': '.md'}]")
vim.cmd("eval g:vimwiki#vars#init()")