feat: Neovim config mit LSP, Treesitter und PlatformIO
This commit is contained in:
parent
c2b9c8f3c9
commit
824ff44370
9 changed files with 345 additions and 0 deletions
26
nvim/init.lua
Normal file
26
nvim/init.lua
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.signcolumn = 'yes'
|
||||
vim.opt.updatetime = 250
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
|
||||
vim.g.python3_host_prog = '/Users/rene/miniconda3/bin/python3'
|
||||
|
||||
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
'git', 'clone', '--filter=blob:none',
|
||||
'https://github.com/folke/lazy.nvim.git',
|
||||
'--branch=stable', lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require('lazy').setup('plugins')
|
||||
78
nvim/install-nvim-dotfiles.sh
Normal file
78
nvim/install-nvim-dotfiles.sh
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Neovim Dotfiles Installer
|
||||
# Erstellt Symlink und installiert Abhängigkeiten
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
NVIM_CONFIG="$HOME/.config/nvim"
|
||||
|
||||
echo "=== Neovim Dotfiles Installer ==="
|
||||
|
||||
# Prüfe ob Neovim installiert ist
|
||||
if ! command -v nvim &> /dev/null; then
|
||||
echo "Neovim nicht gefunden!"
|
||||
echo "Installation:"
|
||||
echo " macOS: brew install neovim"
|
||||
echo " Debian: sudo apt install neovim"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Backup falls Config existiert
|
||||
if [ -e "$NVIM_CONFIG" ] && [ ! -L "$NVIM_CONFIG" ]; then
|
||||
echo "Bestehende Config gefunden, erstelle Backup..."
|
||||
mv "$NVIM_CONFIG" "$NVIM_CONFIG.bak.$(date +%Y%m%d%H%M%S)"
|
||||
fi
|
||||
|
||||
# Entferne alten Symlink falls vorhanden
|
||||
if [ -L "$NVIM_CONFIG" ]; then
|
||||
echo "Entferne alten Symlink..."
|
||||
rm "$NVIM_CONFIG"
|
||||
fi
|
||||
|
||||
# Erstelle .config falls nicht vorhanden
|
||||
mkdir -p "$HOME/.config"
|
||||
|
||||
# Symlink erstellen
|
||||
echo "Erstelle Symlink: $NVIM_CONFIG -> $SCRIPT_DIR"
|
||||
ln -s "$SCRIPT_DIR" "$NVIM_CONFIG"
|
||||
|
||||
# Abhängigkeiten prüfen/installieren
|
||||
echo ""
|
||||
echo "=== Empfohlene Abhängigkeiten ==="
|
||||
|
||||
if command -v brew &> /dev/null; then
|
||||
# macOS
|
||||
echo "macOS erkannt, prüfe Homebrew-Pakete..."
|
||||
|
||||
PACKAGES="ripgrep fd node"
|
||||
for pkg in $PACKAGES; do
|
||||
if ! brew list $pkg &> /dev/null; then
|
||||
echo "Installiere $pkg..."
|
||||
brew install $pkg
|
||||
else
|
||||
echo "✓ $pkg bereits installiert"
|
||||
fi
|
||||
done
|
||||
elif command -v apt &> /dev/null; then
|
||||
# Debian/Ubuntu
|
||||
echo "Debian/Ubuntu erkannt"
|
||||
echo "Empfohlene Pakete: ripgrep fd-find nodejs npm"
|
||||
echo " sudo apt install ripgrep fd-find nodejs npm"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Installation abgeschlossen ==="
|
||||
echo "Starte nvim – Plugins werden automatisch installiert."
|
||||
echo ""
|
||||
echo "Shortcuts:"
|
||||
echo " Space + e Dateibaum"
|
||||
echo " Space + ff Dateien suchen"
|
||||
echo " Space + fg Text suchen"
|
||||
echo " Space + pb PlatformIO Build"
|
||||
echo " Space + pu PlatformIO Upload"
|
||||
echo " Space + pm Serial Monitor"
|
||||
echo " Ctrl + t Terminal toggle"
|
||||
echo " gd Gehe zur Definition"
|
||||
echo " K Hover/Dokumentation"
|
||||
22
nvim/lazy-lock.json
Normal file
22
nvim/lazy-lock.json
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "3b3571b4dadbcb464804466e9872e7246c316af7" },
|
||||
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ad95655ec5d13ff7c728d731eb9fd39f34395a03" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "eb33612bff2fb31f54946fb5dcadc89e905e81ec" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "d3218d988f72ed34414959c9ccd802d393432d6e" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "3d757e586ff0bfc85bdb7b46c9d3d932147a0cde" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||
}
|
||||
50
nvim/lua/plugins/editor.lua
Normal file
50
nvim/lua/plugins/editor.lua
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
return {
|
||||
-- Farbschema
|
||||
{
|
||||
'folke/tokyonight.nvim',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd.colorscheme('tokyonight-night')
|
||||
end,
|
||||
},
|
||||
|
||||
-- Statusleiste
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
require('lualine').setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Dateibaum
|
||||
{
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
keys = {
|
||||
{ '<leader>e', '<cmd>NvimTreeToggle<cr>', desc = 'Dateibaum' },
|
||||
},
|
||||
config = function()
|
||||
require('nvim-tree').setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Fuzzy Finder
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
keys = {
|
||||
{ '<leader>ff', '<cmd>Telescope find_files<cr>', desc = 'Dateien suchen' },
|
||||
{ '<leader>fg', '<cmd>Telescope live_grep<cr>', desc = 'Text suchen' },
|
||||
{ '<leader>fb', '<cmd>Telescope buffers<cr>', desc = 'Buffers' },
|
||||
},
|
||||
},
|
||||
|
||||
-- Git Integration
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = function()
|
||||
require('gitsigns').setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
1
nvim/lua/plugins/init.lua
Normal file
1
nvim/lua/plugins/init.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
return {}
|
||||
106
nvim/lua/plugins/lsp.lua
Normal file
106
nvim/lua/plugins/lsp.lua
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
return {
|
||||
-- Syntax Highlighting
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
config = function()
|
||||
vim.treesitter.language.register('markdown', 'mdx')
|
||||
-- Parser installieren
|
||||
local parsers = { 'lua', 'python', 'c', 'cpp', 'json', 'yaml', 'markdown', 'bash' }
|
||||
for _, parser in ipairs(parsers) do
|
||||
pcall(function()
|
||||
vim.treesitter.start(0, parser)
|
||||
end)
|
||||
end
|
||||
-- Highlight aktivieren
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
pcall(vim.treesitter.start)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Mason für LSP Installation
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
config = function()
|
||||
require('mason').setup()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
dependencies = { 'williamboman/mason.nvim' },
|
||||
config = function()
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = { 'pyright', 'lua_ls', 'clangd' },
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- LSP Config (mit neuer API für nvim 0.11)
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = { 'williamboman/mason-lspconfig.nvim' },
|
||||
config = function()
|
||||
-- Keymaps wenn LSP attached
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(args)
|
||||
local opts = { buffer = args.buf }
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
-- LSP Server aktivieren
|
||||
vim.lsp.enable('pyright')
|
||||
vim.lsp.enable('lua_ls')
|
||||
vim.lsp.enable('clangd')
|
||||
end,
|
||||
},
|
||||
|
||||
-- Autovervollständigung
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'L3MON4D3/LuaSnip',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
},
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
31
nvim/lua/plugins/platformio.lua
Normal file
31
nvim/lua/plugins/platformio.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
return {
|
||||
-- Terminal Toggle
|
||||
{
|
||||
'akinsho/toggleterm.nvim',
|
||||
version = '*',
|
||||
opts = {
|
||||
size = 15,
|
||||
open_mapping = [[<C-t>]],
|
||||
direction = 'float',
|
||||
},
|
||||
},
|
||||
|
||||
-- PlatformIO Keymaps (custom)
|
||||
{
|
||||
'folke/which-key.nvim',
|
||||
config = function()
|
||||
local wk = require('which-key')
|
||||
wk.setup()
|
||||
|
||||
-- PlatformIO Befehle
|
||||
wk.add({
|
||||
{ '<leader>p', group = 'PlatformIO' },
|
||||
{ '<leader>pb', '<cmd>!pio run<cr>', desc = 'Build' },
|
||||
{ '<leader>pu', '<cmd>!pio run -t upload<cr>', desc = 'Upload' },
|
||||
{ '<leader>pc', '<cmd>!pio run -t clean<cr>', desc = 'Clean' },
|
||||
{ '<leader>pm', '<cmd>TermExec cmd="pio device monitor"<cr>', desc = 'Serial Monitor' },
|
||||
{ '<leader>pi', '<cmd>!pio init<cr>', desc = 'Init Project' },
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
1
nvim/lua/plugins/plugins-init.lua
Normal file
1
nvim/lua/plugins/plugins-init.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
return {}
|
||||
30
nvim/nvim-init.lua
Normal file
30
nvim/nvim-init.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
-- Grundeinstellungen
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.signcolumn = 'yes'
|
||||
vim.opt.updatetime = 250
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
|
||||
-- Python für Neovim
|
||||
vim.g.python3_host_prog = '/Users/rene/miniconda3/bin/python3'
|
||||
|
||||
-- lazy.nvim Bootstrap
|
||||
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
'git', 'clone', '--filter=blob:none',
|
||||
'https://github.com/folke/lazy.nvim.git',
|
||||
'--branch=stable', lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Plugins laden
|
||||
require('lazy').setup('plugins')
|
||||
Loading…
Add table
Add a link
Reference in a new issue