From 18da9560c6b1609d5f77627aa17fcec9f8431687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maurice=20Gr=C3=B6nwoldt?= Date: Wed, 30 Jul 2025 16:05:16 +0200 Subject: [PATCH] Initial Commit --- .editorconfig | 3 + .gitignore | 8 ++ .neoconf.json | 15 +++ ftplugin/java.lua | 11 +++ init.lua | 1 + lazy-lock.json | 26 ++++++ lua/config/keymaps.lua | 9 ++ lua/config/lazy.lua | 39 ++++++++ lua/config/maps/cpp.lua | 37 ++++++++ lua/config/maps/maven.lua | 27 ++++++ lua/config/options.lua | 42 +++++++++ lua/lsp/clangd.lua | 6 ++ lua/lsp/init.lua | 5 + lua/lsp/java.lua | 2 + lua/lsp/lua.lua | 7 ++ lua/plugins/blink-cmp.lua | 53 +++++++++++ lua/plugins/conform.lua | 20 ++++ lua/plugins/fzflua.lua | 92 ++++++++++++++++++ lua/plugins/lsp.lua | 124 +++++++++++++++++++++++++ lua/plugins/mini.lua | 16 ++++ lua/plugins/noice.lua | 15 +++ lua/plugins/nvim-jdtls.lua | 6 ++ lua/plugins/oil.lua | 8 ++ lua/plugins/showkeys.lua | 12 +++ lua/plugins/sleuth-vim.lua | 5 + lua/plugins/snacks.lua | 36 +++++++ lua/plugins/themes.lua | 36 +++++++ lua/plugins/treesitter-textobjects.lua | 40 ++++++++ lua/plugins/treesitter.lua | 25 +++++ lua/plugins/which-key.lua | 18 ++++ readme.md | 25 +++++ 31 files changed, 769 insertions(+) create mode 100644 .editorconfig create mode 100755 .gitignore create mode 100755 .neoconf.json create mode 100644 ftplugin/java.lua create mode 100644 init.lua create mode 100644 lazy-lock.json create mode 100644 lua/config/keymaps.lua create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/maps/cpp.lua create mode 100644 lua/config/maps/maven.lua create mode 100644 lua/config/options.lua create mode 100644 lua/lsp/clangd.lua create mode 100644 lua/lsp/init.lua create mode 100644 lua/lsp/java.lua create mode 100644 lua/lsp/lua.lua create mode 100644 lua/plugins/blink-cmp.lua create mode 100644 lua/plugins/conform.lua create mode 100644 lua/plugins/fzflua.lua create mode 100644 lua/plugins/lsp.lua create mode 100644 lua/plugins/mini.lua create mode 100644 lua/plugins/noice.lua create mode 100644 lua/plugins/nvim-jdtls.lua create mode 100644 lua/plugins/oil.lua create mode 100644 lua/plugins/showkeys.lua create mode 100644 lua/plugins/sleuth-vim.lua create mode 100644 lua/plugins/snacks.lua create mode 100644 lua/plugins/themes.lua create mode 100644 lua/plugins/treesitter-textobjects.lua create mode 100644 lua/plugins/treesitter.lua create mode 100644 lua/plugins/which-key.lua create mode 100644 readme.md diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..2c9c484 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*.lua] +indent_style=space +indent_size=2 diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..cc5457a --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/.neoconf.json b/.neoconf.json new file mode 100755 index 0000000..7c48087 --- /dev/null +++ b/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/ftplugin/java.lua b/ftplugin/java.lua new file mode 100644 index 0000000..dd24f5f --- /dev/null +++ b/ftplugin/java.lua @@ -0,0 +1,11 @@ +require 'jdtls'.start_or_attach { + cmd = { + 'jdtls', + ('--jvm-arg=-javaagent:%s'):format(vim.fn.expand '$HOME/.bin/agents/lombok.jar') + }, + handlers = { + --["language/status"] = function(_, _) end, + ["$/progress"] = function() end, + }, + capabilities = nil, --require 'cmp_nvim_lsp'.default_capabilities() +} diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..55b8979 --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require("config.lazy") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..c7f0497 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,26 @@ +{ + "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, + "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, + "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "fzf-lua": { "branch": "main", "commit": "fd6588ee052e150eb61f578fa8c40648def5b334" }, + "kanagawa.nvim": { "branch": "master", "commit": "debe91547d7fb1eef34ce26a5106f277fbfdd109" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" }, + "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, + "mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" }, + "mini.misc": { "branch": "main", "commit": "02de0d3fa53fcad1bee6c770b92a485769143155" }, + "mini.statusline": { "branch": "main", "commit": "452d27d764720cddcb9909b786598bb9e80c1ce8" }, + "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-jdtls": { "branch": "master", "commit": "4d77ff02063cf88963d5cf10683ab1fd15d072de" }, + "nvim-lspconfig": { "branch": "master", "commit": "5e0e9c00d51fcb7efef0d4c49023f9593b38661e" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" }, + "oil.nvim": { "branch": "master", "commit": "08c2bce8b00fd780fb7999dbffdf7cd174e896fb" }, + "showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } +} diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..6254e62 --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,9 @@ +vim.keymap.set("n", "-", "Oil --float", { desc = "Open parent directory" }) +vim.keymap.set("n", "gl", function() + vim.diagnostic.open_float() +end, { desc = "Open Diagnostics in Float" }) + +vim.keymap.set("n", "", "e#", { desc = "Previous file" }) + +require("config.maps.maven") +require("config.maps.cpp") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..a632cc6 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,39 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +require("config.options") + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "kanagawa_wave" } }, + -- automatically check for plugin updates + checker = { enabled = true, notify = false }, +}) + +require("config.keymaps") diff --git a/lua/config/maps/cpp.lua b/lua/config/maps/cpp.lua new file mode 100644 index 0000000..184c852 --- /dev/null +++ b/lua/config/maps/cpp.lua @@ -0,0 +1,37 @@ +local function is_cpp_project() + local uv = vim.loop + local dir = uv.fs_realpath(vim.fn.expand("%:p:h")) + while dir do + if uv.fs_stat(dir .. "/vcpkg.json") then + return true + end + local parent_dir = uv.fs_realpath(dir .. "/..") + if parent_dir == dir then + break + end + dir = parent_dir + end + return false +end + +-- Create autocommand on FileType java or whatever filetype you want +vim.api.nvim_create_autocmd("FileType", { + pattern = { "cppm", "h", "cpp", "CMakeLists.txt" }, + callback = function() + if is_cpp_project() then + vim.keymap.set( + "n", + "", + "! mkdir -p build && cd build && CC=/usr/bin/clang && CXX=/usr/bin/clang++ && cmake .. -G Ninja && cmake --build . --target copy-compile-commands && cd ..", + { desc = "CMake Create" } + ) + vim.keymap.set("n", "", "! cd build && cmake --build .", { desc = "Build Project" }) + vim.keymap.set( + "n", + "", + "! cd build && cmake --build . --target run", + { desc = "Run Project" } + ) + end + end, +}) diff --git a/lua/config/maps/maven.lua b/lua/config/maps/maven.lua new file mode 100644 index 0000000..f9ce70b --- /dev/null +++ b/lua/config/maps/maven.lua @@ -0,0 +1,27 @@ +-- Function to check if pom.xml exists in current or parent directories +local function is_maven_project() + local uv = vim.loop + local dir = uv.fs_realpath(vim.fn.expand("%:p:h")) + while dir do + if uv.fs_stat(dir .. "/pom.xml") then + return true + end + local parent_dir = uv.fs_realpath(dir .. "/..") + if parent_dir == dir then + break + end + dir = parent_dir + end + return false +end + +-- Create autocommand on FileType java or whatever filetype you want +vim.api.nvim_create_autocmd("FileType", { + pattern = "java", + callback = function() + if is_maven_project() then + vim.keymap.set("n", "", "! mvn clean install -DskipTests", { desc = "Build Java" }) + vim.keymap.set("n", "", "! mvn spotless:apply", { desc = "Format Java" }) + end + end, +}) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..b99e847 --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,42 @@ +vim.g.have_nerd_font = true + +vim.opt.langmap = "+]ü[" +vim.keymap.set("n", "ü", "[", { remap = true }) + +vim.opt.expandtab = true -- Convert tabs to spaces +vim.opt.shiftwidth = 4 -- Amount to indent with << and >> +vim.opt.tabstop = 4 -- How many spaces are shown per Tab +vim.opt.softtabstop = 4 -- How many spaces are applied when pressing Tab + +vim.opt.smarttab = true +vim.opt.smartindent = true +vim.opt.autoindent = true -- Keep identation from previous line + +vim.opt.breakindent = true + +vim.opt.number = true +vim.opt.relativenumber = true + +vim.opt.cursorline = true + +vim.opt.undofile = true + +vim.opt.mouse = "a" + +vim.opt.showmode = false + +vim.opt.ignorecase = true +vim.opt.smartcase = true + +vim.opt.signcolumn = "yes" + +vim.opt.splitright = true +vim.opt.splitbelow = true + +vim.opt.list = true +vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } + +vim.opt.scrolloff = 5 + +vim.opt.cmdheight = 0 +vim.opt.clipboard = "unnamedplus" diff --git a/lua/lsp/clangd.lua b/lua/lsp/clangd.lua new file mode 100644 index 0000000..8dece10 --- /dev/null +++ b/lua/lsp/clangd.lua @@ -0,0 +1,6 @@ +return { + cmd = { + "clangd", + "-experimental-modules-support", + }, +} diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua new file mode 100644 index 0000000..7590d51 --- /dev/null +++ b/lua/lsp/init.lua @@ -0,0 +1,5 @@ +return { + lua_ls = require("lsp.lua"), + jdtls = require("lsp.java"), + clangd = require("lsp.clangd"), +} diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua new file mode 100644 index 0000000..97aeadd --- /dev/null +++ b/lua/lsp/java.lua @@ -0,0 +1,2 @@ +return { +} diff --git a/lua/lsp/lua.lua b/lua/lsp/lua.lua new file mode 100644 index 0000000..c4b792c --- /dev/null +++ b/lua/lsp/lua.lua @@ -0,0 +1,7 @@ +return { + Lua = { + diagnostics = { + globals = { "vim", "describe", "it", "before_each", "after_each", "packer_plugins", "MiniTest", "Snacks" }, + }, + }, +} diff --git a/lua/plugins/blink-cmp.lua b/lua/plugins/blink-cmp.lua new file mode 100644 index 0000000..09d992d --- /dev/null +++ b/lua/plugins/blink-cmp.lua @@ -0,0 +1,53 @@ +return { + "saghen/blink.cmp", + -- optional: provides snippets for the snippet source + dependencies = { "rafamadriz/friendly-snippets" }, + + -- use a release tag to download pre-built binaries + version = "1.*", + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = "default" }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = false } }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, +} diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua new file mode 100644 index 0000000..431b569 --- /dev/null +++ b/lua/plugins/conform.lua @@ -0,0 +1,20 @@ +return { + "stevearc/conform.nvim", + opts = { + format_on_save = { + timeout_ms = 500, + }, + formatters_by_ft = { + javascript = { "prettierd", "prettier", stop_after_first = true }, + rust = { "rustfmt", lsp_format = "fallback" }, + java = { "spotless", "google-java-format" }, + lua = { "stylua" }, + cpp = { "clang-format" }, + }, + formatters = { + spotless = { + command = "mvn spotless:apply", + }, + }, + }, +} diff --git a/lua/plugins/fzflua.lua b/lua/plugins/fzflua.lua new file mode 100644 index 0000000..4edfe00 --- /dev/null +++ b/lua/plugins/fzflua.lua @@ -0,0 +1,92 @@ +return { + "ibhagwan/fzf-lua", + dependencies = { "echasnovski/mini.icons" }, + opts = {}, + keys = { + { + "ff", + function() require('fzf-lua').files() end, + desc = "Find Files in project directory" + }, + { + "fg", + function() require('fzf-lua').live_grep() end, + desc = "Find by grepping in project directory" + }, + { + "fc", + function() require('fzf-lua').files({ cwd = vim.fn.stdpath("config") }) end, + desc = "Find in neovim configuration" + }, + { + "fh", + function() + require("fzf-lua").helptags() + end, + desc = "[F]ind [H]elp", + }, + { + "fk", + function() + require("fzf-lua").keymaps() + end, + desc = "[F]ind [K]eymaps", + }, + { + "fb", + function() + require("fzf-lua").builtin() + end, + desc = "[F]ind [B]uiltin FZF", + }, + { + "fw", + function() + require("fzf-lua").grep_cword() + end, + desc = "[F]ind current [W]ord", + }, + { + "fW", + function() + require("fzf-lua").grep_cWORD() + end, + desc = "[F]ind current [W]ORD", + }, + { + "fd", + function() + require("fzf-lua").diagnostics_document() + end, + desc = "[F]ind [D]iagnostics", + }, + { + "fr", + function() + require("fzf-lua").resume() + end, + desc = "[F]ind [R]esume", + }, + { + "fo", + function() + require("fzf-lua").oldfiles() + end, + desc = "[F]ind [O]ld Files", + }, + { + "", + function() + require("fzf-lua").buffers() + end, + desc = "[] Find existing buffers", + }, + { + "/", + function() + require("fzf-lua").lgrep_curbuf() + end, + desc = "[/] Live grep the current buffer", + }, + } +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..6c290d7 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,124 @@ +return { + -- Main LSP Configuration + "neovim/nvim-lspconfig", + dependencies = { + -- Automatically install LSPs and related tools to stdpath for Neovim + -- Mason must be loaded before its dependents so we need to set it up here. + -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` + { "williamboman/mason.nvim", opts = {} }, + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + + -- Useful status updates for LSP. + { "j-hui/fidget.nvim", opts = {} }, + }, + config = function() + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or "n" + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) + end + map("gd", require("fzf-lua").lsp_definitions, "[G]oto [D]efinition") + map("gr", require("fzf-lua").lsp_references, "[G]oto [R]eferences") + map("gI", require("fzf-lua").lsp_implementations, "[G]oto [I]mplementation") + map("D", require("fzf-lua").lsp_typedefs, "Type [D]efinition") + map("ds", require("fzf-lua").lsp_document_symbols, "[D]ocument [S]ymbols") + map("ws", require("fzf-lua").lsp_live_workspace_symbols, "[W]orkspace [S]ymbols") + map("cr", vim.lsp.buf.rename, "[R]e[n]ame") + map("ca", vim.lsp.buf.code_action, "[C]ode [A]ction", { "n", "x" }) + map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") + ---@param client vim.lsp.Client + ---@param method vim.lsp.protocol.Method + ---@param bufnr? integer some lsp support methods only in specific files + ---@return boolean + local function client_supports_method(client, method, bufnr) + if vim.fn.has("nvim-0.11") == 1 then + return client:supports_method(method, bufnr) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end + + local client = vim.lsp.get_client_by_id(event.data.client_id) + if + client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) + then + local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false }) + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd("LspDetach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf }) + end, + }) + end + + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then + map("th", function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })) + end, "[T]oggle Inlay [H]ints") + end + end, + }) + + -- Diagnostic Config + -- See :help vim.diagnostic.Opts + vim.diagnostic.config({ + severity_sort = true, + float = { border = "rounded", source = "if_many" }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "󰅚 ", + [vim.diagnostic.severity.WARN] = "󰀪 ", + [vim.diagnostic.severity.INFO] = "󰋽 ", + [vim.diagnostic.severity.HINT] = "󰌶 ", + }, + }, + virtual_text = { + source = "if_many", + spacing = 2, + format = function(diagnostic) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, + }, + }) + + local capabilities = vim.lsp.protocol.make_client_capabilities() + local servers = require("lsp") + local ensure_installed = { "lua_ls" } --vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + "stylua", -- Used to format Lua code + }) + require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) + + for name, value in pairs(servers) do --pseudocode + vim.lsp.config(name, value) + end + + require("mason-lspconfig").setup({ + ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) + automatic_installation = false, + }) + end, +} diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua new file mode 100644 index 0000000..3a4e297 --- /dev/null +++ b/lua/plugins/mini.lua @@ -0,0 +1,16 @@ +return { + { + "echasnovski/mini.statusline", + version = false, + opts = {}, + }, + { + "echasnovski/mini.misc", + version = false, + config = function() + local mini = require("mini.misc") + mini.setup_termbg_sync() + mini.setup_auto_root() + end, + }, +} diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua new file mode 100644 index 0000000..681216e --- /dev/null +++ b/lua/plugins/noice.lua @@ -0,0 +1,15 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + cmdline = {}, + -- add any options here + messages = { + enabled = false, + }, + notify = { enabled = false }, + }, + dependencies = { + "MunifTanjim/nui.nvim", + }, +} diff --git a/lua/plugins/nvim-jdtls.lua b/lua/plugins/nvim-jdtls.lua new file mode 100644 index 0000000..f046acd --- /dev/null +++ b/lua/plugins/nvim-jdtls.lua @@ -0,0 +1,6 @@ +local java_filetypes = { 'java', 'kt' } + +return { + "mfussenegger/nvim-jdtls", + ft = java_filetypes, +} diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua new file mode 100644 index 0000000..bdce6ca --- /dev/null +++ b/lua/plugins/oil.lua @@ -0,0 +1,8 @@ +return { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + dependencies = { { "echasnovski/mini.icons", opts = {} } }, + lazy = false, +} diff --git a/lua/plugins/showkeys.lua b/lua/plugins/showkeys.lua new file mode 100644 index 0000000..45d5efb --- /dev/null +++ b/lua/plugins/showkeys.lua @@ -0,0 +1,12 @@ +return { + "nvzone/showkeys", + cmd = "ShowkeysToggle", + opts = { + timeout = 1, + maxkeys = 3, + winopts = { + height = 1 + }, + excluded_modes = { "i" } + } +} diff --git a/lua/plugins/sleuth-vim.lua b/lua/plugins/sleuth-vim.lua new file mode 100644 index 0000000..211c235 --- /dev/null +++ b/lua/plugins/sleuth-vim.lua @@ -0,0 +1,5 @@ +return { + "tpope/vim-sleuth", + -- No further initialization needed, as this is a real "vim" not a lua + -- plugin. +} diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua new file mode 100644 index 0000000..3d5a310 --- /dev/null +++ b/lua/plugins/snacks.lua @@ -0,0 +1,36 @@ +local header_string = [[ + __ __ ____ _____ _____ + \ \ /"/u / __"| u |_ " _| |"_ /u + \ \ / // <\___ \/ | | U / // + /\ V /_,-.u___) | /| |\ \/ /_ + U \_/-(_/ |____/>> u |_|U /____| + // )( (__)_// \\_ _//<<,- + (__) (__) (__) (__)(__) (_/ ]] + +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + dashboard = { + enabled = true, + preset = { + header = header_string + } + }, + explorer = { enabled = true }, + input = { enabled = true }, + notifier = { + enabled = true, + timeout = 10000 + }, + lazygit = { + enabled = true + } + }, + keys = { + { "n", function() Snacks.picker.notifications() end, desc = "Notification History" }, + { "e", function() Snacks.explorer() end, desc = "File Explorer" }, + { "gg", function() Snacks.lazygit() end, desc = "Lazygit" }, + } +} diff --git a/lua/plugins/themes.lua b/lua/plugins/themes.lua new file mode 100644 index 0000000..e7d6198 --- /dev/null +++ b/lua/plugins/themes.lua @@ -0,0 +1,36 @@ +return { + "rebelot/kanagawa.nvim", + config = function() + require('kanagawa').setup({ + compile = true, + transparent = true, + colors = { + theme = { + all = { + ui = { + bg_gutter = "none", + float = { + bg = "none", + }, + } + } + } + }, + overrides = function(colors) + return { + ["@markup.link.url.markdown_inline"] = { link = "Special" }, -- (url) + ["@markup.link.label.markdown_inline"] = { link = "WarningMsg" }, -- [label] + ["@markup.italic.markdown_inline"] = { link = "Exception" }, -- *italic* + ["@markup.raw.markdown_inline"] = { link = "String" }, -- `code` + ["@markup.list.markdown"] = { link = "Function" }, -- + list + ["@markup.quote.markdown"] = { link = "Error" }, -- > blockcode + ["@markup.list.checked.markdown_inline"] = { link = "Error" } -- - [X] checked list item + } + end + }) + vim.cmd("colorscheme kanagawa") + end, + build = function() + vim.cmd("KanagawaCompile") + end +} diff --git a/lua/plugins/treesitter-textobjects.lua b/lua/plugins/treesitter-textobjects.lua new file mode 100644 index 0000000..e6fb5be --- /dev/null +++ b/lua/plugins/treesitter-textobjects.lua @@ -0,0 +1,40 @@ +return { + "nvim-treesitter/nvim-treesitter-textobjects", + dependencies = { + "nvim-treesitter/nvim-treesitter" + }, + init = function() + local config = require 'nvim-treesitter.configs'; + config.setup({ + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ao"] = "@comment.outer", + ["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" }, + ["as"] = { query = "@local.scope", query_group = "locals", desc = "Select language scope" }, + }, + selection_modes = { + ['@parameter.outer'] = 'v', -- charwise + ['@function.outer'] = 'V', -- linewise + ['@class.outer'] = '', -- blockwise + }, + include_surrounding_whitespace = true, + }, + swap = { + enable = true, + swap_next = { + ["Ca"] = { query = "@parameter.inner", desc = "Swap with next parameter" }, + }, + swap_previous = { + ["CA"] = "@parameter.inner", + }, + }, + }, + }); + end +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..b67eead --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,25 @@ +return { + "nvim-treesitter/nvim-treesitter", + lazy = false, + build = ":TSUpdate", + config = function() + local configs = require("nvim-treesitter.configs") + + configs.setup({ + ensure_installed = { "lua", "markdown_inline" }, + auto_install = false, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", -- set to `false` to disable one of the mappings + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + }) + end +} diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua new file mode 100644 index 0000000..9fadb97 --- /dev/null +++ b/lua/plugins/which-key.lua @@ -0,0 +1,18 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..a1543e6 --- /dev/null +++ b/readme.md @@ -0,0 +1,25 @@ +# My nvim config + +## Dependencies + +fzf + + +## Plugins + +- [ ] lazy.nvim +- [x] kanagawa.nvim +- [x] mini.statusline +- [x] oil.nvim +- [x] vim-sleuth +- [x] showkeys +- [x] treesitter + +## Keymaps + +### Normal +- `-` open OIL floating + + +## Commands +- ShowkeysToggle