diff --git a/after/ftplugin/java.lua b/after/ftplugin/java.lua index e523ab2..5c9f431 100644 --- a/after/ftplugin/java.lua +++ b/after/ftplugin/java.lua @@ -92,28 +92,20 @@ local config = { single_file_support = true, settings = { java = { - redhat = { - telemetry = { enabled = false }, - }, + redhat = { telemetry = { enabled = false } }, autobuild = { enabled = false }, eclipse = { downloadSources = true }, maven = { downloadSources = true }, signatureHelp = { enabled = true }, contentProvider = { preferred = "fernflower" }, - saveActions = { - organizeImports = true, - }, + saveActions = { organizeImports = false }, sources = { organizeImports = { starThreshold = 9999, staticStarThreshold = 9999, }, }, - import = { - gradle = { - enabled = true, - }, - }, + import = { gradle = { enabled = true } }, configuration = { updateBuildConfiguration = "interactive", runtimes = { @@ -127,21 +119,16 @@ local config = { }, }, }, - testsCodeLens = { - enabled = true, - }, - implementationsCodeLens = { - enabled = true, - }, - referencesCodeLens = { - enabled = true, - }, - references = { - includeDecompiledSources = true, - }, + testsCodeLens = { enabled = true }, + implementationsCodeLens = { enabled = true }, + referencesCodeLens = { enabled = true }, + references = { includeDecompiledSources = true }, inlayHints = { parameterNames = { enabled = "all" } }, format = { enabled = true, + settings = { + ["org.eclipse.jdt.core.formatter.comment.line_length"] = 100, + }, }, completion = { maxResults = 20, diff --git a/lazy-lock.json b/lazy-lock.json index aca3518..d83faa1 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,47 +1,47 @@ { - "SchemaStore.nvim": { "branch": "main", "commit": "438f4f1f1fb890980cb23002597f99c9579834bd" }, + "SchemaStore.nvim": { "branch": "main", "commit": "b62efcb71077bfeb407dcd05fb0584e422131150" }, "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, "blink.cmp": { "branch": "main", "commit": "1cc3b1a908fbcfd15451c4772759549724f38524" }, "color-picker.nvim": { "branch": "master", "commit": "06cb5f853535dea529a523e9a0e8884cdf9eba4d" }, - "conform.nvim": { "branch": "master", "commit": "70019124aa4f2e6838be9fbd2007f6d13b27a96d" }, + "conform.nvim": { "branch": "master", "commit": "6dc21d4ce050c2e592d9635b7983d67baf216e3d" }, "data-viewer.nvim": { "branch": "main", "commit": "40ddf37bb7ab6c04ff9e820812d1539afe691668" }, - "gitsigns.nvim": { "branch": "main", "commit": "b544bd62623ca1b483d8b9bfb6d65805f112a320" }, - "go.nvim": { "branch": "master", "commit": "c6d5ca26377d01c4de1f7bff1cd62c8b43baa6bc" }, + "gitsigns.nvim": { "branch": "main", "commit": "817bd848fffe82e697b4da656e3f2834cd0665c5" }, + "go.nvim": { "branch": "master", "commit": "6e5a74b866aa4a112ed85a1169befff2ef82c027" }, "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" }, "image.nvim": { "branch": "master", "commit": "f1163cc2f6fff5b0de7c23c7502eee0df23a3e0e" }, "jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" }, "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, "lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" }, - "markdown.nvim": { "branch": "main", "commit": "786d643ac7a691515d401930b8850f596992725d" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "97d9f1d3ad205dece6bcafd1d71cf1507608f3c7" }, + "markdown.nvim": { "branch": "main", "commit": "ad055861d17afe058bd835e82292e14a64b51b1d" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.icons": { "branch": "main", "commit": "1c79feb7478ca773fa3dac5cadf43ced9180e861" }, + "mini.icons": { "branch": "main", "commit": "910db5df9724d65371182948f921fce23c2c881e" }, "mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" }, "mini.surround": { "branch": "main", "commit": "aa5e245829dd12d8ff0c96ef11da28681d6049aa" }, "molten-nvim": { "branch": "main", "commit": "c621baf53459a6c45dfd98dcc11cbba7a7ae9470" }, "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-dap": { "branch": "master", "commit": "b768c8d0ce6da614ac17ed097bf2d94e35fe1a58" }, - "nvim-dap-ui": { "branch": "master", "commit": "e94d98649dccb6a3884b66aabc2e07beb279e535" }, + "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, + "nvim-dap-ui": { "branch": "master", "commit": "727c032a8f63899baccb42a1c26f27687e62fc5e" }, "nvim-dbee": { "branch": "master", "commit": "21d2cc0844a16262bb6ea93ab3d0a0f20bd87853" }, - "nvim-jdtls": { "branch": "master", "commit": "266d0cb912bbe61d66b43c5e73db19a364380360" }, + "nvim-jdtls": { "branch": "master", "commit": "5b079475890a2a9ff45c850b428357cc89c95278" }, "nvim-lint": { "branch": "master", "commit": "dfa45de973c3ce7bd1b9a6d346f896a68ad07e44" }, - "nvim-lspconfig": { "branch": "master", "commit": "8121483b8132b7053120fafd83728178fb3febf6" }, + "nvim-lspconfig": { "branch": "master", "commit": "339ccc81e08793c3af9b83882a6ebd90c9cc0d3b" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-notify": { "branch": "master", "commit": "bd9cd51f9ef2f6326fc2bc9931d0718c1794e247" }, - "nvim-treesitter": { "branch": "master", "commit": "10a9464a82fb540cca912a1d25810f242cb97b5f" }, + "nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" }, + "nvim-treesitter": { "branch": "master", "commit": "5da195ac3dfafd08d8b10756d975f0e01e1d563a" }, "nvim-treesitter-refactor": { "branch": "master", "commit": "d8b74fa87afc6a1e97b18da23e762efb032dc270" }, "nvim-ufo": { "branch": "main", "commit": "32cb247b893a384f1888b9cd737264159ecf183c" }, "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, - "oil.nvim": { "branch": "master", "commit": "7041528bdedb350ad66e650684deec8456e053cc" }, - "otter.nvim": { "branch": "main", "commit": "e8c662e1aefa8b483cfba6e00729a39a363dcecc" }, - "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "oil.nvim": { "branch": "master", "commit": "09fa1d22f5edf0730824d2b222d726c8c81bbdc9" }, + "otter.nvim": { "branch": "main", "commit": "3ff6c154d55528fbde475b2a722f91389421e873" }, + "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "quarto-nvim": { "branch": "main", "commit": "1cb2d24d7793241bd43f38e3a6f99a6d11f84458" }, "sqls.nvim": { "branch": "main", "commit": "a514379f5f89bf72955ed3bf5c1c31a40b8a1472" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" }, - "vimtex": { "branch": "master", "commit": "f822c8018effb44dc0e810eb765ec9cb4f395b5a" }, + "telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" }, + "vimtex": { "branch": "master", "commit": "c8412f444bfaf447981242d685c40e45b1c96b82" }, "which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" } } diff --git a/lua/lib/session.lua b/lua/lib/session.lua index e52925f..17afa1c 100644 --- a/lua/lib/session.lua +++ b/lua/lib/session.lua @@ -5,7 +5,7 @@ -- Last Modified: 08 Sep 2024, 11:06 ------------------------------------- -local session = { +local M = { dir = string.format("%s/session", vim.fn.stdpath "state"), } @@ -14,7 +14,7 @@ local session = { local function get_sessions() local sessions = {} - local sessions_files = vim.split(vim.fn.globpath(session.dir, "*.vim"), "\n", { trimempty = true }) + local sessions_files = vim.split(vim.fn.globpath(M.dir, "*.vim"), "\n", { trimempty = true }) for _, f in pairs(sessions_files) do table.insert(sessions, f) @@ -83,10 +83,10 @@ local function save_session() default = nil, }, function(input) if input then - if vim.fn.isdirectory(session.dir) ~= 1 then - vim.fn.mkdir(session.dir, "pR") + if vim.fn.isdirectory(M.dir) ~= 1 then + vim.fn.mkdir(M.dir, "pR") end - local new_session_path = string.format("%s/%s.vim", session.dir, input) + local new_session_path = string.format("%s/%s.vim", M.dir, input) vim.cmd.mksession { new_session_path, bang = true } -- vim.cmd("mksession! " .. mks_path) vim.notify(string.format("Session < %s > created!", input), vim.log.levels.INFO) @@ -95,13 +95,25 @@ local function save_session() end ---Helper function to usercmd completion -function session.usercmd_session_completion() +function M.usercmd_session_completion() local args = { "restore", "save", "delete" } return table.concat(args, "\n") end -function session.select(arg) - if arg == "save" then +function M.select(arg) + if arg == "" then + vim.ui.select({ "save", "delete", "restore" }, { + prompt = "Sessions> choose", + }, function(choice) + if choice == "save" then + save_session() + elseif choice == "delete_session" then + delete_session() + elseif choice == "restore_session" then + restore_session() + end + end) + elseif arg == "save" then save_session() elseif arg == "restore" then restore_session() @@ -112,4 +124,4 @@ function session.select(arg) end end -return session +return M diff --git a/lua/lib/ui/statusline.lua b/lua/lib/ui/statusline.lua index 22969e3..db07dd8 100644 --- a/lua/lib/ui/statusline.lua +++ b/lua/lib/ui/statusline.lua @@ -5,7 +5,7 @@ -- Last Modified: 26 Dec 2024, 11:00 ----------------------------------------- -local sl = { +local M = { ---name of the session session_name = "", ---filetypes to exclude @@ -19,7 +19,7 @@ local sl = { lazy = true, mason = true, noice = true, - + terminal = true, checkhealth = true, WhichKey = true, query = true, @@ -147,11 +147,11 @@ end ---Get active Nvim mode and the highlight group ---@return string mode colorful mode or mode_code local function get_mode() - local nmode = sl.colors.Nmode - local vmode = sl.colors.Vmode - local cmode = sl.colors.Cmode - local tmode = sl.colors.Tmode - local imode = sl.colors.Imode + local nmode = M.colors.Nmode + local vmode = M.colors.Vmode + local cmode = M.colors.Cmode + local tmode = M.colors.Tmode + local imode = M.colors.Imode local mode = { ["n"] = nmode .. "N", @@ -188,7 +188,7 @@ local function get_mode() ["r"] = tmode .. "R", ["rm"] = nmode .. "M", ["r?"] = nmode .. "C", - ["!"] = sl.colors.ShellMode .. "S", + ["!"] = M.colors.ShellMode .. "S", ["t"] = tmode .. "T", } @@ -212,9 +212,8 @@ end ---Get location in current buffer (current row on total rows) ---@return string line number on total number local function get_line_onTot() - return win_is_smaller(sl.preset_width.row_onTot) - and string.format(" %s%%l%s/%%L ", sl.colors.git, sl.colors.fformatloc) - or string.format(" %s%%l%s/%%L|%%P", sl.colors.git, sl.colors.fformatloc) + return win_is_smaller(M.preset_width.row_onTot) and string.format(" %s%%l%s/%%L ", M.colors.git, M.colors.fformatloc) + or string.format(" %s%%l%s/%%L|%%P", M.colors.git, M.colors.fformatloc) end ---Get file name @@ -244,22 +243,22 @@ local function get_lsp_diagnostic() status_ok = #diagnostics == 0 -- display values only if there are any - return status_ok and sl.colors.diag .. sl.icons.status_ok - or do_not_show_diag and sl.colors.diag .. sl.icons.status_not_ok + return status_ok and M.colors.diag .. M.icons.status_ok + or do_not_show_diag and M.colors.diag .. M.icons.status_not_ok or string.format( "%s%s%s %d %s%s %d %s%s %d %s%s %d", - sl.colors.diag, - sl.colors.diagError, - sl.icons.error, + M.colors.diag, + M.colors.diagError, + M.icons.error, errors, - sl.colors.diagWarn, - sl.icons.warning, + M.colors.diagWarn, + M.icons.warning, warns, - sl.colors.diagInfo, - sl.icons.information, + M.colors.diagInfo, + M.icons.information, infos, - sl.colors.diagHint, - sl.icons.hint, + M.colors.diagHint, + M.icons.hint, hints ) end @@ -270,7 +269,7 @@ local function get_lsp_progress() local lsp = vim.lsp.status() if lsp then lsp = lsp:gsub("(%%)", "%1%%"):gsub("%s+", " ") --:gsub("\r", ""):gsub("\t", ""):gsub("\n", "") - return (#lsp > sl.preset_width.lsp_info) and string.sub(lsp, 1, sl.preset_width.lsp_info) .. "…" or lsp + return (#lsp > M.preset_width.lsp_info) and string.sub(lsp, 1, M.preset_width.lsp_info) .. "…" or lsp end return "" @@ -294,9 +293,9 @@ local function get_git_status() if signs.head ~= nil then local head = signs.head - if win_is_smaller(sl.preset_width.git_branch) then + if win_is_smaller(M.preset_width.git_branch) then return "• " - elseif win_is_smaller(sl.preset_width.git_branch, sl.preset_width.git_status_full) or no_changes then + elseif win_is_smaller(M.preset_width.git_branch, M.preset_width.git_status_full) or no_changes then return string.format(" %s ", head) else return string.format("+%s ~%s -%s |  %s ", add, change, remove, head) @@ -312,7 +311,7 @@ local function get_filetype_and_icon() local file_ext = vim.bo.filetype or vim.fn.expand "%:e" local has_icons, icons = pcall(require, "mini.icons") - local icon = sl.icons.default + local icon = M.icons.default if has_icons then icon = icons.get("filetype", file_ext) end @@ -336,14 +335,14 @@ end ---Get session name if active ---@return string session_name name of the active session or empty string local function session_name() - return sl.session_name ~= "" and " Session: " .. sl.session_name or "" + return M.session_name ~= "" and " Session: " .. M.session_name or "" end ---Get python virtual-env if is active and in python file ---@return string env_name name of python env or empty string local function get_python_env() -- if vim.bo.filetype == "python" then - if not win_is_smaller(sl.preset_width.git_branch) then + if not win_is_smaller(M.preset_width.git_branch) then local venv = os.getenv "VIRTUAL_ENV" if venv then if string.find(venv, "/") then @@ -363,8 +362,8 @@ end ---Get lsp status and if active get names of server running ---@return string lsp_status local function get_lsp_info() - return #vim.lsp.get_clients { bufnr = 0 } ~= 0 and string.format("%s• ", sl.colors.name) - or string.format("%s• ", sl.colors.lspnoactive) + return #vim.lsp.get_clients { bufnr = 0 } ~= 0 and string.format("%s• ", M.colors.name) + or string.format("%s• ", M.colors.lspnoactive) end ---Statusline disabled that display only filetype and current mode @@ -375,35 +374,35 @@ local function disable_statusline() local modifiedReadOnlyFlags = "%m%r" local special_filetypes = { - dashboard = sl.icons.dashboard .. " Dashboard", - alpha = sl.icons.dashboard .. " Dashboard", - oil = sl.icons.folder .. " File Explorer", - lazy = sl.icons.checkhealth .. " Plugin Manager", - lspinfo = sl.icons.lsp_info .. " LSP Status", - TelescopePrompt = sl.icons.telescope .. " Telescope", - qf = sl.icons.config .. " QuickFix", - toggleterm = sl.icons.robots .. "Terminal", - mason = sl.icons.list .. " Package Manager", - Outline = sl.icons.table .. " Symbols Outline", - noice = sl.icons.list .. " Notifications", - checkhealth = sl.icons.checkhealth .. " Health", - WhichKey = sl.icons.search .. " WhichKey", - query = sl.icons.query .. " Query", - dbui = sl.icons.db .. " Database", - httpResult = sl.icons.web .. " Http", - dapui_hover = sl.icons.dapui_hover .. " DapUI•Hover", - ["dap-float"] = sl.icons.dapui_watches .. " DapUI•Hover", + dashboard = M.icons.dashboard .. " Dashboard", + alpha = M.icons.dashboard .. " Dashboard", + oil = M.icons.folder .. " File Explorer", + lazy = M.icons.table .. " Plugin Manager", + lspinfo = M.icons.lsp_info .. " LSP Status", + TelescopePrompt = M.icons.telescope .. " Telescope", + qf = M.icons.config .. " QuickFix", + terminal = M.icons.robots .. "Terminal", + mason = M.icons.list .. " Package Manager", + Outline = M.icons.table .. " Symbols Outline", + noice = M.icons.list .. " Notifications", + checkhealth = M.icons.checkhealth .. " Health", + WhichKey = M.icons.search .. " WhichKey", + query = M.icons.query .. " Query", + dbui = M.icons.db .. " Database", + httpResult = M.icons.web .. " Http", + dapui_hover = M.icons.dapui_hover .. " DapUI•Hover", + ["dap-float"] = M.icons.dapui_watches .. " DapUI•Hover", } local custom_ft = special_filetypes[vim.bo.filetype] return table.concat { - sl.colors.mode, + M.colors.mode, get_mode(), modifiedReadOnlyFlags, - sl.colors.inverted, + M.colors.inverted, "", sideSep, - sl.colors.inactive, + M.colors.inactive, custom_ft or ftype_name, sideSep, } @@ -416,21 +415,21 @@ local function enable_statusline() local modifiedReadOnlyFlags = "%m%r" local space = " " - sl.cached = { + M.cached = { -- LeftSide - sl.colors.mode, + M.colors.mode, get_mode(), - sl.colors.inverted, + M.colors.inverted, "", modifiedReadOnlyFlags, space, - sl.colors.git, + M.colors.git, get_git_status(), - sl.colors.name, + M.colors.name, "%<" .. get_filename(), - sl.colors.symbols, + M.colors.symbols, "", - sl.colors.empty, + M.colors.empty, session_name(), space, get_python_env(), @@ -443,29 +442,29 @@ local function enable_statusline() space, -- Right Side - sl.colors.symbols, + M.colors.symbols, "", get_lsp_info(), - sl.colors.ftype, + M.colors.ftype, get_filetype_and_icon(), - sl.colors.encoding, + M.colors.encoding, get_fencoding(), - sl.colors.fformatloc, + M.colors.fformatloc, get_fformat(), get_line_onTot(), - sl.colors.inverted, + M.colors.inverted, "", } - return table.concat(sl.cached) + return table.concat(M.cached) end ---Set statusline based on filetype of current buffer -function sl.set() +function M.set() if not vim.g.statusline_color then set_color_groups() end - if not sl.to_exclude[vim.bo.filetype] then + if not M.to_exclude[vim.bo.filetype] then vim.wo.statusline = enable_statusline() else vim.wo.statusline = disable_statusline() @@ -473,11 +472,12 @@ function sl.set() end ---Define autocmds for load winbar module and initialize -function sl.toggle() +function M.toggle() if vim.g.statusline ~= nil then vim.api.nvim_del_autocmd(vim.g.statusline) vim.wo.statusline = "" vim.g.statusline = nil + vim.g.statusline_color = nil else vim.api.nvim_create_autocmd({ "BufNewFile", @@ -500,8 +500,16 @@ function sl.toggle() }) vim.api.nvim_eval_statusline("%!v:lua.require'lib.ui.statusline'.set()", {}) end + + vim.api.nvim_create_autocmd("ColorScheme", { + callback = function() + if vim.g.statusline ~= nil then + set_color_groups() + end + end, + }) end -vim.api.nvim_create_user_command("ToggleStatusline", sl.toggle, { desc = "Toggle Statusline" }) +vim.api.nvim_create_user_command("ToggleStatusline", M.toggle, { desc = "Toggle Statusline" }) -return sl +return M diff --git a/plugin/autocommands.lua b/plugin/autocommands.lua index 55251a0..eeee189 100644 --- a/plugin/autocommands.lua +++ b/plugin/autocommands.lua @@ -206,10 +206,9 @@ autocmd("BufRead", { ---Insert mode on builtin Neovim terminal autocmd("TermOpen", { group = augroup("_startinsert_term_open", { clear = true }), - callback = function() + callback = function(ev) vim.cmd.startinsert() - vim.opt_local.number = false - vim.opt_local.relativenumber = false + vim.bo[ev.buf].filetype = "terminal" end, }) diff --git a/plugin/usercommands.lua b/plugin/usercommands.lua index 1bdc79d..c90c15e 100644 --- a/plugin/usercommands.lua +++ b/plugin/usercommands.lua @@ -57,12 +57,12 @@ user_command("WipeReg", function() end, { desc = "Wipe all Registers" }) ---Sessions -user_command("Session", function(arg) +vim.api.nvim_create_user_command("Session", function(arg) require("lib.session").select(arg.args) end, { - nargs = 1, + nargs = "?", desc = "Session Manager", - complete = "custom,v:lua.require'lib.session'.usercmd_session_completion", + -- complete = "custom,v:lua.require'lib.session'.usercmd_session_completion", }) ---Config File @@ -172,4 +172,4 @@ usercmd_toggle("ToggleAutoTrimTrailSpaces", "auto_remove_trail_spaces", { vim.api.nvim_del_autocmd(autocmd[1].id) end end, -}) +}) \ No newline at end of file