diff --git a/dots.tutor b/dots.tutor index 3f899cc2f..3e14150f7 100644 --- a/dots.tutor +++ b/dots.tutor @@ -48,9 +48,9 @@ Back to the left window, the status line is showed at the bottom of the window. You will see different content under different conditions. It will looks like this if you switch to the right window and move cursor to the second line. ------------------------------------------------------------------------------- -|Normal|main|  autocmd |~/.config/nvim|utf-8|LF|1%|2:1| +|Normal|main| 󰅩 autocmd |~/.config/nvim|utf-8|LF|1%|2:1| ------------------------------------------------------------------------------- -" autocmd" indicates this line has a variable named "autocmd". So this part of +"󰅩 autocmd" indicates this line has a variable named "autocmd". So this part of status line will show you the context of your cursor position. This feature is based on lsp, so it is disabled if corresponding lsp is not attach to current buffer. diff --git a/init.lua b/init.lua index d58d61151..4f1f4c3db 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,19 @@ if not vim.g.vscode then require("core") - print(vim.fn.expand("%")) + -- Release note + vim.schedule(function() + vim.notify_once( + [[ +We've released version v3.0.0! +Visit https://github.com/ayamir/nvimdots/releases to see the release notes. +If you have icons that can't be rendered correctly (e.g., 𑨩 and � ) or icons with incorrect size, be sure to read this! + +To silence this message, remove it from `init.lua` at the config's root directory. + +To check the glyphs size, make sure the following icons are very close to the crosses but there is no overlap: +XXXXXXXXX +]], + vim.log.levels.WARN + ) + end) end diff --git a/lazy-lock.json b/lazy-lock.json index abb2bf898..38cb1508d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -89,4 +89,4 @@ "vim-pencil": { "branch": "master", "commit": "6d70438a8886eaf933c38a7a43a61adb0a7815ed" }, "which-key.nvim": { "branch": "main", "commit": "5a6c954a5a46023c19acc03a8b6d7c3e57964fc5" }, "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" } -} \ No newline at end of file +} diff --git a/lua/core/event.lua b/lua/core/event.lua index 3a374909d..324931808 100644 --- a/lua/core/event.lua +++ b/lua/core/event.lua @@ -13,6 +13,14 @@ function autocmd.nvim_create_augroups(definitions) end end +local mapping = require("keymap.completion") +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(event) + mapping.lsp(event.buf) + end, +}) + -- auto close NvimTree vim.api.nvim_create_autocmd("BufEnter", { group = vim.api.nvim_create_augroup("NvimTreeClose", { clear = true }), diff --git a/lua/core/init.lua b/lua/core/init.lua index 4ac75df02..6f8715be7 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -166,14 +166,14 @@ local clipboard_config = function() } elseif global.is_wsl then vim.g.clipboard = { - name = "win32yank-wsl", + name = "psyank-wsl", copy = { - ["+"] = "win32yank.exe -i --crlf", - ["*"] = "win32yank.exe -i --crlf", + ["+"] = "clip.exe", + ["*"] = "clip.exe", }, paste = { - ["+"] = "win32yank.exe -o --lf", - ["*"] = "win32yank.exe -o --lf", + ["+"] = [[powershell.exe -NoProfile -NoLogo -NonInteractive -Command [console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))]], + ["*"] = [[powershell.exe -NoProfile -NoLogo -NonInteractive -Command [console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))]], }, cache_enabled = 0, } @@ -182,7 +182,7 @@ end local shell_config = function() if global.is_windows then - if not (vim.fn.executable("pwsh") or vim.fn.executable("powershell")) then + if not (vim.fn.executable("pwsh") == 1 or vim.fn.executable("powershell") == 1) then vim.notify( [[ Failed to setup terminal config @@ -192,14 +192,14 @@ cmd.exe will be used instead for `:!` (shell bang) and toggleterm.nvim. You're recommended to install PowerShell for better experience.]], vim.log.levels.WARN, - { title = "[core] Runtime error" } + { title = "[core] Runtime Warning" } ) return end local basecmd = "-NoLogo -MTA -ExecutionPolicy RemoteSigned" local ctrlcmd = "-Command [console]::InputEncoding = [console]::OutputEncoding = [System.Text.Encoding]::UTF8" - vim.api.nvim_set_option_value("shell", vim.fn.executable("pwsh") and "pwsh" or "powershell", {}) + vim.api.nvim_set_option_value("shell", vim.fn.executable("pwsh") == 1 and "pwsh" or "powershell", {}) vim.api.nvim_set_option_value("shellcmdflag", string.format("%s %s;", basecmd, ctrlcmd), {}) vim.api.nvim_set_option_value("shellredir", "-RedirectStandardOutput %s -NoNewWindow -Wait", {}) vim.api.nvim_set_option_value("shellpipe", "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode", {}) diff --git a/lua/core/options.lua b/lua/core/options.lua index 3dd6408b9..74a56d43e 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -110,12 +110,9 @@ local function load_options() if not isempty(conda_prefix) then vim.g.python_host_prog = conda_prefix .. "/bin/python" vim.g.python3_host_prog = conda_prefix .. "/bin/python" - elseif global.is_mac then - vim.g.python_host_prog = "/usr/bin/python" - vim.g.python3_host_prog = "/usr/local/bin/python3" else - vim.g.python_host_prog = "/usr/bin/python" - vim.g.python3_host_prog = "/usr/bin/python3" + vim.g.python_host_prog = "python" + vim.g.python3_host_prog = "python3" end for name, value in pairs(global_local) do diff --git a/lua/core/settings.lua b/lua/core/settings.lua index a1250fd0e..af736989b 100644 --- a/lua/core/settings.lua +++ b/lua/core/settings.lua @@ -9,6 +9,10 @@ settings["use_ssh"] = true ---@type boolean settings["format_on_save"] = true +-- Set it to false if diagnostics virtual text is annoying for you +---@type boolean +settings["diagnostics_virtual_text"] = true + -- Set the format disabled directories here, files under these dirs won't be formatted on save. ---@type string[] settings["format_disabled_dirs"] = { @@ -59,6 +63,7 @@ settings["server_formatting_block_list"] = { lua_ls = true, tsserver = true, clangd = true, + pylsp = true, } -- Set the language servers that will be installed during bootstrap here @@ -71,7 +76,7 @@ settings["lsp_deps"] = { "html", "jsonls", "lua_ls", - "pyright", + "pylsp", -- "gopls", } diff --git a/lua/keymap/completion.lua b/lua/keymap/completion.lua index adb473953..b4cbe025f 100644 --- a/lua/keymap/completion.lua +++ b/lua/keymap/completion.lua @@ -1,44 +1,39 @@ local bind = require("keymap.bind") local map_cr = bind.map_cr local map_cu = bind.map_cu --- local map_cmd = bind.map_cmd +local map_cmd = bind.map_cmd local map_callback = bind.map_callback local plug_map = { - -- LSP-related keymaps, work only when event = { "InsertEnter", "LspStart" } - ["n|li"] = map_cr("LspInfo"):with_noremap():with_silent():with_nowait():with_desc("lsp: Info"), - ["n|lr"] = map_cr("LspRestart"):with_noremap():with_silent():with_nowait():with_desc("lsp: Restart"), - ["n|go"] = map_cr("Lspsaga outline"):with_noremap():with_silent():with_desc("lsp: Toggle outline"), - ["n|g["] = map_cr("Lspsaga diagnostic_jump_prev"):with_noremap():with_silent():with_desc("lsp: Prev diagnostic"), - ["n|g]"] = map_cr("Lspsaga diagnostic_jump_next"):with_noremap():with_silent():with_desc("lsp: Next diagnostic"), - ["n|ld"] = map_cr("Lspsaga show_line_diagnostics") - :with_noremap() - :with_silent() - :with_desc("lsp: Line diagnostic"), - ["n|gs"] = map_callback(function() - vim.lsp.buf.signature_help() - end) - :with_noremap() - :with_silent() - :with_desc("lsp: Signature help"), - ["n|gr"] = map_cr("Lspsaga rename"):with_noremap():with_silent():with_desc("lsp: Rename in file range"), - ["n|gR"] = map_cr("Lspsaga rename ++project") - :with_noremap() - :with_silent() - :with_desc("lsp: Rename in project range"), - ["n|K"] = map_cr("Lspsaga hover_doc"):with_noremap():with_silent():with_desc("lsp: Show doc"), - ["nv|ga"] = map_cr("Lspsaga code_action"):with_noremap():with_silent():with_desc("lsp: Code action"), - ["n|gd"] = map_cr("Lspsaga peek_definition"):with_noremap():with_silent():with_desc("lsp: Preview definition"), - ["n|gD"] = map_cr("Lspsaga goto_definition"):with_noremap():with_silent():with_desc("lsp: Goto definition"), - ["n|gh"] = map_cr("Lspsaga lsp_finder"):with_noremap():with_silent():with_desc("lsp: Show reference"), - ["n|ci"] = map_cr("Lspsaga incoming_calls") - :with_noremap() - :with_silent() - :with_desc("lsp: Show incoming calls"), - ["n|co"] = map_cr("Lspsaga outgoing_calls") - :with_noremap() - :with_silent() - :with_desc("lsp: Show outgoing calls"), + ["n|"] = map_cmd("FormatToggle"):with_noremap():with_desc("Formater: Toggle format on save"), } - bind.nvim_load_mapping(plug_map) + +local mapping = {} + +function mapping.lsp(buf) + local map = { + -- LSP-related keymaps, work only when event = { "InsertEnter", "LspStart" } + ["n|li"] = map_cr("LspInfo"):with_buffer(buf):with_desc("lsp: Info"), + ["n|lr"] = map_cr("LspRestart"):with_buffer(buf):with_nowait():with_desc("lsp: Restart"), + ["n|go"] = map_cr("Lspsaga outline"):with_buffer(buf):with_desc("lsp: Toggle outline"), + ["n|g["] = map_cr("Lspsaga diagnostic_jump_prev"):with_buffer(buf):with_desc("lsp: Prev diagnostic"), + ["n|g]"] = map_cr("Lspsaga diagnostic_jump_next"):with_buffer(buf):with_desc("lsp: Next diagnostic"), + ["n|ld"] = map_cr("Lspsaga show_line_diagnostics"):with_buffer(buf):with_desc("lsp: Line diagnostic"), + ["n|gs"] = map_callback(function() + vim.lsp.buf.signature_help() + end):with_desc("lsp: Signature help"), + ["n|gr"] = map_cr("Lspsaga rename"):with_buffer(buf):with_desc("lsp: Rename in file range"), + ["n|gR"] = map_cr("Lspsaga rename ++project"):with_buffer(buf):with_desc("lsp: Rename in project range"), + ["n|K"] = map_cr("Lspsaga hover_doc"):with_buffer(buf):with_desc("lsp: Show doc"), + ["nv|ga"] = map_cr("Lspsaga code_action"):with_buffer(buf):with_desc("lsp: Code action for cursor"), + ["n|gd"] = map_cr("Lspsaga peek_definition"):with_buffer(buf):with_desc("lsp: Preview definition"), + ["n|gD"] = map_cr("Lspsaga goto_definition"):with_buffer(buf):with_desc("lsp: Goto definition"), + ["n|gh"] = map_cr("Lspsaga lsp_finder"):with_buffer(buf):with_desc("lsp: Show reference"), + ["n|ci"] = map_cr("Lspsaga incoming_calls"):with_buffer(buf):with_desc("lsp: Show incoming calls"), + ["n|co"] = map_cr("Lspsaga outgoing_calls"):with_buffer(buf):with_desc("lsp: Show outgoing calls"), + } + bind.nvim_load_mapping(map) +end + +return mapping diff --git a/lua/keymap/editor.lua b/lua/keymap/editor.lua index 37f56aeab..0d067aa54 100644 --- a/lua/keymap/editor.lua +++ b/lua/keymap/editor.lua @@ -15,9 +15,9 @@ local plug_map = { end):with_expr(), -- Plugin: auto_session - ["n|ss"] = map_cu("SaveSession"):with_noremap():with_silent():with_desc("session: Save"), - ["n|sr"] = map_cu("RestoreSession"):with_noremap():with_silent():with_desc("session: Restore"), - ["n|sd"] = map_cu("DeleteSession"):with_noremap():with_silent():with_desc("session: Delete"), + ["n|ss"] = map_cu("SessionSave"):with_noremap():with_silent():with_desc("session: Save"), + ["n|sr"] = map_cu("SessionRestore"):with_noremap():with_silent():with_desc("session: Restore"), + ["n|sd"] = map_cu("SessionDelete"):with_noremap():with_silent():with_desc("session: Delete"), -- Plugin: nvim-bufdel ["n|"] = map_cr("BufDel"):with_noremap():with_silent():with_desc("buffer: Close current"), diff --git a/lua/keymap/helpers.lua b/lua/keymap/helpers.lua index 1229fd57a..f4f26d26f 100644 --- a/lua/keymap/helpers.lua +++ b/lua/keymap/helpers.lua @@ -13,7 +13,7 @@ end local _lazygit = nil _G._toggle_lazygit = function() - if vim.fn.executable("lazygit") then + if vim.fn.executable("lazygit") == 1 then if not _lazygit then _lazygit = require("toggleterm.terminal").Terminal:new({ cmd = "lazygit", diff --git a/lua/keymap/ui.lua b/lua/keymap/ui.lua index bccf4e5a5..d52e6b289 100644 --- a/lua/keymap/ui.lua +++ b/lua/keymap/ui.lua @@ -24,3 +24,82 @@ local plug_map = { } bind.nvim_load_mapping(plug_map) + +local mapping = {} + +function mapping.gitsigns(buf) + local actions = require("gitsigns.actions") + local map = { + ["n|]g"] = bind.map_callback(function() + if vim.wo.diff then + return "]g" + end + vim.schedule(function() + actions.next_hunk() + end) + return "" + end) + :with_buffer(buf) + :with_expr() + :with_desc("git: Goto next hunk"), + ["n|[g"] = bind.map_callback(function() + if vim.wo.diff then + return "[g" + end + vim.schedule(function() + actions.prev_hunk() + end) + return "" + end) + :with_buffer(buf) + :with_expr() + :with_desc("git: Goto prev hunk"), + ["n|hs"] = bind.map_callback(function() + actions.stage_hunk() + end) + :with_buffer(buf) + :with_desc("git: Stage hunk"), + ["v|hs"] = bind.map_callback(function() + actions.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end) + :with_buffer(buf) + :with_desc("git: Stage hunk"), + ["n|hu"] = bind.map_callback(function() + actions.undo_stage_hunk() + end) + :with_buffer(buf) + :with_desc("git: Undo stage hunk"), + ["n|hr"] = bind.map_callback(function() + actions.reset_hunk() + end) + :with_buffer(buf) + :with_desc("git: Reset hunk"), + ["v|hr"] = bind.map_callback(function() + actions.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end) + :with_buffer(buf) + :with_desc("git: Reset hunk"), + ["n|hR"] = bind.map_callback(function() + actions.reset_buffer() + end) + :with_buffer(buf) + :with_desc("git: Reset buffer"), + ["n|hp"] = bind.map_callback(function() + actions.preview_hunk() + end) + :with_buffer(buf) + :with_desc("git: Preview hunk"), + ["n|hb"] = bind.map_callback(function() + actions.blame_line({ full = true }) + end) + :with_buffer(buf) + :with_desc("git: Blame line"), + -- Text objects + ["ox|ih"] = bind.map_callback(function() + actions.text_object() + end):with_buffer(buf), + } + bind.nvim_load_mapping(map) +end + +return mapping diff --git a/lua/modules/configs/completion/cmp.lua b/lua/modules/configs/completion/cmp.lua index b83b1843e..4331b363b 100644 --- a/lua/modules/configs/completion/cmp.lua +++ b/lua/modules/configs/completion/cmp.lua @@ -21,15 +21,6 @@ return function() } end - local cmp_window = require("cmp.utils.window") - - cmp_window.info_ = cmp_window.info - cmp_window.info = function(self) - local info = self:info_() - info.scrollable = false - return info - end - local compare = require("cmp.config.compare") compare.lsp_scores = function(entry1, entry2) local diff @@ -71,13 +62,14 @@ return function() end local cmp = require("cmp") - cmp.setup({ + preselect = cmp.PreselectMode.Item, window = { completion = { border = border("Normal"), max_width = 80, max_height = 20, + scrollbar = false, }, documentation = { border = border("CmpDocBorder"), @@ -89,12 +81,16 @@ return function() require("copilot_cmp.comparators").prioritize, require("copilot_cmp.comparators").score, -- require("cmp_tabnine.compare"), - compare.offset, + compare.offset, -- Items closer to cursor will have lower priority compare.exact, + -- compare.scopes, compare.lsp_scores, + compare.sort_text, + compare.score, + compare.recently_used, + -- compare.locality, -- Items closer to cursor will have higher priority, conflicts with `offset` require("cmp-under-comparator").under, compare.kind, - compare.sort_text, compare.length, compare.order, }, @@ -110,6 +106,9 @@ return function() return kind end, }, + matching = { + disallow_partial_fuzzy_matching = false, + }, -- You can set mappings if you want mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace }), @@ -144,7 +143,7 @@ return function() }, -- You should specify your *installed* sources. sources = { - { name = "nvim_lsp" }, + { name = "nvim_lsp", max_item_count = 350 }, { name = "nvim_lua" }, { name = "luasnip" }, { name = "path" }, @@ -168,5 +167,10 @@ return function() -- { name = "codeium" }, -- { name = "cmp_tabnine" }, }, + experimental = { + ghost_text = { + hl_group = "Whitespace", + }, + }, }) end diff --git a/lua/modules/configs/completion/formatting.lua b/lua/modules/configs/completion/formatting.lua index 42dfe4c3d..4204e9ed5 100644 --- a/lua/modules/configs/completion/formatting.lua +++ b/lua/modules/configs/completion/formatting.lua @@ -54,9 +54,9 @@ function M.enable_format_on_save(is_configured) end end -function M.disable_format_on_save() +function M.disable_format_on_save(is_configured) pcall(vim.api.nvim_del_augroup_by_name, "format_on_save") - if format_on_save then + if not is_configured then vim.notify( "Successfully disabled format-on-save", vim.log.levels.INFO, @@ -69,7 +69,7 @@ function M.configure_format_on_save() if format_on_save then M.enable_format_on_save(true) else - M.disable_format_on_save() + M.disable_format_on_save(true) end end @@ -81,7 +81,7 @@ function M.toggle_format_on_save() if not status then M.enable_format_on_save(false) else - M.disable_format_on_save() + M.disable_format_on_save(false) end end diff --git a/lua/modules/configs/completion/lsp.lua b/lua/modules/configs/completion/lsp.lua index 4fa02a7b0..4130ac8a8 100644 --- a/lua/modules/configs/completion/lsp.lua +++ b/lua/modules/configs/completion/lsp.lua @@ -37,6 +37,14 @@ return function() local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) + vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + signs = true, + underline = true, + virtual_text = require("core.settings").diagnostics_virtual_text, + -- set update_in_insert to false bacause it was enabled by lspsaga + update_in_insert = false, + }) + local opts = { on_attach = function() require("lsp_signature").on_attach({ @@ -85,7 +93,7 @@ return function() mason_lspconfig.setup_handlers({ mason_handler }) -- Set lsps that are not supported by `mason.nvim` but supported by `nvim-lspconfig` here. - if vim.fn.executable("dart") then + if vim.fn.executable("dart") == 1 then local _opts = require("completion.servers.dartls") local final_opts = vim.tbl_deep_extend("keep", _opts, opts) nvim_lsp.dartls.setup(final_opts) diff --git a/lua/modules/configs/editor/auto-session.lua b/lua/modules/configs/editor/auto-session.lua index c056c5173..75ee2b21f 100644 --- a/lua/modules/configs/editor/auto-session.lua +++ b/lua/modules/configs/editor/auto-session.lua @@ -7,5 +7,18 @@ return function() auto_save_enabled = true, auto_restore_enabled = true, auto_session_suppress_dirs = nil, + session_lens = { + -- If `load_on_setup` is set to false, please use `SessionLensToggle` to manually load this add-on. + load_on_setup = false, + theme_conf = { border = true }, + previewer = false, + }, }) + + vim.api.nvim_create_user_command("SessionLensToggle", function() + if not package.loaded["auto-session.session-lens"] then + require("auto-session").setup_session_lens() + end + require("auto-session.session-lens").search_session() + end, { nargs = 0 }) end diff --git a/lua/modules/configs/tool/dap/dap-debugpy.lua b/lua/modules/configs/tool/dap/dap-debugpy.lua index cbd7980b6..21c014cdf 100644 --- a/lua/modules/configs/tool/dap/dap-debugpy.lua +++ b/lua/modules/configs/tool/dap/dap-debugpy.lua @@ -6,7 +6,7 @@ end dap.adapters.python = { type = "executable", - command = "/usr/bin/python", + command = "python", args = { "-m", "debugpy.adapter" }, } dap.configurations.python = { @@ -22,13 +22,13 @@ dap.configurations.python = { if not isempty(vim.env.CONDA_PREFIX) then return vim.env.CONDA_PREFIX .. "/bin/python" else - return "/usr/bin/python3" + return "python3" end end, }, } --- NOTE: for people using venv +-- NOTE: This setting is for people using venv -- pythonPath = function() -- -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself. -- -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within. @@ -41,6 +41,6 @@ dap.configurations.python = { -- elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then -- return cwd .. "/.venv/bin/python" -- else --- return "/usr/bin/python" +-- return "python3" -- end -- end, diff --git a/lua/modules/configs/tool/dap/dap-lldb.lua b/lua/modules/configs/tool/dap/dap-lldb.lua index 53aa9adfd..ed1e628eb 100644 --- a/lua/modules/configs/tool/dap/dap-lldb.lua +++ b/lua/modules/configs/tool/dap/dap-lldb.lua @@ -2,7 +2,7 @@ local dap = require("dap") dap.adapters.lldb = { type = "executable", - command = "/usr/bin/lldb-vscode", + command = "lldb-vscode", name = "lldb", } dap.configurations.cpp = { diff --git a/lua/modules/configs/tool/nvim-tree.lua b/lua/modules/configs/tool/nvim-tree.lua index 2979c4a78..d903ee868 100644 --- a/lua/modules/configs/tool/nvim-tree.lua +++ b/lua/modules/configs/tool/nvim-tree.lua @@ -66,17 +66,17 @@ return function() git = true, }, padding = " ", - symlink_arrow = "  ", + symlink_arrow = " 󰁔 ", glyphs = { default = icons.documents.Default, -- symlink = icons.documents.Symlink, -- bookmark = icons.ui.Bookmark, git = { unstaged = icons.git.Mod_alt, - staged = icons.git.Add, -- + staged = icons.git.Add, --󰄬 unmerged = icons.git.Unmerged, - renamed = icons.git.Rename, -- - untracked = icons.git.Untracked, -- "ﲉ" + renamed = icons.git.Rename, --󰁔 + untracked = icons.git.Untracked, -- "󰞋" deleted = icons.git.Remove, -- ignored = icons.git.Ignore, --◌ }, diff --git a/lua/modules/configs/ui/alpha.lua b/lua/modules/configs/ui/alpha.lua index aad83724d..372213b14 100644 --- a/lua/modules/configs/ui/alpha.lua +++ b/lua/modules/configs/ui/alpha.lua @@ -77,7 +77,7 @@ return function() require("telescope").extensions.frecency.frecency() end, }), - button("space f e", " File history", leader, nil, { + button("space f e", "󰋚 File history", leader, nil, { noremap = true, silent = true, nowait = true, @@ -93,7 +93,7 @@ return function() require("telescope").extensions.projects.projects({}) end, }), - button("space f f", " File find", leader, nil, { + button("space f f", "󰈞 File find", leader, nil, { noremap = true, silent = true, nowait = true, @@ -124,13 +124,13 @@ return function() local stats = require("lazy").stats() local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) return "  Have Fun with neovim" - .. "  v" + .. " 󰀨 v" .. vim.version().major .. "." .. vim.version().minor .. "." .. vim.version().patch - .. "  " + .. " 󰂖 " .. stats.count .. " plugins in " .. ms diff --git a/lua/modules/configs/ui/catppuccin.lua b/lua/modules/configs/ui/catppuccin.lua index 7ddf98cce..5a6260e33 100644 --- a/lua/modules/configs/ui/catppuccin.lua +++ b/lua/modules/configs/ui/catppuccin.lua @@ -149,7 +149,7 @@ return function() FidgetTitle = { fg = cp.blue, style = { "bold" } }, -- For trouble.nvim - TroubleNormal = { bg = cp.base }, + TroubleNormal = { bg = transparent_background and cp.none or cp.base }, -- For lsp semantic tokens ["@lsp.type.comment"] = { fg = cp.overlay0 }, diff --git a/lua/modules/configs/ui/gitsigns.lua b/lua/modules/configs/ui/gitsigns.lua index 97ea8ebe8..cefc4712c 100644 --- a/lua/modules/configs/ui/gitsigns.lua +++ b/lua/modules/configs/ui/gitsigns.lua @@ -1,4 +1,5 @@ return function() + local mapping = require("keymap.ui") require("gitsigns").setup({ signs = { add = { @@ -32,80 +33,7 @@ return function() linehl = "GitSignsChangeLn", }, }, - on_attach = function(bufnr) - local bind = require("keymap.bind") - - bind.nvim_load_mapping({ - ["n|]g"] = bind.map_callback(function() - if vim.wo.diff then - return "]g" - end - vim.schedule(function() - require("gitsigns.actions").next_hunk() - end) - return "" - end) - :with_buffer(bufnr) - :with_expr() - :with_desc("git: Goto next hunk"), - ["n|[g"] = bind.map_callback(function() - if vim.wo.diff then - return "[g" - end - vim.schedule(function() - require("gitsigns.actions").prev_hunk() - end) - return "" - end) - :with_buffer(bufnr) - :with_expr() - :with_desc("git: Goto prev hunk"), - ["n|hs"] = bind.map_callback(function() - require("gitsigns.actions").stage_hunk() - end) - :with_buffer(bufnr) - :with_desc("git: Stage hunk"), - ["v|hs"] = bind.map_callback(function() - require("gitsigns.actions").stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end) - :with_buffer(bufnr) - :with_desc("git: Stage hunk"), - ["n|hu"] = bind.map_callback(function() - require("gitsigns.actions").undo_stage_hunk() - end) - :with_buffer(bufnr) - :with_desc("git: Undo stage hunk"), - ["n|hr"] = bind.map_callback(function() - require("gitsigns.actions").reset_hunk() - end) - :with_buffer(bufnr) - :with_desc("git: Reset hunk"), - ["v|hr"] = bind.map_callback(function() - require("gitsigns.actions").reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end) - :with_buffer(bufnr) - :with_desc("git: Reset hunk"), - ["n|hR"] = bind.map_callback(function() - require("gitsigns.actions").reset_buffer() - end) - :with_buffer(bufnr) - :with_desc("git: Reset buffer"), - ["n|hp"] = bind.map_callback(function() - require("gitsigns.actions").preview_hunk() - end) - :with_buffer(bufnr) - :with_desc("git: Preview hunk"), - ["n|hb"] = bind.map_callback(function() - require("gitsigns.actions").blame_line({ full = true }) - end) - :with_buffer(bufnr) - :with_desc("git: Blame line"), - -- Text objects - ["ox|ih"] = bind.map_callback(function() - require("gitsigns.actions").text_object() - end):with_buffer(bufnr), - }) - end, + on_attach = mapping.gitsigns, watch_gitdir = { interval = 1000, follow_files = true }, current_line_blame = true, current_line_blame_opts = { delay = 1000, virtual_text_pos = "eol" }, diff --git a/lua/modules/configs/ui/lualine.lua b/lua/modules/configs/ui/lualine.lua index 6d84339ae..0d6a3096c 100644 --- a/lua/modules/configs/ui/lualine.lua +++ b/lua/modules/configs/ui/lualine.lua @@ -122,6 +122,7 @@ return function() error = icons.diagnostics.Error, warn = icons.diagnostics.Warning, info = icons.diagnostics.Information, + hint = icons.diagnostics.Hint_alt, }, }, { get_cwd }, diff --git a/lua/modules/configs/ui/neodim.lua b/lua/modules/configs/ui/neodim.lua index 200496b25..5a8d0a31d 100644 --- a/lua/modules/configs/ui/neodim.lua +++ b/lua/modules/configs/ui/neodim.lua @@ -4,14 +4,13 @@ return function() require("neodim").setup({ alpha = 0.45, blend_color = blend_color, - update_in_insert = { - enable = true, - delay = 100, - }, + refresh_delay = 75, -- time in ms to wait after typing before refreshing diagnostics hide = { virtual_text = true, signs = false, underline = false, }, + priority = 80, + disable = { "big_file_disabled_ft" }, }) end diff --git a/lua/modules/plugins/editor.lua b/lua/modules/plugins/editor.lua index 88fe34965..135e65bd0 100644 --- a/lua/modules/plugins/editor.lua +++ b/lua/modules/plugins/editor.lua @@ -7,7 +7,7 @@ editor["rainbowhxch/accelerated-jk.nvim"] = { } editor["rmagatti/auto-session"] = { lazy = true, - cmd = { "SaveSession", "RestoreSession", "DeleteSession" }, + cmd = { "SessionSave", "SessionRestore", "SessionDelete" }, config = require("editor.auto-session"), } editor["m4xshen/autoclose.nvim"] = { @@ -82,6 +82,7 @@ editor["nvim-treesitter/nvim-treesitter"] = { config = require("editor.treesitter"), dependencies = { { "nvim-treesitter/nvim-treesitter-textobjects" }, + { "nvim-treesitter/nvim-treesitter-context" }, { "mrjones2014/nvim-ts-rainbow" }, { "JoosepAlviste/nvim-ts-context-commentstring" }, { "mfussenegger/nvim-treehopper" }, diff --git a/lua/modules/utils/icons.lua b/lua/modules/utils/icons.lua index 3d5703e67..365143e4f 100644 --- a/lua/modules/utils/icons.lua +++ b/lua/modules/utils/icons.lua @@ -2,34 +2,34 @@ local icons = {} local data = { kind = { - Class = "ﴯ", - Color = "", - Constant = "", + Class = "󰠱", + Color = "󰏘", + Constant = "󰏿", Constructor = "", Enum = "", EnumMember = "", Event = "", - Field = "", - File = "", - Folder = "", - Function = "", + Field = "󰇽", + File = "󰈙", + Folder = "󰉋", + Function = "󰊕", Interface = "", - Keyword = "", - Method = "", + Keyword = "󰌋", + Method = "󰆧", Module = "", - Namespace = "", + Namespace = "󰌗", Number = "", - Operator = "", + Operator = "󰆕", Package = "", - Property = "ﰠ", + Property = "󰜢", Reference = "", Snippet = "", Struct = "", - Text = "", - TypeParameter = "", - Unit = "", + Text = "󰉿", + TypeParameter = "󰅲", Undefined = "", - Value = "", + Unit = "", + Value = "󰎠", Variable = "", -- ccls-specific icons. TypeAlias = "", @@ -38,18 +38,18 @@ local data = { Macro = "", }, type = { - Array = "", + Array = "󰅪", Boolean = "", - Null = "ﳠ", + Null = "󰟢", Number = "", - Object = "", - String = "", + Object = "󰅩", + String = "󰉿", }, documents = { Default = "", File = "", Files = "", - FileTree = "פּ", + FileTree = "󰙅", Import = "", Symlink = "", }, @@ -57,15 +57,15 @@ local data = { Add = "", Branch = "", Diff = "", - Git = "", + Git = "󰊢", Ignore = "", Mod = "M", Mod_alt = "", Remove = "", Rename = "", Repo = "", - Unmerged = "שׂ", - Untracked = "ﲉ", + Unmerged = "󰘬", + Untracked = "󰞋", Unstaged = "", Staged = "", Conflict = "", @@ -75,55 +75,55 @@ local data = { ArrowOpen = "", BigCircle = "", BigUnfilledCircle = "", - BookMark = "", + BookMark = "󰃃", Bug = "", Calendar = "", - Check = "", + Check = "󰄳", ChevronRight = "", Circle = "", - Close = "", + Close = "󰅖", Close_alt = "", CloudDownload = "", - Comment = "", - CodeAction = "", + Comment = "󰅺", + CodeAction = "󰌵", Dashboard = "", - Emoji = "", + Emoji = "󰱫", EmptyFolder = "", EmptyFolderOpen = "", - File = "", + File = "󰈤", Fire = "", Folder = "", FolderOpen = "", Gear = "", - History = "", - Incoming = "", + History = "󰄉", + Incoming = "󰏷", Indicator = "", Keyboard = "", Left = "", List = "", Square = "", SymlinkFolder = "", - Lock = "", + Lock = "󰍁", Modified = "✥", Modified_alt = "", NewFile = "", Newspaper = "", - Note = "", - Outgoing = "", + Note = "󰍨", + Outgoing = "󰏻", Package = "", - Pencil = "", - Perf = "", + Pencil = "󰏫", + Perf = "󰅒", Play = "", Project = "", Right = "", RootFolderOpened = "", - Search = "", + Search = "󰍉", Separator = "", - DoubleSeparator = "", + DoubleSeparator = "󰄾", SignIn = "", SignOut = "", Sort = "", - Spell = "暈", + Spell = "󰓆", Symlink = "", Table = "", Telescope = "", @@ -133,21 +133,21 @@ local data = { Warning = "", Information = "", Question = "", - Hint = "", + Hint = "󰌵", -- Holo version - Error_alt = "", - Warning_alt = "", + Error_alt = "󰅚", + Warning_alt = "󰀪", Information_alt = "", Question_alt = "", - Hint_alt = "", + Hint_alt = "󰌶", }, misc = { - Campass = "", + Campass = "󰀹", Code = "", - EscapeST = "✺", + EscapeST = "", Gavel = "", - Glass = "", - PyEnv = "", + Glass = "󰂖", + PyEnv = "󰌠", Squirrel = "", Tag = "", Tree = "", @@ -156,7 +156,7 @@ local data = { Vbar = "│", Add = "+", Added = "", - Ghost = "", + Ghost = "󰊠", ManUp = "", Vim = "", }, @@ -164,6 +164,7 @@ local data = { Codeium = "", TabNine = "", Copilot = "", + Copilot_alt = "", -- Add source-specific icons here buffer = "", cmp_tabnine = "", @@ -171,30 +172,30 @@ local data = { copilot = "", copilot_alt = "", latex_symbols = "", - luasnip = "", + luasnip = "󰃐", nvim_lsp = "", nvim_lua = "", orgmode = "", path = "", - spell = "暈", + spell = "󰓆", tmux = "", treesitter = "", undefined = "", }, dap = { - Breakpoint = "", - BreakpointCondition = "ﳁ", + Breakpoint = "󰝥", + BreakpointCondition = "󰟃", BreakpointRejected = "", LogPoint = "", Pause = "", Play = "", RunLast = "↻", StepBack = "", - StepInto = "", - StepOut = "", - StepOver = "", + StepInto = "󰆹", + StepOut = "󰆸", + StepOver = "󰆷", Stopped = "", - Terminate = "ﱢ", + Terminate = "󰝤", }, } diff --git a/lua/modules/utils/init.lua b/lua/modules/utils/init.lua index 47da69d8e..1a5eae87c 100644 --- a/lua/modules/utils/init.lua +++ b/lua/modules/utils/init.lua @@ -110,9 +110,9 @@ function M.hl_to_rgb(hl_group, use_bg, fallback_hl) if hlexists then local result = vim.api.nvim_get_hl(0, { name = hl_group, link = false }) if use_bg then - hex = result.bg and result.bg or "NONE" + hex = result.bg and string.format("#%06x", result.bg) or "NONE" else - hex = result.fg and result.fg or "NONE" + hex = result.fg and string.format("#%06x", result.fg) or "NONE" end end @@ -212,7 +212,7 @@ function M.tobool(value) vim.notify( "Attempting to convert data of type '" .. type(value) .. "' [other than 0 or 1] to boolean", vim.log.levels.ERROR, - { title = "[utils] Runtime error" } + { title = "[utils] Runtime Error" } ) return nil end