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
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 {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue