From 03dfe60cc8dc51612ffae1809e7eb54b1a754134 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Tue, 23 Jan 2024 19:31:15 +0545 Subject: [PATCH] feat(nvim): I didn't remember --- config/nvim/after/ftplugin/markdown.lua | 4 +-- config/nvim/lazy-lock.json | 16 ++++----- config/nvim/lazyvim.json | 2 +- config/nvim/lua/config/keymaps.lua | 20 +++++++---- config/nvim/lua/config/options.lua | 16 ++++----- .../lua/plugins/extras/editor/compiler.lua | 11 ------ .../plugins/extras/editor/docs/obsidian.lua | 17 ++++++++- .../lua/plugins/extras/ui/import-cost.lua | 2 +- .../lua/plugins/extras/util/dot-extended.lua | 35 ------------------- .../nvim/lua/plugins/extras/util/vscode.lua | 17 ++++++--- config/nvim/lua/plugins/gitsigns.lua | 4 +-- 11 files changed, 64 insertions(+), 80 deletions(-) delete mode 100644 config/nvim/lua/plugins/extras/util/dot-extended.lua diff --git a/config/nvim/after/ftplugin/markdown.lua b/config/nvim/after/ftplugin/markdown.lua index 17d8911a..cbe31702 100644 --- a/config/nvim/after/ftplugin/markdown.lua +++ b/config/nvim/after/ftplugin/markdown.lua @@ -1,2 +1,2 @@ -vim.keymap.set({ "n", "x" }, "", [[/^#\+ .*]], { desc = "Next Heading", buffer = true }) -vim.keymap.set({ "n", "x" }, "", [[?^#\+ .*]], { desc = "Prev Heading", buffer = true }) +vim.keymap.set({ "n", "x" }, "]#", [[/^#\+ .*]], { desc = "Next Heading", buffer = true }) +vim.keymap.set({ "n", "x" }, "[#", [[?^#\+ .*]], { desc = "Prev Heading", buffer = true }) diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index 6c43586b..208fcde1 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -7,7 +7,7 @@ "autolist.nvim": { "branch": "main", "commit": "5f70a5f99e96c8fe3069de042abd2a8ed2deb855" }, "bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" }, "bufferline.nvim": { "branch": "main", "commit": "167c0b8c5340972a249068c1a5b3edf57806d6d3" }, - "catppuccin": { "branch": "main", "commit": "048c18fc531703815f5e10765ea46ce9b2c75ae4" }, + "catppuccin": { "branch": "main", "commit": "bc1f2151f23227ba02ac203c2c59ad693352a741" }, "ccc.nvim": { "branch": "main", "commit": "ec6e23fd2c0bf4ffcf71c1271acdcee6e2c6f49c" }, "cinnamon.nvim": { "branch": "master", "commit": "c406ffda3a0302f32c23b24ab756ea20467d6578" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -20,7 +20,7 @@ "comment-box.nvim": { "branch": "main", "commit": "612d8d546470699d4c7991139883a390d49cf589" }, "compiler.nvim": { "branch": "main", "commit": "4a44a63b2d5bad828d1a29a28a2a9a04119e01a8" }, "conform.nvim": { "branch": "master", "commit": "3d59cbd01a4b74124c5a6fb23b8cc63e5c2db3d5" }, - "crates.nvim": { "branch": "main", "commit": "0737f687ca15e45cc0cc3b28a79a545c63f2ad68" }, + "crates.nvim": { "branch": "main", "commit": "e4e5d141812c9e84992e329fb4526ca2656c03f2" }, "dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" }, "debugprint.nvim": { "branch": "main", "commit": "0c81cd2bab372bba99815f505eb1fe759d38dd88" }, "dial.nvim": { "branch": "master", "commit": "27eb570085db2ef44bff4f620d3806039184651c" }, @@ -64,7 +64,7 @@ "multicursors.nvim": { "branch": "main", "commit": "8e876fe9db46c1b76c151202b418df21eca07bad" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "2f2d08894bbc679d4d181604c16bb7079f646384" }, "neoconf.nvim": { "branch": "main", "commit": "cfc29315288515849aa54c05828d49f01f033b66" }, - "neodev.nvim": { "branch": "main", "commit": "5bbbeda6a9c672f314c95ca47a8b495cf6de17f9" }, + "neodev.nvim": { "branch": "main", "commit": "3941036e3da9b0dc09244036d20c590b6d752175" }, "neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" }, "neotest": { "branch": "master", "commit": "dcdb40ea48f9c7b67a5576f6bb2e5f63ec15f2c0" }, "neotest-bash": { "branch": "main", "commit": "2eaad2ae4577fadf4af1eec32ec169d0fb2698bb" }, @@ -99,7 +99,7 @@ "nvim-regexplainer": { "branch": "main", "commit": "78fff711edcb986a05a03253c28a90e32c4ce31f" }, "nvim-scissors": { "branch": "main", "commit": "63d05e732d1403fcd7c7e1fb6b55763adcd08b64" }, "nvim-spectre": { "branch": "master", "commit": "d8906855f1949ac97b1e77aaf8d3fe12ed158ddc" }, - "nvim-treesitter": { "branch": "master", "commit": "cd4e0909948eb33d3959e133c16f837e4db122c6" }, + "nvim-treesitter": { "branch": "master", "commit": "ab2346439333653b31672daa0b7d29184ff4493b" }, "nvim-treesitter-context": { "branch": "master", "commit": "85cf977181fb8e816e47ac05df7f756e9cb72caf" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "4c344ffc8d54d7e1ba2cefaaa2c10ea93aa1cc2d" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" }, @@ -120,10 +120,10 @@ "plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "promise-async": { "branch": "main", "commit": "94f6f03c6c1e2aab551aacdf0c1e597a7269abb6" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "a5077cb6144fe46bc8b5002c52bb75a17369e44b" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "35530b4ad48f01bdaa852da34e4de9930fb54c89" }, "refactoring.nvim": { "branch": "master", "commit": "f4546284059f7dc01f65be93d03f6c850fd2aba1" }, "rest.nvim": { "branch": "main", "commit": "84e81a19ab24ccf05c9233d34d4dfce61c233abe" }, - "rustaceanvim": { "branch": "master", "commit": "a095a1f9397310d108ead239edc068b2624695b6" }, + "rustaceanvim": { "branch": "master", "commit": "94dbc3479630b79f1fc05bad91dfeede50b9036c" }, "satellite.nvim": { "branch": "main", "commit": "99610b77fe2e047d2e55d70a256bcf63953eb6d7" }, "search-replace.nvim": { "branch": "main", "commit": "d92290a02d97f4e9b8cd60d28b56b403432158d5" }, "semshi": { "branch": "master", "commit": "0182447e2ff4dfa04cd2dfe5f189e012c581ca45" }, @@ -143,7 +143,7 @@ "telescope-luasnip.nvim": { "branch": "master", "commit": "2ef7da3a363890686dbaad18ddbf59177cfe4f78" }, "telescope-undo.nvim": { "branch": "main", "commit": "d3afc1c105535a90caec092ce27a113f77ba7b84" }, "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" }, - "telescope.nvim": { "branch": "master", "commit": "20efb3864903fb854a85faf57513ffd80582275b" }, + "telescope.nvim": { "branch": "master", "commit": "36dce6261ae3660bb57ba942361067b2028aec31" }, "text-case.nvim": { "branch": "main", "commit": "6bc91cde614bbec6f0befbaf7fcd302415d803fb" }, "theme-loader.nvim": { "branch": "master", "commit": "ad8774ec8267a447d469b4e6603b43f49b946e53" }, "todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, @@ -170,4 +170,4 @@ "windows.nvim": { "branch": "main", "commit": "c7492552b23d0ab30325e90b56066ec51242adc8" }, "yanky.nvim": { "branch": "main", "commit": "6bb9ffd3cad4c9876bda54e19d0659de28a4f84f" }, "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" } -} +} \ No newline at end of file diff --git a/config/nvim/lazyvim.json b/config/nvim/lazyvim.json index 3eba0da2..1fdbbc3e 100644 --- a/config/nvim/lazyvim.json +++ b/config/nvim/lazyvim.json @@ -3,6 +3,7 @@ "lazyvim.plugins.extras.lang.python-semshi", "lazyvim.plugins.extras.lang.yaml", "lazyvim.plugins.extras.ui.edgy", + "lazyvim.plugins.extras.util.dot", "plugins.extras.coding.ai.codeium", "plugins.extras.coding.ai.gpt", "plugins.extras.coding.annotation", @@ -94,7 +95,6 @@ "plugins.extras.ui.zen-mode", "plugins.extras.util.bigfile", "plugins.extras.util.discordrcp", - "plugins.extras.util.dot-extended", "plugins.extras.util.icon-picker", "plugins.extras.util.kitty-scrollback", "plugins.extras.util.neovide", diff --git a/config/nvim/lua/config/keymaps.lua b/config/nvim/lua/config/keymaps.lua index bab79304..1ad862ca 100644 --- a/config/nvim/lua/config/keymaps.lua +++ b/config/nvim/lua/config/keymaps.lua @@ -2,6 +2,7 @@ -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua -- Add any additional keymaps here local map = vim.keymap.set +local o = vim.opt local Util = require("lazyvim.util") @@ -21,10 +22,6 @@ map("n", "lc", function() Util.news.changelog() end, { desc = "LazyVim C -- stylua: ignore end map("n", "L", "") --- Toggle background --- stylua: ignore -map("n", "uB", function() Util.toggle("background", false, { "light", "dark" }) end, { desc = "Toggle Background" }) - -- Identation map("n", "<", "<<", { desc = "Deindent" }) map("n", ">", ">>", { desc = "Indent" }) @@ -65,13 +62,22 @@ map("n", "N", "Nzzzv") -- Toggle statusline map("n", "uS", function() - if vim.opt.laststatus:get() == 0 then - vim.opt.laststatus = 3 + if o.laststatus:get() == 0 then + o.laststatus = 3 else - vim.opt.laststatus = 0 + o.laststatus = 0 end end, { desc = "Toggle Statusline" }) +-- Toggle tabline +map("n", "u", function() + if o.showtabline:get() == 0 then + o.showtabline = 2 + else + o.showtabline = 0 + end +end, { desc = "Toggle Tabline" }) + -- Plugin Info map("n", "cif", "LazyFormatInfo", { desc = "Formatting" }) map("n", "cic", "ConformInfo", { desc = "Conform" }) diff --git a/config/nvim/lua/config/options.lua b/config/nvim/lua/config/options.lua index 20f0e67e..91e576a6 100644 --- a/config/nvim/lua/config/options.lua +++ b/config/nvim/lua/config/options.lua @@ -1,22 +1,22 @@ -- Options are automatically loaded before lazy.nvim startup -- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua -- Add any additional options here -local opt = vim.g +local o = vim.g -- Optimizations on startup vim.loader.enable() -- Define leader key -opt.mapleader = " " -opt.maplocalleader = "\\" +o.mapleader = " " +o.maplocalleader = "\\" -- Autoformat on save (Global) -opt.autoformat = true +o.autoformat = true -- Font -opt.gui_font_default_size = 10 -opt.gui_font_size = opt.gui_font_default_size -opt.gui_font_face = "JetBrainsMono Nerd Font" +o.gui_font_default_size = 10 +o.gui_font_size = o.gui_font_default_size +o.gui_font_face = "JetBrainsMono Nerd Font" -- Enable EditorConfig integration -opt.editorconfig = true +o.editorconfig = true diff --git a/config/nvim/lua/plugins/extras/editor/compiler.lua b/config/nvim/lua/plugins/extras/editor/compiler.lua index a1b9df13..59092b42 100644 --- a/config/nvim/lua/plugins/extras/editor/compiler.lua +++ b/config/nvim/lua/plugins/extras/editor/compiler.lua @@ -6,9 +6,6 @@ return { opts = {}, -- stylua: ignore keys = { - { "ccc", "CompilerOpen", desc = "Open Compiler" }, - { "ccR", function() vim.cmd("CompilerStop") vim.cmd("CompilerRedo") end, desc = "Redo Compiler" }, - { "ccr", "CompilerToggleResults", desc = "Toggle Compiler Results" }, { "", "CompilerOpen", desc = "Open Compiler" }, { "", function() vim.cmd("CompilerStop") vim.cmd("CompilerRedo") end, desc = "Redo Compiler" }, { "", "CompilerToggleResults", desc = "Toggle Compiler Results" }, @@ -40,12 +37,4 @@ return { }, }, }, - { - "folke/which-key.nvim", - opts = { - defaults = { - ["cc"] = { name = "compiler" }, - }, - }, - }, } diff --git a/config/nvim/lua/plugins/extras/editor/docs/obsidian.lua b/config/nvim/lua/plugins/extras/editor/docs/obsidian.lua index 8751cfef..f1243320 100644 --- a/config/nvim/lua/plugins/extras/editor/docs/obsidian.lua +++ b/config/nvim/lua/plugins/extras/editor/docs/obsidian.lua @@ -34,7 +34,22 @@ return { template = "_data_/templates/journal/daily_entry.md", }, - mappings = {}, + mappings = { + -- Overrides the 'gf' mapping to work on markdown/wiki links within your vault. + ["gf"] = { + action = function() + return require("obsidian").util.gf_passthrough() + end, + opts = { noremap = false, expr = true, buffer = true }, + }, + -- Toggle check-boxes. + [""] = { + action = function() + return require("obsidian").util.toggle_checkbox() + end, + opts = { buffer = true }, + }, + }, templates = { subdir = "_data_/templates", diff --git a/config/nvim/lua/plugins/extras/ui/import-cost.lua b/config/nvim/lua/plugins/extras/ui/import-cost.lua index 350d612c..49250051 100644 --- a/config/nvim/lua/plugins/extras/ui/import-cost.lua +++ b/config/nvim/lua/plugins/extras/ui/import-cost.lua @@ -1,6 +1,6 @@ return { "barrett-ruth/import-cost.nvim", - build = "sh install.sh yarn", + build = "sh install.sh npm", event = "LazyFile", config = true, } diff --git a/config/nvim/lua/plugins/extras/util/dot-extended.lua b/config/nvim/lua/plugins/extras/util/dot-extended.lua deleted file mode 100644 index 391a60c7..00000000 --- a/config/nvim/lua/plugins/extras/util/dot-extended.lua +++ /dev/null @@ -1,35 +0,0 @@ ----@type string -local xdg_config = vim.env.XDG_CONFIG_HOME or vim.env.HOME .. "/.config" - ----@param path string -local function have(path) - return vim.loop.fs_stat(xdg_config .. "/" .. path) ~= nil -end - -return { - { - import = "lazyvim.plugins.extras.util.dot", - }, - { - "luckasRanarison/tree-sitter-hypr", - enabled = false, - }, - { - "luckasRanarison/tree-sitter-hyprlang", - dependencies = { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - if have("hypr") then - if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "hyprlang" }) - end - end - end, - }, - enabled = function() - return have("hypr") - end, - event = "BufRead */hypr/*.conf", - build = ":TSUpdate hyprlang", - }, -} diff --git a/config/nvim/lua/plugins/extras/util/vscode.lua b/config/nvim/lua/plugins/extras/util/vscode.lua index c42adfef..e8c6f3be 100644 --- a/config/nvim/lua/plugins/extras/util/vscode.lua +++ b/config/nvim/lua/plugins/extras/util/vscode.lua @@ -40,6 +40,7 @@ Config.options.defaults.cond = function(plugin) end vim.o.spell = false +vim.opt.timeoutlen = 0 -- To show whichkey without delay vim.notify = vscode.notify vim.g.clipboard = vim.g.vscode_clipboard @@ -53,10 +54,6 @@ end vim.api.nvim_create_autocmd("User", { pattern = "LazyVimKeymaps", callback = function() - -- find file - map("n", "", "Find") - -- find in files - map("n", "/", vscode_action("workbench.action.findInFiles")) -- view problems map("n", "xx", vscode_action("workbench.actions.view.problems")) -- open file explorer @@ -76,6 +73,8 @@ vim.api.nvim_create_autocmd("User", { map("n", "H", vscode_action("workbench.action.previousEditorInGroup")) map("n", "L", vscode_action("workbench.action.nextEditorInGroup")) map("n", "bd", vscode_action("workbench.action.closeActiveEditor")) + map("n", "", vscode_action("workbench.action.showMultipleEditorTabs")) + map("n", "", vscode_action("workbench.action.showEditorTab")) -- breakpoints map("n", "", vscode_action("editor.debug.action.toggleBreakpoint")) -- windows @@ -138,6 +137,16 @@ vim.api.nvim_create_autocmd("User", { map("n", "[d", vscode_action("editor.action.marker.prev")) -- whichkey map("n", "", vscode_action("whichkey.show")) + -- search + map("n", "", "Find") + map("n", "ff", "Find") + map("n", "/", vscode_action("workbench.action.findInFiles")) + map("n", "sg", vscode_action("workbench.action.findInFiles")) + map("n", "sc", vscode_action("workbench.action.showCommands")) + -- format + map("n", "cf", vscode_action("editor.action.formatDocument")) + -- ui + map("n", "uC", vscode_action("workbench.action.selectTheme")) end, }) diff --git a/config/nvim/lua/plugins/gitsigns.lua b/config/nvim/lua/plugins/gitsigns.lua index 415aa258..7cb2fe0d 100644 --- a/config/nvim/lua/plugins/gitsigns.lua +++ b/config/nvim/lua/plugins/gitsigns.lua @@ -11,7 +11,7 @@ return { }, keys = { -- stylua: ignore - { "ub", "Gitsigns toggle_current_line_blame", desc = "Toggle Line Blame" }, - { "ghd", "Gitsigns toggle_deleted", desc = "Deletions Inline" }, + { "uB", "Gitsigns toggle_current_line_blame", desc = "Toggle Line Blame" }, + { "ghe", "Gitsigns toggle_deleted", desc = "Deletions Inline" }, }, }