From b012c8c67c7469c482e5729a1800a62e3419bca6 Mon Sep 17 00:00:00 2001 From: Shubham Pawar Date: Thu, 13 Feb 2025 21:04:33 +0530 Subject: [PATCH] chore: change theme and other minor edits --- .config/nvim-astro/lazy-lock.json | 4 +- .config/nvim-astro/lua/community.lua | 3 +- .config/nvim-astro/lua/plugins/astrocore.lua | 4 ++ .config/nvim-astro/lua/plugins/astroui.lua | 52 ++++++--------- .../nvim-astro/lua/plugins/multi-cursors.lua | 65 +++++++++++++++++++ .config/nvim-astro/lua/plugins/session.lua | 37 +++++++++-- .config/nvim-astro/lua/plugins/snacks.lua | 12 +++- .config/nvim/lua/user/plugins/theme.lua | 20 +++++- 8 files changed, 151 insertions(+), 46 deletions(-) create mode 100644 .config/nvim-astro/lua/plugins/multi-cursors.lua diff --git a/.config/nvim-astro/lazy-lock.json b/.config/nvim-astro/lazy-lock.json index a1d6d5d..84323b6 100644 --- a/.config/nvim-astro/lazy-lock.json +++ b/.config/nvim-astro/lazy-lock.json @@ -55,9 +55,10 @@ "mini.align": { "branch": "main", "commit": "3bdf6f0b91b31db5300a7b04f53f296a7fb150c1" }, "mini.bufremove": { "branch": "main", "commit": "1ee294a97e091d3cf967974df622c0d887890dc2" }, "mini.files": { "branch": "main", "commit": "0db8f49088bcefff23c5cb8498a6c94e46a45a8e" }, + "mini.icons": { "branch": "main", "commit": "ec61af6e606fc89ee3b1d8f2f20166a3ca917a36" }, "mini.move": { "branch": "main", "commit": "c8b30e92dd2668dd6e56a9a23cb7d4ee38c2266d" }, "mini.operators": { "branch": "main", "commit": "81e5059268154f5a8b594c95748968febdd539e3" }, - "multiple-cursors.nvim": { "branch": "main", "commit": "3915468ed5f4469732d178f39e7d555b8e7c3f2e" }, + "multicursor.nvim": { "branch": "1.0", "commit": "17942364aec9c2caeec5fe29ee5f229b2f00c4b1" }, "neo-tree.nvim": { "branch": "main", "commit": "5d172e8315444dbc32867d1c7b04d8e7e68ec4e1" }, "neoconf.nvim": { "branch": "main", "commit": "b8ea8a1fe16b9c24a4dd701c7a03f414aee2c9ff" }, "neotest": { "branch": "master", "commit": "d66cf4e05a116957f0d3a7755a24291c7d1e1f72" }, @@ -110,6 +111,7 @@ "tree-sitter-haskell": { "branch": "master", "commit": "0975ef72fc3c47b530309ca93937d7d143523628" }, "ts-error-translator.nvim": { "branch": "main", "commit": "47e5ba89f71b9e6c72eaaaaa519dd59bd6897df4" }, "tsc.nvim": { "branch": "main", "commit": "59abb6f3f24a3ca80708f694af4e2b727a1a3211" }, + "vague.nvim": { "branch": "main", "commit": "8a33468ca4fc73adc1b111b19f89b7663fdfd137" }, "venv-selector.nvim": { "branch": "regexp", "commit": "e82594274bf7b54387f9a2abe65f74909ac66e97" }, "vim-dadbod": { "branch": "master", "commit": "9f0ca8bcef704659820a95c3bbd2c262583a66a1" }, "vim-dadbod-completion": { "branch": "master", "commit": "c7f1be21a08b8fc9d927a19db89a4aa995402787" }, diff --git a/.config/nvim-astro/lua/community.lua b/.config/nvim-astro/lua/community.lua index db93e25..7630a32 100644 --- a/.config/nvim-astro/lua/community.lua +++ b/.config/nvim-astro/lua/community.lua @@ -40,7 +40,7 @@ return { { import = "astrocommunity.debugging.persistent-breakpoints-nvim" }, { import = "astrocommunity.editing-support.dial-nvim" }, - { import = "astrocommunity.editing-support.multiple-cursors-nvim" }, + -- { import = "astrocommunity.editing-support.multiple-cursors-nvim" }, { import = "astrocommunity.editing-support.nvim-treesitter-context" }, { import = "astrocommunity.editing-support.refactoring-nvim" }, @@ -54,4 +54,5 @@ return { { import = "astrocommunity.motion.vim-matchup" }, { import = "astrocommunity.recipes.heirline-vscode-winbar" }, + { import = "astrocommunity.icon.mini-icons" }, } diff --git a/.config/nvim-astro/lua/plugins/astrocore.lua b/.config/nvim-astro/lua/plugins/astrocore.lua index 22e3fa8..806e704 100644 --- a/.config/nvim-astro/lua/plugins/astrocore.lua +++ b/.config/nvim-astro/lua/plugins/astrocore.lua @@ -94,6 +94,10 @@ return { desc = "Paste without overriding clipboard", }, }, + o = { + ie = { ':exec "normal! ggVG"', desc = "Entire File" }, + iv = { ':exec "normal! HVL"', desc = "Entire Visible screen" }, + }, }, filetypes = { filename = { diff --git a/.config/nvim-astro/lua/plugins/astroui.lua b/.config/nvim-astro/lua/plugins/astroui.lua index bb10620..079f182 100644 --- a/.config/nvim-astro/lua/plugins/astroui.lua +++ b/.config/nvim-astro/lua/plugins/astroui.lua @@ -5,51 +5,37 @@ return { ---@type AstroUIOpts opts = { -- change colorscheme - colorscheme = "astrodark", - -- colorscheme = "jellybeans", - -- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes + -- colorscheme = "astrodark", + colorscheme = "vague", highlights = { - -- init = { -- this table overrides highlights in all themes - -- -- Normal = { bg = "#000000" }, - -- }, - -- astrodark = { -- a table of overrides/changes when applying the astrotheme theme - -- -- Normal = { bg = "#000000" }, - -- }, + -- this table overrides highlights in all themes + -- init = { }, astrodark = { QuickScopePrimary = { fg = "#dfbb78", bg = "#505050", bold = true, undercurl = true }, QuickScopeSecondary = { fg = "#61afef", bg = "#505050", bold = true, undercurl = true }, }, + vague = { + ["@tag.attribute"] = { fg = "#c3c3d5" }, + StatusLine = { bg = "#181818" }, + WinBar = { bg = "#141415" }, + SnacksPickerMatch = { fg = "#f3be7c" }, + QuickScopePrimary = { fg = "#f3be7c", bg = "#333738", bold = true, undercurl = true }, + QuickScopeSecondary = { fg = "#7e98e8", bg = "#333738", bold = true, undercurl = true }, + }, }, -- modify variables used by heirline but not defined in the setup call directly status = { colors = function(hl) - hl.buffer_active_bg = "#242642" + -- astrodark + -- hl.buffer_active_bg = "#242642" + hl.buffer_active_bg = "#393960" return hl end, }, - -- Icons can be configured throughout the interface - -- icons = { - -- -- configure the loading of the lsp in the status line - -- LSPLoading1 = "⠋", - -- LSPLoading2 = "⠙", - -- LSPLoading3 = "⠹", - -- LSPLoading4 = "⠸", - -- LSPLoading5 = "⠼", - -- LSPLoading6 = "⠴", - -- LSPLoading7 = "⠦", - -- LSPLoading8 = "⠧", - -- LSPLoading9 = "⠇", - -- LSPLoading10 = "⠏", - -- }, }, }, - -- { - -- "wtfox/jellybeans.nvim", - -- enabled = true, - -- opts = { - -- ---@type 'dark'|'light' - -- style = "dark", - -- transparent = true, - -- }, - -- }, + { + "vague2k/vague.nvim", + opts = { transparent = false }, + }, } diff --git a/.config/nvim-astro/lua/plugins/multi-cursors.lua b/.config/nvim-astro/lua/plugins/multi-cursors.lua new file mode 100644 index 0000000..a5338d1 --- /dev/null +++ b/.config/nvim-astro/lua/plugins/multi-cursors.lua @@ -0,0 +1,65 @@ +---@type LazySpec +return { + { + "mg979/vim-visual-multi", + branch = "master", + version = false, + enabled = false, + init = function() + vim.g.VM_maps = {} + vim.g.VM_mouse_mappings = 1 + vim.g.VM_maps = { + ["Find Under"] = "", + ["Find Subword Under"] = "", + ["Skip Region"] = "", + ["Select All"] = "", + ["Start Regex Search"] = "\\/", + } + end, + keys = { { "", mode = { "n", "v" } }, { "", mode = { "n", "v" } } }, + }, + { + "jake-stewart/multicursor.nvim", + branch = "1.0", + opts = {}, + keys = function() + local mc = require "multicursor-nvim" + return { + { "mj", function() mc.lineAddCursor(1) end, desc = "add cursor dowm", mode = { "n", "x" } }, + { "mk", function() mc.lineAddCursor(-1) end, desc = "add cursor up", mode = { "n", "x" } }, + { "mJ", function() mc.lineSkipCursor(1) end, desc = "skip cursor down", mode = { "n", "x" } }, + { "mK", function() mc.lineSkipCursor(-1) end, desc = "skip cursor up", mode = { "n", "x" } }, + { "mn", function() mc.matchAddCursor(1) end, desc = "add cursor to next match", mode = { "n", "x" } }, + { "mp", function() mc.matchAddCursor(-1) end, desc = "add cursor to prev match", mode = { "n", "x" } }, + { "mN", function() mc.matchSkipCursor(1) end, desc = "skip cursor to next match", mode = { "n", "x" } }, + { + "mP", + function() mc.matchSkipCursor(-1) end, + desc = "skip cursor to prev match", + mode = { "n", "x" }, + }, + { "ma", mc.matchAllAddCursors, desc = "all matches", mode = { "n", "x" } }, + { "", mc.handleMouse, desc = "multicursor using mouse" }, + { "mt", mc.toggleCursor, desc = "toggle cursor" }, + { "mh", mc.prevCursor, desc = "goto prev cursor" }, + { "ml", mc.nextCursor, desc = "goto next cursor" }, + { "md", mc.deleteCursor, desc = "delete cursor" }, + { + "", + function() + if not mc.cursorsEnabled() then + mc.enableCursors() + elseif mc.hasCursors() then + mc.clearCursors() + else + vim.cmd "nohl" + return "" + end + end, + desc = "Escape cursor, No-Highlight", + expr = true, + }, + } + end, + }, +} diff --git a/.config/nvim-astro/lua/plugins/session.lua b/.config/nvim-astro/lua/plugins/session.lua index 96113f2..6036a02 100644 --- a/.config/nvim-astro/lua/plugins/session.lua +++ b/.config/nvim-astro/lua/plugins/session.lua @@ -1,8 +1,10 @@ -- function for calculating the current session name local get_session_name = function() local name = vim.fn.getcwd() - local branch = vim.fn.system "git branch --show-current" - if vim.v.shell_error == 0 then + -- local branch = vim.fn.system "git branch --show-current" + local branch = vim.b.gitsigns_head + if branch == nil then branch = vim.fn.system "git branch --show-current" end + if branch ~= nil or vim.v.shell_error == 0 then return name .. vim.trim(branch --[[@as string]]) else return name @@ -52,10 +54,33 @@ return { desc = "Restore previous directory session if neovim opened with no arguments", nested = true, -- trigger other autocommands as buffers open callback = function() - -- Only load the session if nvim was started with no args - if vim.fn.argc(-1) == 0 then - -- try to load a directory session using the current working directory - require("resession").load(get_session_name(), { dir = "dirsession", silence_errors = true }) + -- Logic copied from https://github.com/AstroNvim/AstroNvim/blob/365aa6e083dcd25fa3d1c8a2515d7e71a03d51d3/lua/astronvim/plugins/alpha.lua#L49 + local should_skip + local lines = vim.api.nvim_buf_get_lines(0, 0, 2, false) + if + vim.fn.argc() > 0 -- don't start when opening a file + or #lines > 1 -- don't open if current buffer has more than 1 line + or (#lines == 1 and lines[1]:len() > 0) -- don't open the current buffer if it has anything on the first line + or #vim.tbl_filter(function(bufnr) return vim.bo[bufnr].buflisted end, vim.api.nvim_list_bufs()) > 1 -- don't open if any listed buffers + or not vim.o.modifiable -- don't open if not modifiable + then + should_skip = true + else + for _, arg in pairs(vim.v.argv) do + if arg == "-b" or arg == "-c" or vim.startswith(arg, "+") or arg == "-S" then + should_skip = true + break + end + end + end + if should_skip then return end + -- if possible, load session + if not pcall(function() require("resession").load(get_session_name(), { dir = "dirsession" }) end) then + -- if session was not loaded, if possible, load alpha + require("lazy").load { plugins = { "alpha-nvim" } } + if pcall(function() require("alpha").start(true) end) then + vim.schedule(function() vim.cmd.doautocmd "FileType" end) + end end end, }, diff --git a/.config/nvim-astro/lua/plugins/snacks.lua b/.config/nvim-astro/lua/plugins/snacks.lua index bb7a0d7..a82925a 100644 --- a/.config/nvim-astro/lua/plugins/snacks.lua +++ b/.config/nvim-astro/lua/plugins/snacks.lua @@ -67,7 +67,7 @@ return { }, keys = { { - "", + "gn", function() Snacks.lazygit() end, desc = "Toggle Lazygit", }, @@ -78,7 +78,13 @@ return { }, { "", - function() Snacks.picker.files { layout = { preset = "vscode" } } end, + function() + if vim.b.gitsigns_head or vim.b.gitsigns_head then + Snacks.picker.git_files { layout = { preset = "vscode" } } + else + Snacks.picker.files { layout = { preset = "vscode" } } + end + end, desc = "Find Files", }, { @@ -110,7 +116,7 @@ return { }, { "fg", - function() Snacks.picker.git_files { layout = { preset = "vscode" } } end, + function() Snacks.picker.git_files { untracked = true, layout = { preset = "vscode" } } end, desc = "Find Git Files", }, { diff --git a/.config/nvim/lua/user/plugins/theme.lua b/.config/nvim/lua/user/plugins/theme.lua index 64ab22e..b6494eb 100644 --- a/.config/nvim/lua/user/plugins/theme.lua +++ b/.config/nvim/lua/user/plugins/theme.lua @@ -52,14 +52,30 @@ return { }, { 'vague2k/vague.nvim', - branch = '1.3', enabled = false, priority = 1000, opts = { transparent = false }, config = function(_, opts) - require('vague').setup(opts) + local vague = require 'vague' + vague.setup(opts) + local palette = vague.get_palette() + vim.cmd.colorscheme 'vague' vim.api.nvim_set_hl(0, 'StatusLine', { bg = '#181818' }) + + vim.api.nvim_set_hl(0, '@tag.attribute', { bg = palette.property }) + vim.api.nvim_set_hl(0, 'WinBar', { bg = palette.bg }) + vim.api.nvim_set_hl(0, 'SnacksPickerMatch', { fg = palette.delta }) + vim.api.nvim_set_hl( + 0, + 'QuickScopePrimary', + { fg = palette.delta, bg = palette.visual, bold = true, undercurl = true } + ) + vim.api.nvim_set_hl( + 0, + 'QuickScopeSecondary', + { fg = palette.hint, bg = palette.visual, bold = true, undercurl = true } + ) end, }, {