aboutsummaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
authorschererleander <leander@schererleander.de>2024-11-25 10:03:13 +0100
committerschererleander <leander@schererleander.de>2024-11-25 10:03:13 +0100
commit6a984c87c46330d7507e3d9cbf076a71fd551617 (patch)
tree65f57e0b21a2f298b97f545d539873964d9abec8 /nvim
parent2190e0c14b84f1712f23fb67cf4995062e56236e (diff)
update nvim
Diffstat (limited to 'nvim')
-rw-r--r--nvim/init.lua3
-rw-r--r--nvim/lazy-lock.json6
-rw-r--r--nvim/lua/autocmds.lua25
-rw-r--r--nvim/lua/options.lua2
-rw-r--r--nvim/lua/plugins.lua589
5 files changed, 349 insertions, 276 deletions
diff --git a/nvim/init.lua b/nvim/init.lua
index 170b0a5..607914b 100644
--- a/nvim/init.lua
+++ b/nvim/init.lua
@@ -11,7 +11,8 @@ if not vim.loop.fs_stat(lazypath) then
end
vim.opt.rtp:prepend(lazypath)
+
require('options')
require('keymaps')
require('plugins')
-require('autocmds') \ No newline at end of file
+require('autocmds')
diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json
index 1fe1cf4..ab81974 100644
--- a/nvim/lazy-lock.json
+++ b/nvim/lazy-lock.json
@@ -6,16 +6,18 @@
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"gitsigns.nvim": { "branch": "main", "commit": "4e348641b8206c3b8d23080999e3ddbe4ca90efc" },
"lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" },
+ "lspkind-nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "55716a879568a498fa236593c8119789054a3b8e" },
"mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" },
"mini.nvim": { "branch": "main", "commit": "e025ee74705b04dd25a132a521c9c535dc78a8d8" },
"nightfox.nvim": { "branch": "main", "commit": "a4eb88b2dad3fba5c2d87f82cd15dfb9de73913d" },
- "nvim-autopairs": { "branch": "master", "commit": "4a39f2dcbe1967ddc3a0f76f863540dd3aa7871a" },
+ "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-lint": { "branch": "master", "commit": "941fa1220a61797a51f3af9ec6b7d74c8c7367ce" },
"nvim-lspconfig": { "branch": "master", "commit": "4bdd3800b4148f670c6cf55ef65f490148eeb550" },
- "nvim-treesitter": { "branch": "master", "commit": "35c1a32b267c969a024ef651c8a25d7ff9018d22" },
+ "nvim-treesitter": { "branch": "master", "commit": "0603b3e3d21ebe2fa82dc5361a3d500e0d3ad3a8" },
"nvim-web-devicons": { "branch": "master", "commit": "75df79feb02d5e0ec114e447453775d4d291ea03" },
+ "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
"plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
"staline.nvim": { "branch": "main", "commit": "c49f2deaba3d3c669e7243b57619e0078e7a351b" },
"telescope.nvim": { "branch": "master", "commit": "b323abeb4baf9e4851c3af1961e770ce76c657c7" },
diff --git a/nvim/lua/autocmds.lua b/nvim/lua/autocmds.lua
index e8dd426..f0947b7 100644
--- a/nvim/lua/autocmds.lua
+++ b/nvim/lua/autocmds.lua
@@ -1,32 +1,21 @@
--- transparent background
---vim.cmd('highlight Normal guibg=NONE ctermbg=NONE')
---vim.cmd('highlight LineNr guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE')
---vim.cmd('highlight NormalNC guibg=NONE ctermbg=NONE')
---vim.cmd('highlight CursorLine guibg=NONE ctermbg=NONE')
--- completion menu transparent
---vim.cmd('highlight Pmenu guibg=NONE ctermbg=NONE')
---vim.cmd('highlight PmenuSel guibg=NONE ctermbg=NONE')
--- vertical lines transparent
vim.cmd('highlight WinSeparator guibg=None ctermbg=None')
vim.cmd('highlight VertSplit guibg=NONE ctermbg=NONE')
-- hide background lsp coloum
vim.cmd('highlight SignColumn guibg=NONE ctermbg=None')
+-- transparent background
+vim.cmd('highlight Normal guibg=NONE ctermbg=NONE')
+vim.cmd('highlight NormalNC guibg=NONE ctermbg=NONE')
+
+-- set linebreak for tex files
vim.cmd('autocmd FileType tex setlocal wrap linebreak')
+-- convert tex file into pdf using pdflatex on save
vim.cmd('autocmd BufWritePost *.tex silent !pdflatex %<CR>')
+-- remove space
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
pattern = { "*" },
command = [[%s/\s\+$//e]],
})
--- enable spellchecking
-vim.opt.spelllang = 'de'
-vim.opt.spell = true
-
--- set up spellchecking highlighting
-vim.cmd('highlight SpellBad cterm=underline gui=underline')
-vim.cmd('highlight SpellCap cterm=underline gui=underline')
-vim.cmd('highlight SpellRare cterm=underline gui=underline')
-vim.cmd('highlight SpellLocal cterm=underline gui=underline')
diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua
index 0530063..891668f 100644
--- a/nvim/lua/options.lua
+++ b/nvim/lua/options.lua
@@ -2,7 +2,7 @@ local options = {
list = false,
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
- conceallevel = 0, -- so that `` is visible in markdown files
+ conceallevel = 2, -- so that `` is visible in markdown files
fileencoding = "utf-8", -- the encoding written to a file
hidden = true, -- required to keep multiple buffers and open multiple buffers
hlsearch = true, -- highlight all matches on previous search pattern
diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua
index d8d2a73..00af5aa 100644
--- a/nvim/lua/plugins.lua
+++ b/nvim/lua/plugins.lua
@@ -1,276 +1,357 @@
require("lazy").setup({
{
"EdenEast/nightfox.nvim",
- priority = 1000,
- options = {
+ priority = 1000,
+ opts = {
transparent = true,
- terminal_colors = true,
- dim_inactive = false,
- module_default = true,
- styles = {
- comments = "italic",
- keywords = "italic",
- },
- inverse = {
- match_paren = false,
- visual = false,
- search = false,
- },
- },
- config = function ()
+ terminal_colors = true,
+ dim_inactive = false,
+ module_default = true,
+ styles = {
+ comments = "italic",
+ keywords = "italic",
+ },
+ inverse = {
+ match_paren = false,
+ visual = false,
+ search = false,
+ },
+ },
+ config = function()
vim.cmd("colorscheme terafox")
- end
- },
- {
- "hrsh7th/nvim-cmp",
- dependencies = {
- "williamboman/mason.nvim",
- "williamboman/mason-lspconfig.nvim",
- "neovim/nvim-lspconfig",
- "hrsh7th/cmp-nvim-lsp",
- "hrsh7th/cmp-buffer",
- "hrsh7th/cmp-path",
- "hrsh7th/cmp-cmdline",
- "L3MON4D3/LuaSnip",
- },
- event = "InsertEnter",
- config = function()
- require("mason").setup()
- require("mason-lspconfig").setup({ automatic_installation = true })
+ end,
+ },
- local lspconfig = require("lspconfig")
- local signs = {
- Error = " ",
- Warn = " ",
- Hint = " ",
- Info = " ",
- }
- for type, icon in pairs(signs) do
- local hl = "DiagnosticSign" .. type
- vim.fn.sign_define(hl, {
- text = icon,
- texthl = hl,
- numhl = hl,
- })
- end
+ {
+ "hrsh7th/nvim-cmp",
+ dependencies = {
+ "williamboman/mason.nvim",
+ "williamboman/mason-lspconfig.nvim",
+ "neovim/nvim-lspconfig",
+ "hrsh7th/cmp-nvim-lsp",
+ "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-path",
+ "hrsh7th/cmp-cmdline",
+ "L3MON4D3/LuaSnip",
+ "onsails/lspkind-nvim"
+ },
+ config = function()
+ require("mason").setup()
+ require("mason-lspconfig").setup({
+ ensure_installed = { "lua_ls", "jdtls", "pyright", "tailwindcss", "clangd" },
+ automatic_installation = true,
+ })
- local servers = require('mason-lspconfig').get_installed_servers()
- for _, server in pairs(servers) do
- lspconfig[server].setup{}
- end
+ local signs = {
+ Error = " ",
+ Warn = " ",
+ Hint = " ",
+ Info = " ",
+ }
+ for type, icon in pairs(signs) do
+ local hl = "DiagnosticSign" .. type
+ vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
+ end
- local capabilities = require("cmp_nvim_lsp").default_capabilities()
- lspconfig.lua_ls.setup({
- capabilities = capabilities,
- settings = {
- Lua = {
- diagnostics = {
- globals = { "vim" },
- },
- workspace = {
- library = vim.api.nvim_get_runtime_file("", true),
- },
- telemetry = {
- enable = false,
- },
- },
- },
- })
+ local capabilities = require("cmp_nvim_lsp").default_capabilities()
- local cmp = require("cmp")
- local luasnip = require("luasnip")
- require("luasnip.loaders.from_vscode").lazy_load()
- cmp.setup({
- snippet = {
- expand = function(args)
- luasnip.lsp_expand(args.body)
- end,
- },
- mapping = cmp.mapping.preset.insert({
- ["<C-d>"] = cmp.mapping.scroll_docs(-4),
- ["<C-f>"] = cmp.mapping.scroll_docs(4),
- ["<C-Space>"] = cmp.mapping.complete(),
- ["<C-e>"] = cmp.mapping.close(),
- ["<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()
- 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 = "luasnip" },
- { name = "buffer" },
- { name = "path" },
- },
- })
- end,
- },
+ local on_attach = function(client, bufnr)
+ local opts = { noremap = true, silent = true, buffer = bufnr }
+ vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
+ vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
+ vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
+ vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
+ vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts)
+ vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, opts)
+ vim.keymap.set("n", "<leader>wl", function()
+ print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
+ end, opts)
+ vim.keymap.set("n", "<leader>D", vim.lsp.buf.type_definition, opts)
+ 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", "gr", vim.lsp.buf.references, opts)
+ vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
+ vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
+ vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
+ vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, opts)
+ end
- {
- "nvim-treesitter/nvim-treesitter",
- build = ":TSUpdate",
- event = "BufRead",
- config = function()
- require("nvim-treesitter.configs").setup({
- auto_install = true,
- ensure_installed = { "c", "lua", "vim" },
- highlight = { enable = true, use_languagetree = true },
- indent = { enable = true },
- })
- end,
- },
+ local lspconfig = require("lspconfig")
- {
- "nvim-tree/nvim-tree.lua",
- enabled = false,
- config = function()
- require("nvim-tree").setup({
- view = { width = 20, side = "left" },
- disable_netrw = true,
- hijack_cursor = true,
- update_cwd = true,
- hijack_directories = { auto_open = true },
- renderer = {
- root_folder_label = false,
- indent_markers = {
- enable = true,
- icons = { corner = "└ ", edge = "│ ", none = " " },
- },
- },
- })
- end,
- },
+ lspconfig.lua_ls.setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+ settings = {
+ Lua = {
+ diagnostics = {
+ globals = { "vim" },
+ },
+ workspace = {
+ library = vim.api.nvim_get_runtime_file("", true),
+ },
+ telemetry = {
+ enable = false,
+ },
+ },
+ },
+ })
- {
- "nvim-telescope/telescope.nvim",
- dependencies = { "nvim-lua/plenary.nvim" },
- keys = {
- {"<C-s>", ":silent Telescope current_buffer_fuzzy_find<CR>", desc = "Open Telescope"}
- },
- config = function()
- require("telescope").setup({
- defaults = { mapping = {} },
- pickers = {},
- extensions = {},
- })
- end,
- },
+ lspconfig.jdtls.setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+ })
- {
- "akinsho/toggleterm.nvim",
- version = "*",
- config = true,
- },
+ lspconfig.pyright.setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+ })
- {
- "lewis6991/gitsigns.nvim",
- config = function()
- require("gitsigns").setup()
- end,
- },
+ lspconfig.tailwindcss.setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+ })
- {
- "mfussenegger/nvim-lint",
- event = { "BufReadPre", "BufNewFile" },
- config = function()
- local lint = require("lint")
+ lspconfig.clangd.setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+ })
- lint.linter_by_ft = {
- lua = { "luachecker" },
- python = { "pylint" },
- }
+ local cmp = require("cmp")
+ local luasnip = require("luasnip")
+ local lspkind = require("lspkind")
+ require("luasnip.loaders.from_vscode").lazy_load()
- local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
+ cmp.setup({
+ snippet = {
+ expand = function(args)
+ luasnip.lsp_expand(args.body)
+ end,
+ },
+ mapping = cmp.mapping.preset.insert({
+ ["<C-d>"] = cmp.mapping.scroll_docs(-4),
+ ["<C-f>"] = cmp.mapping.scroll_docs(4),
+ ["<C-Space>"] = cmp.mapping.complete(),
+ ["<C-e>"] = cmp.mapping.close(),
+ ["<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()
+ 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" }),
+ }),
+ formatting = {
+ format = lspkind.cmp_format({
+ mode = "symbol_text",
+ maxwidth = 50,
+ ellipsis_char = "..."
+ }),
+ },
+ sources = {
+ { name = "nvim_lsp" },
+ { name = "luasnip" },
+ { name = "buffer" },
+ { name = "path" },
+ },
+ })
- vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
- group = lint_augroup,
- callback = function()
- lint.try_lint()
- end,
- })
- end,
- },
+ cmp.setup.filetype('gitcommit', {
+ sources = cmp.config.sources({
+ { name = 'buffer' },
+ })
+ })
- {
- "echasnovski/mini.nvim",
- version = false,
- dependencies = { "nvim-tree/nvim-web-devicons" },
- config = function()
- require("mini.starter").setup({
- header = table.concat({
- " /l、 ",
- "(゚、 。 7 ",
- " l ~ ヽ ",
- " じしf_,)ノ ",
- }, "\n"),
- footer = "",
- content_hooks = {
- require("mini.starter").gen_hook.adding_bullet("» "),
- require("mini.starter").gen_hook.aligning("center", "center"),
- },
- })
- end,
- },
+ cmp.setup.cmdline(':', {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = 'path' }
+ }, {
+ { name = 'cmdline' }
+ })
+ })
+ end,
+ },
- {
- 'windwp/nvim-autopairs',
- event = "InsertEnter",
- config = function ()
- require("nvim-autopairs").setup{}
- end
- },
+ {
+ "nvim-treesitter/nvim-treesitter",
+ build = ":TSUpdate",
+ event = "BufRead",
+ config = function()
+ require("nvim-treesitter.configs").setup({
+ auto_install = true,
+ ensure_installed = { "c", "lua", "vim", "python", "java", "javascript", "typescript", "css", "html" },
+ highlight = { enable = true, use_languagetree = true },
+ indent = { enable = true },
+ })
+ end,
+ },
- {
- 'tamton-aquib/staline.nvim',
- dependencies = { 'nvim-tree/nvim-web-devicons' },
- config = function()
- require "staline".setup {
- sections = {
- left = { 'file_name', 'branch' },
- mid = { 'lsp' },
- right = { 'line_column' }
- },
- special_table = {
- NvimTree = { 'NvimTree', ' ' },
- packer = { 'Packer', ' ' },
- starter = { '', '' },
- lazy = { '', '' },
- mason = { '', '' }
- },
- lsp_symbols = {
- Error = " ",
- Info = " ",
- Warn = " ",
- Hint = ""
- },
- defaults = {
- true_colors = true,
- line_column = ' ☰ %l/%L %c',
- branch_symbol = " ",
- exclude_fts = { 'NvimTree' }
- }
- }
- vim.cmd('highlight Statusline guibg=none')
- vim.cmd('highlight StatuslineNC guibg=none')
- end,
- }
-})
+ {
+ "nvim-tree/nvim-tree.lua",
+ enabled = false,
+ config = function()
+ require("nvim-tree").setup({
+ view = { width = 20, side = "left" },
+ disable_netrw = true,
+ hijack_cursor = true,
+ update_cwd = true,
+ hijack_directories = { auto_open = true },
+ renderer = {
+ root_folder_label = false,
+ indent_markers = {
+ enable = true,
+ icons = { corner = "└ ", edge = "│ ", none = " " },
+ },
+ },
+ })
+ end,
+ },
+
+ {
+ "nvim-telescope/telescope.nvim",
+ dependencies = { "nvim-lua/plenary.nvim" },
+ keys = {
+ { "<C-s>", ":silent Telescope current_buffer_fuzzy_find<CR>", desc = "Open Telescope" },
+ },
+ config = function()
+ require("telescope").setup({
+ defaults = { mapping = {} },
+ pickers = {},
+ extensions = {},
+ })
+ end,
+ },
+
+ {
+ "akinsho/toggleterm.nvim",
+ version = "*",
+ config = true,
+ },
+
+ {
+ "lewis6991/gitsigns.nvim",
+ config = function()
+ require("gitsigns").setup()
+ end,
+ },
+
+ {
+ "mfussenegger/nvim-lint",
+ event = { "BufReadPre", "BufNewFile" },
+ config = function()
+ local lint = require("lint")
+ lint.linters_by_ft = {
+ lua = { "luacheck" },
+ python = { "pylint" },
+ }
+
+ local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
+
+ vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
+ group = lint_augroup,
+ callback = function()
+ lint.try_lint()
+ end,
+ })
+ end,
+ },
+
+ {
+ "echasnovski/mini.nvim",
+ version = false,
+ dependencies = { "nvim-tree/nvim-web-devicons" },
+ config = function()
+ require("mini.starter").setup({
+ header = table.concat({
+ " /l、 ",
+ "(゚、 。 7 ",
+ " l ~ ヽ ",
+ " じしf_,)ノ ",
+ }, "\n"),
+ footer = "",
+ content_hooks = {
+ require("mini.starter").gen_hook.adding_bullet("» "),
+ require("mini.starter").gen_hook.aligning("center", "center"),
+ },
+ })
+ end,
+ },
+
+ {
+ "windwp/nvim-autopairs",
+ event = "InsertEnter",
+ config = function()
+ require("nvim-autopairs").setup {}
+ end,
+ },
+
+ {
+ "tamton-aquib/staline.nvim",
+ dependencies = { "nvim-tree/nvim-web-devicons" },
+ config = function()
+ require("staline").setup {
+ sections = {
+ left = { 'file_name', 'branch' },
+ mid = { 'lsp' },
+ right = { 'line_column' },
+ },
+ special_table = {
+ NvimTree = { 'NvimTree', ' ' },
+ packer = { 'Packer', ' ' },
+ starter = { '', '' },
+ lazy = { '', '' },
+ mason = { '', '' },
+ },
+ lsp_symbols = {
+ Error = " ",
+ Info = " ",
+ Warn = " ",
+ Hint = "",
+ },
+ defaults = {
+ true_colors = true,
+ line_column = ' ☰ %l/%L %c',
+ branch_symbol = " ",
+ exclude_fts = { 'NvimTree' },
+ },
+ }
+ vim.cmd('highlight Statusline guibg=none')
+ vim.cmd('highlight StatuslineNC guibg=none')
+ end,
+ },
+
+ {
+ "epwalsh/obsidian.nvim",
+ enabled = false,
+ version = "*",
+ lazy = true,
+ ft = "markdown",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ },
+ opts = {
+ workspaces = {
+ {
+ name = "Vaut",
+ path = "~/Vault/",
+ },
+ },
+ },
+ },
+})