summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorfschildt <florian.schildt@protonmail.com>2025-11-30 01:49:54 +0100
committerfschildt <florian.schildt@protonmail.com>2025-11-30 01:49:54 +0100
commite57b85a92b2ac9120d4685bbd926773d599b6555 (patch)
tree50cce8779924cd17b7ea886e1a552fced1c661ba /.config/nvim
parent99af108f8cd0560344fb7c8e6d027355e3f4b933 (diff)
nvim: restructure whole configHEADmaster
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/init.lua245
-rw-r--r--.config/nvim/lua/custom/keymaps.lua6
-rw-r--r--.config/nvim/lua/custom/plugins/cmp.lua53
-rw-r--r--.config/nvim/lua/custom/plugins/gruvbox_material.lua7
-rw-r--r--.config/nvim/lua/custom/plugins/init.lua44
-rw-r--r--.config/nvim/lua/custom/plugins/lsp.lua18
-rw-r--r--.config/nvim/lua/custom/plugins/lualine.lua55
-rw-r--r--.config/nvim/lua/custom/plugins/telescope.lua7
-rw-r--r--.config/nvim/lua/custom/plugins/treesitter.lua7
-rw-r--r--.config/nvim/lua/custom/plugins/vimtex.lua1
-rw-r--r--.config/nvim/lua/custom/set.lua25
11 files changed, 226 insertions, 242 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index 4c347d2..10a7544 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -1,243 +1,4 @@
--- general settings
-local vim = vim
-vim.opt.number = true -- show line numbers
-vim.opt.relativenumber = true -- relative line numbers for navigation
-vim.opt.clipboard:append { 'unnamedplus' } -- use clipboard
-vim.opt.mouse = "a" -- enable mouse support
-vim.opt.updatetime = 250 -- Faster updates (e.g., for LSP diagnostics)
-vim.opt.timeoutlen = 500 -- Shorter timeout for key sequences
-vim.opt.splitright = true -- vsplit opens new buffer on the right side
-
--- tab and indentation settings
-vim.opt.expandtab = true -- tabs are converted to spaces
-vim.opt.shiftwidth = 4 -- 4 spaces for indentation
-vim.opt.tabstop = 4 -- 4 spaces for tabs
-vim.opt.softtabstop = 4 -- 4 spaces for tab key
-vim.opt.autoindent = true -- Copy indent from previous line
-vim.opt.cindent = true
-vim.opt.cino = ":0l1(0"
-
--- plugin preparation
-vim.opt.signcolumn = "yes" -- LSP diagnostics
-vim.opt.termguicolors = true -- enable true colors
-vim.opt.completeopt = { "menu", "menuone", "noselect" } -- required for nvim-cmp
-vim.g.mapleader = " " -- Set leader to space
-vim.g.maplocalleader = "\\" -- Set local leader to backslash
-
-
--- keymap
-vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition, { desc = 'Go to definition' })
-vim.keymap.set('n', '<M-j>', '<cmd>cnext<CR>')
-vim.keymap.set('n', '<M-k>', '<cmd>cprev<CR>')
-
-
--- packages
-vim.pack.add({
- -- colorscheme
- { src = 'https://github.com/sainnhe/gruvbox-material' },
-
- -- status line
- { src = 'https://github.com/nvim-tree/nvim-web-devicons' },
- { src = 'https://github.com/nvim-lualine/lualine.nvim' },
-
- -- treesitter
- { src = 'https://github.com/nvim-treesitter/nvim-treesitter', version = 'main' },
-
- -- autoconfigure language servers
- { src = 'https://github.com/neovim/nvim-lspconfig' },
-
- -- install language servers
- { src = 'https://github.com/mason-org/mason.nvim' },
- { src = 'https://github.com/mason-org/mason-lspconfig.nvim' },
-
- -- autocomplete
- { src = 'https://github.com/hrsh7th/cmp-nvim-lsp' },
- { src = 'https://github.com/hrsh7th/cmp-buffer' },
- { src = 'https://github.com/hrsh7th/cmp-path' },
- { src = 'https://github.com/hrsh7th/cmp-cmdline' },
- { src = 'https://github.com/hrsh7th/nvim-cmp' },
- { src = 'https://github.com/hrsh7th/cmp-vsnip' },
- { src = 'https://github.com/hrsh7th/vim-vsnip' },
- { src = 'https://github.com/rafamadriz/friendly-snippets' },
-
- -- telescope
- { src = 'https://github.com/nvim-lua/plenary.nvim' },
- { src = 'https://github.com/nvim-telescope/telescope.nvim', tag = 'v0.1.9' },
-
- -- latex support
- { src = 'https://github.com/lervag/vimtex' },
-})
-
-
-
--- init plugin gruvbox-material
-vim.g.gruvbox_material_background = 'hard'
-vim.g.gruvbox_material_foreground = 'material'
-vim.g.gruvbox_material_enable_italic = true
-vim.g.gruvbox_material_disable_italic_comment = false
-vim.g.gruvbox_material_better_performance = 1
-vim.cmd.colorscheme('gruvbox-material')
-
-
--- init plugin lualine
-require('lualine').setup({
- options = {
- icons_enabled = true,
- theme = 'auto',
- component_separators = { left = '', right = ''},
- section_separators = { left = '', right = ''},
- disabled_filetypes = {
- statusline = {},
- winbar = {},
- },
- ignore_focus = {},
- always_divide_middle = true,
- always_show_tabline = true,
- globalstatus = false,
- refresh = {
- statusline = 1000,
- tabline = 1000,
- winbar = 1000,
- refresh_time = 16, -- ~60fps
- events = {
- 'WinEnter',
- 'BufEnter',
- 'BufWritePost',
- 'SessionLoadPost',
- 'FileChangedShellPost',
- 'VimResized',
- 'Filetype',
- 'CursorMoved',
- 'CursorMovedI',
- 'ModeChanged',
- },
- }
- },
- sections = {
- lualine_a = {'mode'},
- lualine_b = {'branch', 'diff', 'diagnostics'},
- lualine_c = {'filename'},
- lualine_x = {'encoding', 'fileformat', 'filetype'},
- lualine_y = {'progress'},
- lualine_z = {'location'}
- },
- inactive_sections = {
- lualine_a = {},
- lualine_b = {},
- lualine_c = {'filename'},
- lualine_x = {'location'},
- lualine_y = {},
- lualine_z = {}
- },
- tabline = {},
- winbar = {},
- inactive_winbar = {},
- extensions = {}
-})
-
-
--- treesitter
-require('nvim-treesitter').setup {
- config = {
- ensure_installed = { 'cpp', 'html', 'htmldjango' },
- automatic_installation = true,
- }
-}
-
-
--- cmp
-local cmp = require("cmp")
-cmp.setup({
- snippet = {
- expand = function(args)
- vim.fn["vsnip#anonymous"](args.body)
- end,
- },
- window = {
- -- completion = cmp.config.window.bordered(),
- -- documentation = cmp.config.window.bordered(),
- },
- mapping = cmp.mapping.preset.insert({
- ['<C-b>'] = cmp.mapping.scroll_docs(-4),
- ['<C-f>'] = cmp.mapping.scroll_docs(4),
- ['<C-Space>'] = cmp.mapping.complete(),
- ['<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.
- }),
- sources = cmp.config.sources(
- {
- { name = 'nvim_lsp' },
- { name = 'vsnip' },
- },
- {
- { name = 'buffer' },
- })
-})
-
--- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
-cmp.setup.cmdline({ '/', '?' }, {
- mapping = cmp.mapping.preset.cmdline(),
- sources = {
- { name = 'buffer' }
- }
-})
-
--- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
-cmp.setup.cmdline(':', {
- mapping = cmp.mapping.preset.cmdline(),
- sources = cmp.config.sources(
- {
- { name = 'path' }
- },
- {
- { name = 'cmdline' }
- }
- ),
- matching = { disallow_symbol_nonprefix_matching = false }
-})
-
-
-local capabilities = require('cmp_nvim_lsp').default_capabilities()
-require('mason').setup()
-require('mason-lspconfig').setup({
- ensure_installed = {
- 'lua_ls',
- 'clangd',
- 'pyright',
- 'html', -- official vscode html server
- },
-})
-
-vim.lsp.config('*', {
- capabilities = capabilities,
-})
-
-vim.lsp.config('html', {
- filetypes = { "html", "htmldjango" },
- init_options = {
- provideFormatter = true,
- embeddedLanguages = { css = true, javascript = true },
- },
-})
-
-
-
--- telescope
-local builtin = require('telescope.builtin')
-vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
-vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
-vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
-vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
-
-
-
--- vimtex (latex support)
-require('lualine').setup({
- ft = { 'tex', 'bib' },
- dependencies = { 'nvim-treesitter/nvim-treesitter' },
- config = function()
- vim.g.vimtex_view_method = 'mupdf'
- end
-})
-
+require('custom.set')
+require('custom.keymaps')
+require('custom.plugins')
diff --git a/.config/nvim/lua/custom/keymaps.lua b/.config/nvim/lua/custom/keymaps.lua
new file mode 100644
index 0000000..9cef807
--- /dev/null
+++ b/.config/nvim/lua/custom/keymaps.lua
@@ -0,0 +1,6 @@
+vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition, { desc = 'Go to definition' })
+
+-- quickfix navigation (up/down)
+vim.keymap.set('n', '<M-j>', '<cmd>cnext<CR>')
+vim.keymap.set('n', '<M-k>', '<cmd>cprev<CR>')
+
diff --git a/.config/nvim/lua/custom/plugins/cmp.lua b/.config/nvim/lua/custom/plugins/cmp.lua
new file mode 100644
index 0000000..51d0a30
--- /dev/null
+++ b/.config/nvim/lua/custom/plugins/cmp.lua
@@ -0,0 +1,53 @@
+local cmp = require("cmp")
+
+cmp.setup({
+ snippet = {
+ expand = function(args)
+ vim.fn["vsnip#anonymous"](args.body)
+ end,
+ },
+ window = {
+ -- completion = cmp.config.window.bordered(),
+ -- documentation = cmp.config.window.bordered(),
+ },
+ mapping = cmp.mapping.preset.insert({
+ ['<C-b>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-f>'] = cmp.mapping.scroll_docs(4),
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<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.
+ }),
+ sources = cmp.config.sources({
+ { name = 'nvim_lsp' },
+ { name = 'vsnip' },
+ { name = 'friendly-snippets '}
+ }, {
+ { name = 'buffer' },
+ })
+})
+
+-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
+cmp.setup.cmdline({ '/', '?' }, {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = {
+ { name = 'buffer' }
+ }
+})
+
+-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
+cmp.setup.cmdline(':', {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = 'path' }
+ }, {
+ { name = 'cmdline' }
+ }),
+ matching = { disallow_symbol_nonprefix_matching = false }
+})
+
+
+local capabilities = require('cmp_nvim_lsp').default_capabilities()
+vim.lsp.config('*', {
+ capabilities = capabilities,
+})
+
diff --git a/.config/nvim/lua/custom/plugins/gruvbox_material.lua b/.config/nvim/lua/custom/plugins/gruvbox_material.lua
new file mode 100644
index 0000000..8b0d51f
--- /dev/null
+++ b/.config/nvim/lua/custom/plugins/gruvbox_material.lua
@@ -0,0 +1,7 @@
+-- init plugin gruvbox-material
+vim.g.gruvbox_material_background = 'hard'
+vim.g.gruvbox_material_foreground = 'material'
+vim.g.gruvbox_material_enable_italic = true
+vim.g.gruvbox_material_disable_italic_comment = false
+vim.g.gruvbox_material_better_performance = 1
+vim.cmd.colorscheme('gruvbox-material')
diff --git a/.config/nvim/lua/custom/plugins/init.lua b/.config/nvim/lua/custom/plugins/init.lua
new file mode 100644
index 0000000..ec4bded
--- /dev/null
+++ b/.config/nvim/lua/custom/plugins/init.lua
@@ -0,0 +1,44 @@
+vim.pack.add({
+ -- colorscheme
+ { src = 'https://github.com/sainnhe/gruvbox-material' },
+
+ -- status line
+ { src = 'https://github.com/nvim-tree/nvim-web-devicons' },
+ { src = 'https://github.com/nvim-lualine/lualine.nvim' },
+
+ -- treesitter
+ { src = 'https://github.com/nvim-treesitter/nvim-treesitter', version = 'main' },
+
+ -- autoconfigure language servers
+ { src = 'https://github.com/neovim/nvim-lspconfig' },
+
+ -- install language servers
+ { src = 'https://github.com/mason-org/mason.nvim' },
+ { src = 'https://github.com/mason-org/mason-lspconfig.nvim' },
+
+ -- autocomplete
+ { src = 'https://github.com/hrsh7th/cmp-nvim-lsp' },
+ { src = 'https://github.com/hrsh7th/cmp-buffer' },
+ { src = 'https://github.com/hrsh7th/cmp-path' },
+ { src = 'https://github.com/hrsh7th/cmp-cmdline' },
+ { src = 'https://github.com/hrsh7th/nvim-cmp' },
+ { src = 'https://github.com/hrsh7th/cmp-vsnip' },
+ { src = 'https://github.com/hrsh7th/vim-vsnip' },
+ { src = 'https://github.com/rafamadriz/friendly-snippets' },
+
+ -- telescope
+ { src = 'https://github.com/nvim-lua/plenary.nvim' },
+ { src = 'https://github.com/nvim-telescope/telescope.nvim', tag = 'v0.1.9' },
+
+ -- latex support
+ { src = 'https://github.com/lervag/vimtex' },
+})
+
+require('custom.plugins.gruvbox_material')
+require('custom.plugins.lualine')
+require('custom.plugins.treesitter')
+require('custom.plugins.lsp')
+require('custom.plugins.cmp')
+require('custom.plugins.telescope')
+require('custom.plugins.vimtex')
+
diff --git a/.config/nvim/lua/custom/plugins/lsp.lua b/.config/nvim/lua/custom/plugins/lsp.lua
new file mode 100644
index 0000000..c65711c
--- /dev/null
+++ b/.config/nvim/lua/custom/plugins/lsp.lua
@@ -0,0 +1,18 @@
+require('mason').setup()
+require('mason-lspconfig').setup({
+ ensure_installed = {
+ 'lua_ls',
+ 'clangd',
+ 'pyright',
+ 'html',
+ },
+})
+
+vim.lsp.config('html', {
+ filetypes = { "html", "htmldjango" },
+ init_options = {
+ provideFormatter = true,
+ embeddedLanguages = { css = true, javascript = true },
+ },
+})
+
diff --git a/.config/nvim/lua/custom/plugins/lualine.lua b/.config/nvim/lua/custom/plugins/lualine.lua
new file mode 100644
index 0000000..d8fe1f9
--- /dev/null
+++ b/.config/nvim/lua/custom/plugins/lualine.lua
@@ -0,0 +1,55 @@
+require('lualine').setup({
+ options = {
+ icons_enabled = true,
+ theme = 'auto',
+ component_separators = { left = '', right = ''},
+ section_separators = { left = '', right = ''},
+ disabled_filetypes = {
+ statusline = {},
+ winbar = {},
+ },
+ ignore_focus = {},
+ always_divide_middle = true,
+ always_show_tabline = true,
+ globalstatus = false,
+ refresh = {
+ statusline = 1000,
+ tabline = 1000,
+ winbar = 1000,
+ refresh_time = 16, -- ~60fps
+ events = {
+ 'WinEnter',
+ 'BufEnter',
+ 'BufWritePost',
+ 'SessionLoadPost',
+ 'FileChangedShellPost',
+ 'VimResized',
+ 'Filetype',
+ 'CursorMoved',
+ 'CursorMovedI',
+ 'ModeChanged',
+ },
+ }
+ },
+ sections = {
+ lualine_a = {'mode'},
+ lualine_b = {'branch', 'diff', 'diagnostics'},
+ lualine_c = {'filename'},
+ lualine_x = {'encoding', 'fileformat', 'filetype'},
+ lualine_y = {'progress'},
+ lualine_z = {'location'}
+ },
+ inactive_sections = {
+ lualine_a = {},
+ lualine_b = {},
+ lualine_c = {'filename'},
+ lualine_x = {'location'},
+ lualine_y = {},
+ lualine_z = {}
+ },
+ tabline = {},
+ winbar = {},
+ inactive_winbar = {},
+ extensions = {}
+})
+
diff --git a/.config/nvim/lua/custom/plugins/telescope.lua b/.config/nvim/lua/custom/plugins/telescope.lua
new file mode 100644
index 0000000..5e24c91
--- /dev/null
+++ b/.config/nvim/lua/custom/plugins/telescope.lua
@@ -0,0 +1,7 @@
+-- telescope
+local builtin = require('telescope.builtin')
+vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
+vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
+vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
+vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
+
diff --git a/.config/nvim/lua/custom/plugins/treesitter.lua b/.config/nvim/lua/custom/plugins/treesitter.lua
new file mode 100644
index 0000000..91e3f36
--- /dev/null
+++ b/.config/nvim/lua/custom/plugins/treesitter.lua
@@ -0,0 +1,7 @@
+require('nvim-treesitter').setup {
+ config = {
+ ensure_installed = { 'cpp', 'html', 'htmldjango' },
+ automatic_installation = true,
+ }
+}
+
diff --git a/.config/nvim/lua/custom/plugins/vimtex.lua b/.config/nvim/lua/custom/plugins/vimtex.lua
new file mode 100644
index 0000000..d774bc5
--- /dev/null
+++ b/.config/nvim/lua/custom/plugins/vimtex.lua
@@ -0,0 +1 @@
+vim.g.vimtex_view_method = 'mupdf'
diff --git a/.config/nvim/lua/custom/set.lua b/.config/nvim/lua/custom/set.lua
new file mode 100644
index 0000000..d8bb02c
--- /dev/null
+++ b/.config/nvim/lua/custom/set.lua
@@ -0,0 +1,25 @@
+local vim = vim
+vim.opt.number = true -- show line numbers
+vim.opt.relativenumber = true -- relative line numbers for navigation
+vim.opt.clipboard:append { 'unnamedplus' } -- use clipboard
+vim.opt.mouse = "a" -- enable mouse support
+vim.opt.updatetime = 250 -- Faster updates (e.g., for LSP diagnostics)
+vim.opt.timeoutlen = 500 -- Shorter timeout for key sequences
+vim.opt.splitright = true -- vsplit opens new buffer on the right side
+
+-- tab and indentation settings
+vim.opt.expandtab = true -- tabs are converted to spaces
+vim.opt.shiftwidth = 4 -- 4 spaces for indentation
+vim.opt.tabstop = 4 -- 4 spaces for tabs
+vim.opt.softtabstop = 4 -- 4 spaces for tab key
+vim.opt.autoindent = true -- Copy indent from previous line
+vim.opt.cindent = true
+vim.opt.cino = ":0l1(0"
+
+-- plugin preparation
+vim.opt.signcolumn = "yes" -- LSP diagnostics
+vim.opt.termguicolors = true -- enable true colors
+vim.opt.completeopt = { "menu", "menuone", "noselect" } -- required for nvim-cmp
+vim.g.mapleader = " " -- Set leader to space
+vim.g.maplocalleader = "\\" -- Set local leader to backslash
+