Change formatting

This commit is contained in:
2026-03-21 14:57:40 +01:00
parent 90f7ae975d
commit 93f0961709
2 changed files with 472 additions and 464 deletions

View File

@@ -1,35 +1,35 @@
local lsp_attach = function(client, buf) local lsp_attach = function(client, buf)
vim.api.nvim_set_option_value("formatexpr", "v:lua.vim.lsp.formatexpr()", { buf = buf }) vim.api.nvim_set_option_value("formatexpr", "v:lua.vim.lsp.formatexpr()", { buf = buf })
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = buf }) vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = buf })
vim.api.nvim_set_option_value("tagfunc", "v:lua.vim.lsp.tagfunc", { buf = buf }) vim.api.nvim_set_option_value("tagfunc", "v:lua.vim.lsp.tagfunc", { buf = buf })
vim.lsp.inlay_hint.enable(true, nil) vim.lsp.inlay_hint.enable(true, nil)
local bufopts = { noremap = true, silent = true, buffer = buf } local bufopts = { noremap = true, silent = true, buffer = buf }
local wk = require("which-key") local wk = require("which-key")
local diag_next = function() local diag_next = function()
vim.diagnostic.jump({ count = 1, float = true }) vim.diagnostic.jump({ count = 1, float = true })
end end
local diag_prev = function() local diag_prev = function()
vim.diagnostic.jump({ count = -1, float = true }) vim.diagnostic.jump({ count = -1, float = true })
end end
wk.add({ wk.add({
{ '<C-e>', require("telescope.builtin").diagnostics, bufopts, desc = "Show diagnostics under cursor" }, { '<C-e>', require("telescope.builtin").diagnostics, bufopts, desc = "Show diagnostics under cursor" },
{ '<leader>e', vim.diagnostic.open_float, bufopts, desc = "Show diagnostics in buffer" }, { '<leader>e', vim.diagnostic.open_float, bufopts, desc = "Show diagnostics in buffer" },
{ '[d', diag_prev, bufopts }, { '[d', diag_prev, bufopts },
{ ']d', diag_next, bufopts }, { ']d', diag_next, bufopts },
{ 'gD', vim.lsp.buf.declaration, bufopts, desc = "Go to declaration" }, { 'gD', vim.lsp.buf.declaration, bufopts, desc = "Go to declaration" },
{ 'gd', vim.lsp.buf.definition, bufopts, desc = "Go to definition" }, { 'gd', vim.lsp.buf.definition, bufopts, desc = "Go to definition" },
{ 'gi', vim.lsp.buf.implementation, bufopts, desc = "Go to implementation" }, { 'gi', vim.lsp.buf.implementation, bufopts, desc = "Go to implementation" },
{ '<C-k>', vim.lsp.buf.signature_help, bufopts, desc = "Show signature" }, { '<C-k>', vim.lsp.buf.signature_help, bufopts, desc = "Show signature" },
{ '<leader>rn', vim.lsp.buf.rename, bufopts, desc = "Rename" }, { '<leader>rn', vim.lsp.buf.rename, bufopts, desc = "Rename" },
{ '<leader>ca', vim.lsp.buf.code_action, bufopts, desc = "Show code actions" }, { '<leader>ca', vim.lsp.buf.code_action, bufopts, desc = "Show code actions" },
{ 'gr', require("telescope.builtin").lsp_references, bufopts, desc = "Shwo references" }, { 'gr', require("telescope.builtin").lsp_references, bufopts, desc = "Shwo references" },
}) })
end end
local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/packages/codelldb/extension/") local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/packages/codelldb/extension/")
@@ -37,446 +37,451 @@ local codelldb_path = mason_path .. "adapter/codelldb"
local liblldb_path = mason_path .. "lldb/lib/liblldb.so" local liblldb_path = mason_path .. "lldb/lib/liblldb.so"
if vim.fn.has "mac" == 1 then if vim.fn.has "mac" == 1 then
liblldb_path = mason_path .. "lldb/lib/liblldb.dylib" liblldb_path = mason_path .. "lldb/lib/liblldb.dylib"
end end
return { return {
-- lsp -- lsp
{ {
'williamboman/mason.nvim', 'williamboman/mason.nvim',
lazy = true, lazy = true,
config = true config = true
}, },
{ {
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
config = true config = true
--config = function() --config = function()
-- ensure_installed = { "lua_ls", "ts_ls", "gopls", "rust_analyzer", "bashls", "sqlls", "html", "cssls", -- ensure_installed = { "lua_ls", "ts_ls", "gopls", "rust_analyzer", "bashls", "sqlls", "html", "cssls",
-- "tailwindcss", "phpactor", "julials", "glsl_analyzer", "wgsl_analyzer", "emmet_language_server", "zls" } -- "tailwindcss", "phpactor", "julials", "glsl_analyzer", "wgsl_analyzer", "emmet_language_server", "zls" }
--end --end
}, },
{ {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
config = function() config = function()
local capabilities = require('cmp_nvim_lsp').default_capabilities() local capabilities = require('cmp_nvim_lsp').default_capabilities()
vim.lsp.config('lua_ls', { vim.lsp.config('lua_ls', {
capabilities = capabilities, capabilities = capabilities,
root_markers = { '.git' }, root_markers = { '.git' },
settings = { settings = {
Lua = { Lua = {
runtime = { runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT', version = 'LuaJIT',
}, },
diagnostics = { diagnostics = {
-- Get the language server to recognize the `vim` global -- Get the language server to recognize the `vim` global
globals = { 'vim' } globals = { 'vim' }
}, },
workspace = { workspace = {
-- Make the server aware of Neovim runtime files -- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true), library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false, checkThirdParty = false,
}, },
} }
}, },
on_attach = lsp_attach on_attach = lsp_attach
}) })
vim.lsp.config('ts_ls', { vim.lsp.config('ts_ls', {
capabilities = capabilities, capabilities = capabilities,
on_attach = lsp_attach, on_attach = lsp_attach,
filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact", "javascript.jsx", "typescript.tsx", "vue" }, filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact", "javascript.jsx", "typescript.tsx", "vue" },
init_options = { root_markers = { 'tsconfig.json', 'jsconfig.json', 'package.json', '.git' },
plugins = { { init_options = {
name = '@vue/typescript-plugin', plugins = { {
location = vim.fn.expand(vim.fn.stdpath "data" .. name = '@vue/typescript-plugin',
"/mason/packages/vue-language-server/node_modules/@vue/language-server"), location = vim.fn.expand(vim.fn.stdpath "data" ..
languages = { 'vue' }, "/mason/packages/vue-language-server/node_modules/@vue/language-server"),
configNamespace = 'typescript' languages = { 'vue' },
} } configNamespace = 'typescript'
} } }
}) }
vim.lsp.config('vue_ls', { })
capabilities = capabilities, vim.lsp.config('vue_ls', {
on_attach = lsp_attach capabilities = capabilities,
}) on_attach = lsp_attach
vim.lsp.config('gopls', { })
capabilities = capabilities, vim.lsp.config('denols', {
on_attach = lsp_attach capabilities = capabilities,
}) on_attach = lsp_attach
--vim.lsp.config(rust_analyzer.setup { })
-- capabilities = capabilities, vim.lsp.config('gopls', {
-- on_attach = lsp_attach capabilities = capabilities,
--}) on_attach = lsp_attach
vim.lsp.config('bashls', { })
capabilities = capabilities, --vim.lsp.config(rust_analyzer.setup {
on_attach = lsp_attach -- capabilities = capabilities,
}) -- on_attach = lsp_attach
vim.lsp.config('sqlls', { --})
capabilities = capabilities, vim.lsp.config('bashls', {
on_attach = lsp_attach capabilities = capabilities,
}) on_attach = lsp_attach
vim.lsp.config('html', { })
capabilities = capabilities, vim.lsp.config('sqlls', {
on_attach = lsp_attach capabilities = capabilities,
}) on_attach = lsp_attach
vim.lsp.config('cssls', { })
capabilities = capabilities, vim.lsp.config('html', {
on_attach = lsp_attach capabilities = capabilities,
}) on_attach = lsp_attach
vim.lsp.config('tailwindcss', { })
capabilities = capabilities, vim.lsp.config('cssls', {
on_attach = lsp_attach capabilities = capabilities,
}) on_attach = lsp_attach
vim.lsp.config('phpactor', { })
capabilities = capabilities, vim.lsp.config('tailwindcss', {
on_attach = lsp_attach capabilities = capabilities,
}) on_attach = lsp_attach
vim.lsp.config('julials', { })
capabilities = capabilities, vim.lsp.config('phpactor', {
on_attach = lsp_attach capabilities = capabilities,
}) on_attach = lsp_attach
vim.lsp.config('wgsl_analyzer', { })
capabilities = capabilities, vim.lsp.config('julials', {
on_attach = lsp_attach capabilities = capabilities,
}) on_attach = lsp_attach
vim.lsp.config('glsl_analyzer', { })
capabilities = capabilities, vim.lsp.config('wgsl_analyzer', {
on_attach = lsp_attach capabilities = capabilities,
}) on_attach = lsp_attach
vim.lsp.config('emmet_ls', { })
filetypes = { "css", "html" }, vim.lsp.config('glsl_analyzer', {
-- Read more about this options in the [vscode docs](https://code.visualstudio.com/docs/editor/emmet#_emmet-configuration). capabilities = capabilities,
-- **Note:** only the options listed in the table are supported. on_attach = lsp_attach
init_options = { })
---@type table<string, string> vim.lsp.config('emmet_ls', {
includeLanguages = {}, filetypes = { "css", "html" },
--- @type string[] -- Read more about this options in the [vscode docs](https://code.visualstudio.com/docs/editor/emmet#_emmet-configuration).
excludeLanguages = {}, -- **Note:** only the options listed in the table are supported.
--- @type string[] init_options = {
extensionsPath = {}, ---@type table<string, string>
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/preferences/) includeLanguages = {},
preferences = {}, --- @type string[]
--- @type boolean Defaults to `true` excludeLanguages = {},
showAbbreviationSuggestions = true, --- @type string[]
--- @type "always" | "never" Defaults to `"always"` extensionsPath = {},
showExpandedAbbreviation = "always", --- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/preferences/)
--- @type boolean Defaults to `false` preferences = {},
showSuggestionsAsSnippets = false, --- @type boolean Defaults to `true`
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/syntax-profiles/) showAbbreviationSuggestions = true,
syntaxProfiles = {}, --- @type "always" | "never" Defaults to `"always"`
--- @type table<string, string> [Emmet Docs](https://docs.emmet.io/customization/snippets/#variables) showExpandedAbbreviation = "always",
variables = {}, --- @type boolean Defaults to `false`
}, showSuggestionsAsSnippets = false,
}) --- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/syntax-profiles/)
-- vim.lsp.config('ccls.setup { syntaxProfiles = {},
-- capabilities = capabilities, --- @type table<string, string> [Emmet Docs](https://docs.emmet.io/customization/snippets/#variables)
-- on_attach = lsp_attach, variables = {},
-- }) },
vim.lsp.config('clangd', { })
capabilities = capabilities, -- vim.lsp.config('ccls.setup {
on_attach = lsp_attach, -- capabilities = capabilities,
-- on_attach = lsp_attach,
-- })
vim.lsp.config('clangd', {
capabilities = capabilities,
on_attach = lsp_attach,
filetypes = { 'c', 'cpp', 'h' }, filetypes = { 'c', 'cpp', 'h' },
cmd = { "clangd", '--background-index', '--clang-tidy' } cmd = { "clangd", '--background-index', '--clang-tidy' }
}) })
vim.lsp.enable({ 'ts_ls', 'vue_ls', 'clangd' }) vim.lsp.enable({ 'ts_ls', 'vue_ls', 'clangd' })
end end
}, },
{ {
'mrcjkb/rustaceanvim', 'mrcjkb/rustaceanvim',
version = "^6", version = "^6",
lazy = false, lazy = false,
ft = { "rust" }, ft = { "rust" },
config = function() config = function()
local rust_analyzer_path = vim.fn.trim(vim.fn.system("rustup which rust-analyzer")) local rust_analyzer_path = vim.fn.trim(vim.fn.system("rustup which rust-analyzer"))
if rust_analyzer_path == "" then if rust_analyzer_path == "" then
vim.notify("rust-analyzer not found! Install it with: rustup component add rust-analyzer", vim.notify("rust-analyzer not found! Install it with: rustup component add rust-analyzer",
vim.log.levels.ERROR) vim.log.levels.ERROR)
return return
end end
vim.g.rustaceanvim = { vim.g.rustaceanvim = {
server = { server = {
cmd = { rust_analyzer_path }, cmd = { rust_analyzer_path },
on_attach = lsp_attach, on_attach = lsp_attach,
settings = { settings = {
-- rust-analyzer language server configuration -- rust-analyzer language server configuration
["rust-analyzer"] = { ["rust-analyzer"] = {
rustfmt = { rustfmt = {
extraArgs = { "+nightly" }, extraArgs = { "+nightly" },
}, },
cargo = { cargo = {
loadOutDirsFromCheck = true, loadOutDirsFromCheck = true,
runBuildScripts = true, runBuildScripts = true,
}, },
-- Add clippy lints for Rust. -- Add clippy lints for Rust.
checkOnSave = true, checkOnSave = true,
-- TODO this breaks diagnostics, look into what can be done -- TODO this breaks diagnostics, look into what can be done
-- procMacro = { -- procMacro = {
-- enable = true, -- enable = true,
-- ignored = { -- ignored = {
-- ["async-trait"] = { "async_trait" }, -- ["async-trait"] = { "async_trait" },
-- ["napi-derive"] = { "napi" }, -- ["napi-derive"] = { "napi" },
-- ["async-recursion"] = { "async_recursion" }, -- ["async-recursion"] = { "async_recursion" },
-- }, -- },
-- }, -- },
}, },
}, },
} }
} }
end end
}, },
{ {
'mfussenegger/nvim-jdtls', 'mfussenegger/nvim-jdtls',
ft = { "java" }, ft = { "java" },
config = function() config = function()
local home = os.getenv('HOME') local home = os.getenv('HOME')
local jdtls = require('jdtls') local jdtls = require('jdtls')
local capabilities = require('cmp_nvim_lsp').default_capabilities() local capabilities = require('cmp_nvim_lsp').default_capabilities()
local root_markers = { 'gradlew', 'mvnw', 'git' } local root_markers = { 'gradlew', 'mvnw', 'git' }
local root_dir = require('jdtls.setup').find_root(root_markers) local root_dir = require('jdtls.setup').find_root(root_markers)
local workspace_folder = home .. "/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t") local workspace_folder = home .. "/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
local config = { local config = {
flags = { flags = {
debounce_text_changes = 80, debounce_text_changes = 80,
}, },
capabilities = capabilities, capabilities = capabilities,
on_attach = lsp_attach, -- We pass our on_attach keybindings to the configuration map on_attach = lsp_attach, -- We pass our on_attach keybindings to the configuration map
root_dir = root_dir, -- Set the root directory to our found root_marker root_dir = root_dir, -- Set the root directory to our found root_marker
-- here you can configure eclipse.jdt.ls specific settings -- here you can configure eclipse.jdt.ls specific settings
-- these are defined by the eclipse.jdt.ls project and will be passed to eclipse when starting. -- these are defined by the eclipse.jdt.ls project and will be passed to eclipse when starting.
-- see https://github.com/eclipse/eclipse.jdt.ls/wiki/running-the-java-ls-server-from-the-command-line#initialize-request -- see https://github.com/eclipse/eclipse.jdt.ls/wiki/running-the-java-ls-server-from-the-command-line#initialize-request
-- for a list of options -- for a list of options
settings = { settings = {
java = { java = {
format = { format = {
settings = { settings = {
-- use google java style guidelines for formatting -- use google java style guidelines for formatting
-- to use, make sure to download the file from https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml -- to use, make sure to download the file from https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml
-- and place it in the ~/.local/share/eclipse directory -- and place it in the ~/.local/share/eclipse directory
-- url = "/.local/share/eclipse/eclipse-java-google-style.xml", -- url = "/.local/share/eclipse/eclipse-java-google-style.xml",
-- profile = "googlestyle", -- profile = "googlestyle",
}, },
}, },
signaturehelp = { enabled = true }, signaturehelp = { enabled = true },
contentprovider = { preferred = 'fernflower' }, -- use fernflower to decompile library code contentprovider = { preferred = 'fernflower' }, -- use fernflower to decompile library code
-- specify any completion options -- specify any completion options
completion = { completion = {
favoritestaticmembers = { favoritestaticmembers = {
-- "org.hamcrest.matcherassert.assertthat", -- "org.hamcrest.matcherassert.assertthat",
-- "org.hamcrest.matchers.*", -- "org.hamcrest.matchers.*",
-- "org.hamcrest.corematchers.*", -- "org.hamcrest.corematchers.*",
-- "org.junit.jupiter.api.assertions.*", -- "org.junit.jupiter.api.assertions.*",
-- "java.util.objects.requirenonnull", -- "java.util.objects.requirenonnull",
-- "java.util.objects.requirenonnullelse", -- "java.util.objects.requirenonnullelse",
-- "org.mockito.mockito.*" -- "org.mockito.mockito.*"
}, },
filteredtypes = { filteredtypes = {
-- "com.sun.*", -- "com.sun.*",
-- "io.micrometer.shaded.*", -- "io.micrometer.shaded.*",
-- "java.awt.*", -- "java.awt.*",
-- "jdk.*", "sun.*", -- "jdk.*", "sun.*",
}, },
}, },
-- specify any options for organizing imports -- specify any options for organizing imports
sources = { sources = {
organizeimports = { organizeimports = {
starthreshold = 9999, starthreshold = 9999,
staticstarthreshold = 9999, staticstarthreshold = 9999,
}, },
}, },
-- how code generation should act -- how code generation should act
codegeneration = { codegeneration = {
tostring = { tostring = {
template = "${object.classname}{${member.name()}=${member.value}, ${othermembers}}" template = "${object.classname}{${member.name()}=${member.value}, ${othermembers}}"
}, },
hashcodeequals = { hashcodeequals = {
usejava7objects = true, usejava7objects = true,
}, },
useblocks = true, useblocks = true,
}, },
-- if you are developing in projects with different java versions, you need -- if you are developing in projects with different java versions, you need
-- to tell eclipse.jdt.ls to use the location of the jdk for your java version -- to tell eclipse.jdt.ls to use the location of the jdk for your java version
-- see https://github.com/eclipse/eclipse.jdt.ls/wiki/running-the-java-ls-server-from-the-command-line#initialize-request -- see https://github.com/eclipse/eclipse.jdt.ls/wiki/running-the-java-ls-server-from-the-command-line#initialize-request
-- and search for `interface runtimeoption` -- and search for `interface runtimeoption`
-- the `name` is not arbitrary, but must match one of the elements from `enum executionenvironment` in the link above -- the `name` is not arbitrary, but must match one of the elements from `enum executionenvironment` in the link above
configuration = { configuration = {
runtimes = { runtimes = {
{ {
name = "JavaSE-17", name = "JavaSE-17",
path = home .. "/.local/share/asdf/installs/java/oracle-17.0.11/", path = home .. "/.local/share/asdf/installs/java/oracle-17.0.11/",
}, },
{ {
name = "JavaSE-21", name = "JavaSE-21",
path = home .. "/.local/share/asdf/installs/java/oracle-21.0.2/", path = home .. "/.local/share/asdf/installs/java/oracle-21.0.2/",
}, },
{ {
name = "JavaSE-1.8", name = "JavaSE-1.8",
path = home .. "/.local/share/asdf/installs/java/adoptopenjdk-8.0.412+8/" path = home .. "/.local/share/asdf/installs/java/adoptopenjdk-8.0.412+8/"
}, },
} }
} }
} }
}, },
-- cmd is the command that starts the language server. whatever is placed -- cmd is the command that starts the language server. whatever is placed
-- here is what is passed to the command line to execute jdtls. -- here is what is passed to the command line to execute jdtls.
-- note that eclipse.jdt.ls must be started with a java version of 17 or higher -- note that eclipse.jdt.ls must be started with a java version of 17 or higher
-- see: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line -- see: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
-- for the full list of options -- for the full list of options
cmd = { cmd = {
home .. "/.local/share/asdf/installs/java/oracle-21.0.2/bin/java", home .. "/.local/share/asdf/installs/java/oracle-21.0.2/bin/java",
'-Declipse.application=org.eclipse.jdt.ls.core.id1', '-Declipse.application=org.eclipse.jdt.ls.core.id1',
'-Dosgi.bundles.defaultstartlevel=4', '-Dosgi.bundles.defaultstartlevel=4',
'-Declipse.product=org.eclipse.jdt.ls.core.product', '-Declipse.product=org.eclipse.jdt.ls.core.product',
'-Dlog.protocol=true', '-Dlog.protocol=true',
'-Dlog.level=all', '-Dlog.level=all',
'-Xmx4G', '-Xmx4G',
'--add-modules=ALL-SYSTEM', '--add-modules=ALL-SYSTEM',
'--add-opens', 'java.base/java.util=ALL-UNNAMED', '--add-opens', 'java.base/java.util=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED', '--add-opens', 'java.base/java.lang=ALL-UNNAMED',
-- if you use lombok, download the lombok jar and place it in ~/.local/share/eclipse -- if you use lombok, download the lombok jar and place it in ~/.local/share/eclipse
'-javaagent:' .. home .. '/.local/share/nvim/mason/packages/jdtls/lombok.jar', '-javaagent:' .. home .. '/.local/share/nvim/mason/packages/jdtls/lombok.jar',
-- the jar file is located where jdtls was installed. this will need to be updated -- the jar file is located where jdtls was installed. this will need to be updated
-- to the location where you installed jdtls -- to the location where you installed jdtls
'-jar', vim.fn.glob( '-jar', vim.fn.glob(
home .. home ..
'/.local/share/nvim/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_*.jar'), '/.local/share/nvim/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_*.jar'),
-- the configuration for jdtls is also placed where jdtls was installed. this will -- the configuration for jdtls is also placed where jdtls was installed. this will
-- need to be updated depending on your environment -- need to be updated depending on your environment
'-configuration', home .. '/.local/share/nvim/mason/packages/jdtls/config_linux', '-configuration', home .. '/.local/share/nvim/mason/packages/jdtls/config_linux',
-- use the workspace_folder defined above to store data for this project -- use the workspace_folder defined above to store data for this project
'-data', workspace_folder, '-data', workspace_folder,
}, },
} }
jdtls.start_or_attach(config) jdtls.start_or_attach(config)
end end
}, },
{ {
"Kurren123/mssql.nvim", "Kurren123/mssql.nvim",
opts = { opts = {
-- optional -- optional
keymap_prefix = "<leader>m" keymap_prefix = "<leader>m"
}, },
-- optional -- optional
dependencies = { "folke/which-key.nvim" } dependencies = { "folke/which-key.nvim" }
}, },
{ 'onsails/lspkind-nvim' }, -- pictograms replace (?) with lspsaga { 'onsails/lspkind-nvim' }, -- pictograms replace (?) with lspsaga
{ {
'j-hui/fidget.nvim', 'j-hui/fidget.nvim',
config = true config = true
}, -- show lsp status }, -- show lsp status
-- completion -- completion
{ {
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
config = function() config = function()
local cmp = require('cmp') local cmp = require('cmp')
local lspkind = require('lspkind') local lspkind = require('lspkind')
vim.opt.shortmess:append 'c' vim.opt.shortmess:append 'c'
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
require('luasnip').lsp_expand(args.body) require('luasnip').lsp_expand(args.body)
end, end,
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert }, ["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert }, ["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-s>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), ['<C-s>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.mapping.confirm({ ['<C-y>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert, behavior = cmp.ConfirmBehavior.Insert,
select = true select = true
}), }),
['<C-e>'] = cmp.mapping({ ['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(), i = cmp.mapping.abort(),
c = cmp.mapping.close(), c = cmp.mapping.close(),
}), }),
['<CR>'] = cmp.mapping.confirm({ select = true }), ['<CR>'] = cmp.mapping.confirm({ select = true }),
}), }),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'nvim_lua' }, { name = 'nvim_lua' },
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'path' }, { name = 'path' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'nvim_lsp_signature_help' }, { name = 'nvim_lsp_signature_help' },
}, { }, {
{ name = 'buffer', keyword_length = 5 }, { name = 'buffer', keyword_length = 5 },
{ name = 'minuet' }, { name = 'minuet' },
}), }),
performance = { performance = {
-- It is recommended to increase the timeout duration due to -- It is recommended to increase the timeout duration due to
-- the typically slower response speed of LLMs compared to -- the typically slower response speed of LLMs compared to
-- other completion sources. This is not needed when you only -- other completion sources. This is not needed when you only
-- need manual completion. -- need manual completion.
fetching_timeout = 2000, fetching_timeout = 2000,
}, },
formatting = { formatting = {
format = lspkind.cmp_format { format = lspkind.cmp_format {
with_text = true, with_text = true,
menu = { menu = {
buffer = "[buf]", buffer = "[buf]",
nvim_lsp = "[LSP]", nvim_lsp = "[LSP]",
nvim_lua = "[api]", nvim_lua = "[api]",
path = "[path]", path = "[path]",
luasnip = "[snip]", luasnip = "[snip]",
minuet = "[llm]", minuet = "[llm]",
} }
} }
} }
}) })
-- Use buffer source for `/` (basically search words in buffer) -- Use buffer source for `/` (basically search words in buffer)
cmp.setup.cmdline('/', { cmp.setup.cmdline('/', {
sources = { sources = {
{ name = 'buffer' } { name = 'buffer' }
} }
}) })
-- Use cmdline & path source for ':' -- Use cmdline & path source for ':'
cmp.setup.cmdline(':', { cmp.setup.cmdline(':', {
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'path' } { name = 'path' }
}, { }, {
{ name = 'cmdline' } { name = 'cmdline' }
}) })
}) })
end, end,
event = 'InsertEnter', event = 'InsertEnter',
dependencies = { dependencies = {
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-nvim-lsp-signature-help', 'hrsh7th/cmp-nvim-lsp-signature-help',
'hrsh7th/cmp-buffer', 'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path', 'hrsh7th/cmp-path',
'hrsh7th/cmp-nvim-lua', 'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-cmdline',
'saadparwaiz1/cmp_luasnip', 'saadparwaiz1/cmp_luasnip',
} }
}, },
{ {
'L3MON4D3/LuaSnip', 'L3MON4D3/LuaSnip',
version = "v2.*", version = "v2.*",
build = "make install_jsregexp", build = "make install_jsregexp",
config = function() config = function()
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets/" }) require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets/" })
end end
}, },
{ {
'windwp/nvim-autopairs', 'windwp/nvim-autopairs',
config = true config = true
}, },
{ {
"folke/trouble.nvim", "folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { "nvim-tree/nvim-web-devicons" },
opts = { opts = {
-- your configuration comes here -- your configuration comes here
-- or leave it empty to use the default settings -- or leave it empty to use the default settings
-- refer to the configuration section below -- refer to the configuration section below
}, },
}, },
} }

View File

@@ -1,12 +1,15 @@
return { return {
-- writing -- writing
{ {
'vimwiki/vimwiki', 'vimwiki/vimwiki',
ft = { 'md', 'wiki', 'tex' }, ft = { 'md', 'wiki', 'tex' },
config = function() config = function()
vim.g.vimwiki_list = { { path = '~/Documents/Buch/wiki', syntax = 'markdown', ext = '.md' } } vim.g.vimwiki_list = {
end { path = '~/Documents/Buch/wiki', syntax = 'markdown', ext = '.md' },
}, { path = '~/Notes', syntax = 'markdown', ext = '.md' },
--{ 'junegunn/goyo.vim' }, -- try replacing these 2 at some point because they don't work that well anymore }
--{ 'junegunn/limelight.vim' }, end
},
--{ 'junegunn/goyo.vim' }, -- try replacing these 2 at some point because they don't work that well anymore
--{ 'junegunn/limelight.vim' },
} }