diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index 33046ff..9d5a674 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -5,9 +5,8 @@ -- -------------------------------- Commands ----------------------------------- -- Make :Q close all of the buffers vim.api.nvim_create_user_command("Q", function() - vim.cmd.bdelete() vim.cmd.qall() -end, { force = true }) +end, { force = true, desc = "Close all buffers" }) -- Yank line without leading/trailing whitespace vim.api.nvim_create_user_command("YankLine", function() @@ -22,6 +21,12 @@ vim.api.nvim_create_user_command("RestoreColorscheme", function() ) end, { force = true }) +-- Load/start Remote +vim.api.nvim_create_user_command("LoadRemote", function() + require("remote-nvim").setup() + vim.cmd("RemoteStart") +end, { force = true, desc = "Load/start Remote" }) + -- ------------------------------ Auto-Commands -------------------------------- -- Autosave Colorscheme -- When the colorscheme changes, store the name in .colorscheme @@ -36,6 +41,30 @@ vim.api.nvim_create_autocmd("ColorScheme", { end, }) +-- Define cursor color/icon based on mode +local autocmd = vim.api.nvim_create_autocmd +autocmd({ "ModeChanged", "BufEnter" }, { + callback = function() + local current_mode = vim.fn.mode() + if current_mode == "n" then + vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#8aa8f3" }) + vim.fn.sign_define("smoothcursor", { text = "" }) + elseif current_mode == "v" then + vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#d298eb" }) + vim.fn.sign_define("smoothcursor", { text = "" }) + elseif current_mode == "V" then + vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#d298eb" }) + vim.fn.sign_define("smoothcursor", { text = "" }) + elseif current_mode == "�" then + vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#bf616a" }) + vim.fn.sign_define("smoothcursor", { text = "" }) + elseif current_mode == "i" then + vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#9bd482" }) + vim.fn.sign_define("smoothcursor", { text = "" }) + end + end, +}) + -- GIT CONFLICT MARKERS -- if there are conflicts, jump to first conflict, highlight conflict markers, -- and disable diagnostics (simplified version of `git-conflict.nvim`) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 48c4735..dbc2660 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -45,7 +45,9 @@ wk.add({ }, { "gS", - "LazyGit", + rhs = function() + require("lazygit").lazygit() + end, desc = "LazyGit", }, { @@ -196,7 +198,9 @@ wk.add({ }, { "wt", - "TransparentToggle", + rhs = function() + require("transparent").toggle() + end, desc = "Toggle Transparency", }, { @@ -220,7 +224,21 @@ wk.add({ end, desc = "Toggle Hardmode", }, + { -- Toggle ZenMode + "z", + rhs = function() + require("zen-mode").toggle() + end, + desc = "Toggle ZenMode", + }, }) +-- Substitute +-- Define substitue mappings +vim.keymap.set("n", "x", require("substitute").operator, { noremap = true }) +vim.keymap.set("n", "xx", require("substitute").line, { noremap = true }) +vim.keymap.set("n", "X", require("substitute").eol, { noremap = true }) +vim.keymap.set("x", "x", require("substitute").visual, { noremap = true }) + -- ---------------------------- Spell Correction ------------------------------- require("config.spellcheck") diff --git a/lua/config/options.lua b/lua/config/options.lua index c8e2aa3..371235c 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -18,6 +18,11 @@ STORED_THEME = vim.fn.readfile(vim.fn.stdpath("config") .. "/.colorscheme")[1] vim.g.loaded_perl_provider = 0 vim.g.lazyvim_python_lsp = "basedpyright" +-- ----------------------------------- FOLDS -------------------------------------- +vim.opt.foldmethod = "expr" +vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" +vim.opt.foldlevelstart = 99 -- load buffers with folds open + -- ------------------------------- CLIENT APPS --------------------------------- if vim.g.neovide then -- ----------------------- Neovide ------------------------- diff --git a/lua/config/ui.lua b/lua/config/ui.lua index 3ae70bf..a5d6f3c 100644 --- a/lua/config/ui.lua +++ b/lua/config/ui.lua @@ -11,7 +11,7 @@ return { }, { -- Transparent "xiyaowong/transparent.nvim", - event = "VeryLazy", + lazy = true, config = true, }, { -- Auto Dark Mode @@ -117,8 +117,4 @@ return { require("hlchunk").setup(common_config) end, }, - { -- Alternate - "ton/vim-alternate", - event = "VeryLazy", - }, } diff --git a/lua/plugins/coding.lua b/lua/plugins/coding.lua index 5fe1497..0e34d13 100644 --- a/lua/plugins/coding.lua +++ b/lua/plugins/coding.lua @@ -67,7 +67,11 @@ return { require("mini.align").setup() end, }, - { -- Emoji completion + { -- Alternate + "ton/vim-alternate", + ft = { "cpp", "h", "hpp", "c" }, + }, + { -- Completion "hrsh7th/nvim-cmp", ---@param opts cmp.ConfigSchema opts = function(_, opts) @@ -122,9 +126,6 @@ return { opts = { yank_substituted_text = false, preserve_cursor_position = true, - highlight_substituted_text = { - enabled = false, - }, }, }, } diff --git a/lua/plugins/dashboard.lua b/lua/plugins/dashboard.lua index beb0968..bdb737f 100644 --- a/lua/plugins/dashboard.lua +++ b/lua/plugins/dashboard.lua @@ -53,7 +53,7 @@ return { -- Dashboard { action = "LazyGit", desc = " LazyGit", icon = " ", key = "G" }, { action = 'lua LazyVim.pick.config_files()()', desc = " Config", icon = " ", key = "c" }, { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, - { action = 'RemoteStart', desc = " Remote Session", icon = "󰢹 ", key = "S" }, + { action = 'LoadRemote', desc = " Remote Session", icon = "󰢹 ", key = "S" }, { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, { action = function() vim.api.nvim_input("qa") end, desc = " Quit", icon = " ", key = "q" }, diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 4c6aec0..c9049ad 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -12,8 +12,15 @@ return { { -- Illuminate import = "lazyvim.plugins.extras.editor.illuminate", }, - { -- Leap - import = "lazyvim.plugins.extras.editor.leap", + { + "folke/flash.nvim", + opts = { + modes = { + char = { + jump_labels = true, + }, + }, + }, }, { -- Outline import = "lazyvim.plugins.extras.editor.outline", @@ -21,6 +28,35 @@ return { { -- Telescope import = "lazyvim.plugins.extras.editor.telescope", }, + { -- FoldNav + "domharries/foldnav.nvim", + keys = { + { + "", + function() + require("foldnav").goto_start() + end, + }, + { + "", + function() + require("foldnav").goto_next() + end, + }, + { + "", + function() + require("foldnav").goto_prev_start() + end, + }, + { + "", + function() + require("foldnav").goto_end() + end, + }, + }, + }, { -- Which-Key "folke/which-key.nvim", opts = { @@ -69,7 +105,7 @@ return { }, { -- Remote-nvim "amitds1997/remote-nvim.nvim", - event = "VeryLazy", + lazy = true, version = "*", -- Pin to GitHub releases dependencies = { "nvim-lua/plenary.nvim", -- For standard functions @@ -80,7 +116,7 @@ return { }, { -- DeadColumn "Bekaboo/deadcolumn.nvim", - event = "VeryLazy", + event = "InsertEnter", config = function() require("deadcolumn").setup({ scope = "line", ---@type string|fun(): integer @@ -109,11 +145,13 @@ return { }, { -- Precognition "tris203/precognition.nvim", - event = "VeryLazy", + lazy = true, + opts = {}, }, { -- Zen Mode "folke/zen-mode.nvim", - event = "VeryLazy", + --event = "VeryLazy", + lazy = true, opts = {}, }, { -- SmoothCursor @@ -127,7 +165,7 @@ return { texthl = "SmoothCursor", fancy = { enable = true, -- enable fancy mode - head = { cursor = "", texthl = nil, linehl = nil }, + head = { cursor = "" }, body = {}, tail = { false }, -- false to disable fancy tail }, @@ -137,7 +175,6 @@ return { texthl = { "SmoothCursor", }, - linehl = nil, -- No line highlight for the head }, body = { length = 6, -- Specifies the length of the cursor body @@ -147,7 +184,6 @@ return { }, }, tail = { - cursor = nil, texthl = { "SmoothCursor", }, @@ -156,7 +192,7 @@ return { }, autostart = true, -- Automatically start SmoothCursor always_redraw = true, -- Redraw the screen on each update - flyin_effect = nil, -- Choose "bottom" or "top" for flying effect + flyin_effect = "bottom", -- Choose "bottom" or "top" for flying effect speed = 25, -- Max speed is 100 to stick with your current position intervals = 35, -- Update intervals in milliseconds priority = 10, -- Set marker priority @@ -164,32 +200,6 @@ return { threshold = 3, -- Animate only if cursor moves more than this many lines max_threshold = 2000, -- If you move more than this many lines, don't animate (if `nil`, deactivate check) disable_float_win = false, -- Disable in floating windows - enabled_filetypes = nil, -- Enable only for specific file types, e.g., { "lua", "vim" } - disabled_filetypes = nil, -- Disable for these file types - show_last_positions = nil, - }) - -- Define cursor color/icon based on mode - local autocmd = vim.api.nvim_create_autocmd - autocmd({ "ModeChanged", "BufEnter" }, { - callback = function() - local current_mode = vim.fn.mode() - if current_mode == "n" then - vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#8aa8f3" }) - vim.fn.sign_define("smoothcursor", { text = "" }) - elseif current_mode == "v" then - vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#d298eb" }) - vim.fn.sign_define("smoothcursor", { text = "" }) - elseif current_mode == "V" then - vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#d298eb" }) - vim.fn.sign_define("smoothcursor", { text = "" }) - elseif current_mode == "�" then - vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#bf616a" }) - vim.fn.sign_define("smoothcursor", { text = "" }) - elseif current_mode == "i" then - vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#9bd482" }) - vim.fn.sign_define("smoothcursor", { text = "" }) - end - end, }) -- Define last cursor position icon vim.fn.sign_define("smoothcursor_n", { text = "" }) diff --git a/lua/plugins/util.lua b/lua/plugins/util.lua index 799eb29..cd64e00 100644 --- a/lua/plugins/util.lua +++ b/lua/plugins/util.lua @@ -32,6 +32,7 @@ return { }, { -- Link following "chrishrb/gx.nvim", + event = "VeryLazy", cmd = { "Browse" }, init = function() vim.g.netrw_nogx = 1 @@ -41,21 +42,23 @@ return { }, { -- Auto-save "Pocco81/auto-save.nvim", + event = "InsertEnter", config = function() require("auto-save").setup({}) end, }, { -- User is bored "mikesmithgh/ugbi", - event = "VeryLazy", + event = "InsertEnter", }, { -- Ripgrep substitute "chrisgrieser/nvim-rip-substitute", + event = "InsertEnter", cmd = "RipSubstitute", }, { -- Gist Tools "Rawnly/gist.nvim", - event = "VeryLazy", + event = "InsertEnter", cmd = { "GistCreate", "GistCreateFromFile", "GistsList" }, config = true, }, @@ -114,6 +117,7 @@ return { }, { -- Thanks/github-stars "jsongerber/thanks.nvim", + event = "VeryLazy", config = { star_on_install = false, }, @@ -134,6 +138,7 @@ return { }, { -- GitLinker "linrongbin16/gitlinker.nvim", + lazy = true, cmd = "GitLink", opts = {}, keys = {