From 9b9a83baedff5c126f920611e93801a03bbfe28b Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Mon, 1 Apr 2024 20:57:22 +0545 Subject: [PATCH] . --- config/nvim/dotfyle.json | 56 ------------------- config/nvim/lazy-lock.json | 21 +++---- config/nvim/lazyvim.json | 7 ++- config/nvim/lua/config/keymaps.lua | 31 +++++++--- .../lua/plugins/extras/coding/recorder.lua | 2 +- .../{jason-extended.lua => json-extended.lua} | 0 .../lua/plugins/extras/lang/yaml-extended.lua | 37 ++++++++++++ 7 files changed, 76 insertions(+), 78 deletions(-) rename config/nvim/lua/plugins/extras/lang/{jason-extended.lua => json-extended.lua} (100%) create mode 100644 config/nvim/lua/plugins/extras/lang/yaml-extended.lua diff --git a/config/nvim/dotfyle.json b/config/nvim/dotfyle.json index 113d2a04..2882dd26 100644 --- a/config/nvim/dotfyle.json +++ b/config/nvim/dotfyle.json @@ -332,48 +332,6 @@ "mode": "n", "rhs": "" }, - { - "desc": "LazyVim Changelog", - "noremap": true, - "lhs": "lc", - "mode": "n", - "rhs": "" - }, - { - "desc": "Extras", - "noremap": true, - "lhs": "lx", - "mode": "n", - "rhs": "LazyExtras" - }, - { - "desc": "LazyVim Repo", - "noremap": true, - "lhs": "lr", - "mode": "n", - "rhs": "" - }, - { - "desc": "LazyVim Docs", - "noremap": true, - "lhs": "ld", - "mode": "n", - "rhs": "" - }, - { - "desc": "Lazy", - "noremap": true, - "lhs": "ll", - "mode": "n", - "rhs": "Lazy" - }, - { - "desc": "Search current word on brave search", - "noremap": true, - "lhs": "?", - "mode": "n", - "rhs": "" - }, { "desc": "Previous Tab", "noremap": true, @@ -2061,13 +2019,6 @@ "mode": "n", "rhs": "" }, - { - "desc": "Open Yank History", - "noremap": true, - "lhs": "p", - "mode": "n", - "rhs": "" - }, { "desc": "Yank History", "noremap": true, @@ -2075,13 +2026,6 @@ "mode": "n", "rhs": "" }, - { - "desc": "Yank History", - "noremap": true, - "lhs": "sy", - "mode": "v", - "rhs": "" - }, { "desc": "Cmp Status", "noremap": true, diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index 680ae75c..c26de0d1 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -1,13 +1,13 @@ { "LazyVim": { "branch": "main", "commit": "5646ee5191da244ff8ea57b9dba8a7e0d1dbdd42" }, - "LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" }, + "LuaSnip": { "branch": "master", "commit": "e29ab6482ff863e8966635f5586abc3f9c6bcfac" }, "SchemaStore.nvim": { "branch": "main", "commit": "4ce271f0db8b5224b4d69a43a75c13f5b4dcba43" }, "actions-preview.nvim": { "branch": "master", "commit": "5072b1b1065a6b22bdd46b5c21780a91d6a08071" }, "autolist.nvim": { "branch": "main", "commit": "5f70a5f99e96c8fe3069de042abd2a8ed2deb855" }, "bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" }, "bufferline.nvim": { "branch": "main", "commit": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef" }, "catppuccin": { "branch": "main", "commit": "aebe43db9cb26e1c70fc5b2fd4158169c405e720" }, - "ccc.nvim": { "branch": "main", "commit": "fa0637fe6df6c6d9eaf0456f0d3c596b6b76cce1" }, + "ccc.nvim": { "branch": "main", "commit": "46b8a38a3bc287f27789800d3d26480d093d65b5" }, "cinnamon.nvim": { "branch": "master", "commit": "559fe02fae00ffd78377e9c242b2faa25a428592" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, @@ -24,11 +24,11 @@ "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" }, "edgy.nvim": { "branch": "main", "commit": "de79b7d92a5979cd71a9a1d8b6282515345e5055" }, "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, - "friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, + "friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" }, "garbage-day.nvim": { "branch": "main", "commit": "3af496f0d1dc6586dcf4ceda6bbf61a8f820ab66" }, "gitsigns.nvim": { "branch": "main", "commit": "70584ff9aae8078b64430c574079d79620b8f06d" }, - "glance.nvim": { "branch": "master", "commit": "361c4edbef84f1244e45cc0e7a46d39a873a767d" }, - "grapple.nvim": { "branch": "main", "commit": "8648afb68bbee59b06c6a66436d6a6083daa569b" }, + "glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" }, + "grapple.nvim": { "branch": "main", "commit": "261d45b5f74770e12119dfee7498752705f15114" }, "headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" }, "hydra.nvim": { "branch": "master", "commit": "55de54543d673824435930ecf533256eea2e565b" }, "icon-picker.nvim": { "branch": "master", "commit": "3ee9a0ea9feeef08ae35e40c8be6a2fa2c20f2d3" }, @@ -44,7 +44,7 @@ "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, "mini.ai": { "branch": "main", "commit": "ee9446a17c160aba6a04ff22097389c41872c878" }, "mini.bufremove": { "branch": "main", "commit": "931a3bb514147d9e812767275c4beba6b779b1d3" }, - "mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" }, + "mini.comment": { "branch": "main", "commit": "21b8c0cbf4d5117a5a46fecb61dc625c0132f093" }, "mini.indentscope": { "branch": "main", "commit": "cf07f19e718ebb0bcc5b00999083ce11c37b8d40" }, "mini.pairs": { "branch": "main", "commit": "04f58f2545ed80ac3b52dd4826e93f33e15b2af6" }, "mini.surround": { "branch": "main", "commit": "49e0364b8c9a3258b485c5ece40bb0f3a5e94b1c" }, @@ -55,20 +55,20 @@ "neogen": { "branch": "main", "commit": "0daffcec249bf42275e322361fe55b89a05ff278" }, "noice.nvim": { "branch": "main", "commit": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12" }, "nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" }, - "nvim-cmp": { "branch": "main", "commit": "b9fd19fa160490609389cd45d552896ec4264a6d" }, + "nvim-cmp": { "branch": "main", "commit": "2fb2a3cf78bbc1b0bea030e8c8728985af1cf302" }, "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" }, "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "baa5b0dc6663284cce32e0d00ac1f2511b13496f" }, "nvim-devdocs": { "branch": "master", "commit": "521d24661ffe6d1ba025debea2675c765a9c1ee1" }, - "nvim-jqx": { "branch": "master", "commit": "11b1d0368e5b23b9c356da8e5f70bb5827f27f62" }, - "nvim-lint": { "branch": "master", "commit": "2669aabb8362fdc36aced5ba864b7135636ea863" }, + "nvim-lint": { "branch": "master", "commit": "6670b3ac73fa4caf720f017b91c619e9424d955e" }, "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" }, "nvim-lspconfig": { "branch": "master", "commit": "f4619ab31fc4676001ea05ae8200846e6e7700c7" }, "nvim-nio": { "branch": "master", "commit": "33c62b3eadd8154169e42144de16ba4db6784bec" }, "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, "nvim-puppeteer": { "branch": "main", "commit": "ea340595967919222f3ba5c6c6def0787a336c82" }, + "nvim-recorder": { "branch": "main", "commit": "61531ea45819e7a2c267c191360cee9ff269fc6b" }, "nvim-spectre": { "branch": "master", "commit": "2b012554a2536465243c0dff3605b5927c49ed23" }, - "nvim-treesitter": { "branch": "master", "commit": "ff797254282b56d98849f6fa1082f3b2f99ebe43" }, + "nvim-treesitter": { "branch": "master", "commit": "30492e7e1c9e5af3642e8a74c2f88dc1f50ec305" }, "nvim-treesitter-context": { "branch": "master", "commit": "f19766163c18515fb4d3c12d572bf9cba6cdb990" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "60e8c288e011403f248b5f6478dde12bed8a6c55" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "d2a4ffc22d9d38d44edb73da007b3cf43451e9b4" }, @@ -106,5 +106,6 @@ "vim-startuptime": { "branch": "master", "commit": "ac2cccb5be617672add1f4f3c0a55ce99ba34e01" }, "vim-wakatime": { "branch": "master", "commit": "56b4d073adaf18c04c7bb5728d41c03b2f25754d" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, + "yaml-companion.nvim": { "branch": "main", "commit": "4de1e1546abc461f62dee02fcac6a02debd6eb9e" }, "yanky.nvim": { "branch": "main", "commit": "7c5cbf0122ff2dfbb6a92f14885894f65949cc8b" } } \ No newline at end of file diff --git a/config/nvim/lazyvim.json b/config/nvim/lazyvim.json index 14a8573d..892366b9 100644 --- a/config/nvim/lazyvim.json +++ b/config/nvim/lazyvim.json @@ -1,11 +1,11 @@ { "extras": [ - "lazyvim.plugins.extras.lang.yaml", "lazyvim.plugins.extras.ui.edgy", "lazyvim.plugins.extras.util.dot", "plugins.extras.coding.ai.codeium", "plugins.extras.coding.annotation", "plugins.extras.coding.multicursor", + "plugins.extras.coding.recorder", "plugins.extras.coding.refactoring", "plugins.extras.coding.treesitter.endwise", "plugins.extras.coding.treesitter.node-action", @@ -31,12 +31,13 @@ "plugins.extras.formatting.trim_newlines", "plugins.extras.formatting.trim_whitespace", "plugins.extras.lang.bash", - "plugins.extras.lang.jason-extended", + "plugins.extras.lang.json-extended", "plugins.extras.lang.markdown-extended", "plugins.extras.lang.rust-extended", "plugins.extras.lang.web.html-css", "plugins.extras.lang.web.typescript-extended", "plugins.extras.lang.web.vue", + "plugins.extras.lang.yaml-extended", "plugins.extras.lazyvim.bufferline", "plugins.extras.lazyvim.cmp", "plugins.extras.lazyvim.dashboard", @@ -73,4 +74,4 @@ "NEWS.md": "3314" }, "version": 3 -} \ No newline at end of file +} diff --git a/config/nvim/lua/config/keymaps.lua b/config/nvim/lua/config/keymaps.lua index 0b0da0c2..ed9817e1 100644 --- a/config/nvim/lua/config/keymaps.lua +++ b/config/nvim/lua/config/keymaps.lua @@ -4,11 +4,12 @@ local o = vim.opt local lazy = require("lazy") --- Search current word -local searching_brave = function() - vim.fn.system({ "xdg-open", "https://search.brave.com/search?q=" .. vim.fn.expand("") }) -end -map("n", "?", searching_brave, { noremap = true, silent = true, desc = "Search current word on brave search" }) + +-- Lazy Option +map("n", "lu", function() lazy.update() end, { desc = "Lazy Update" }) +map("n", "lC", function() lazy.check() end, { desc = "Lazy Check" }) +map("n", "ls", function() lazy.sync() end, { desc = "Lazy Sync" }) + -- return to dir map("n", "pv", vim.cmd.Ex) @@ -103,7 +104,7 @@ map("n", "", "$", { desc = "Last character of Line" }) map("v", "", '"+y', { desc = "Yank to clipboard" }) -- Duplicate paragraph -map('n', 'p', 'yapp', { desc = 'Duplicate Paragraph' }) +map('n', 'dd', 'yapp', { desc = 'Duplicate Paragraph' }) -- Motion map("c", "", "", { desc = "Start Of Line" }) @@ -149,12 +150,15 @@ map("n", "cp", "let @+ = expand(\"%:p\")", { desc = "Copy File map("n", "nd", "NoiceDismiss", {desc = "Dismiss Noice Message"}) -- Replace word under cursor across entire buffer -map("n", "r", [[:%s/\<\>//gI]], - { desc = "Replace word under cursor" }) +map('x', 'rw', '"hy:%s/h/h/gc') +map('n', 'rw', ':%s/\\<\\>//gI') -- Replace all instances of highlighted words map("v", "rr", '"hy:%s/h//g') +-- Cancel search highlighting with ESC +map({ "i", "n" }, "", "noh", { desc = "Clear hlsearch and ESC" }) + -- Dashboard map("n", "fd", function() if Util.has("alpha-nvim") then @@ -163,3 +167,14 @@ map("n", "fd", function() vim.cmd("Dashboard") end end, { desc = "Dashboard" }) + +-- search and replace +map({ "v", "n" }, "rp", ":%s/", { desc = "Buffer search and replace" }) + +-- Move to the end of yanked text after yank and paste +map('n', 'p', 'p`]') +map('x', 'y', 'y`]') +map('x', 'p', 'p`]') + +-- Select last pasted text +map('n', 'gp', "'`[' . strpart(getregtype(), 0, 1) . '`]'", { expr = true }) diff --git a/config/nvim/lua/plugins/extras/coding/recorder.lua b/config/nvim/lua/plugins/extras/coding/recorder.lua index f3c0bfab..f27d328e 100644 --- a/config/nvim/lua/plugins/extras/coding/recorder.lua +++ b/config/nvim/lua/plugins/extras/coding/recorder.lua @@ -28,7 +28,7 @@ return { "nvim-lualine/lualine.nvim", optional = true, opts = function(_, opts) - table.insert(opts.sections.lualine_x, 1, require("recorder").displaySlots) + table.insert(opts.sections.lualine_x, require("recorder").displaySlots) end, }, } diff --git a/config/nvim/lua/plugins/extras/lang/jason-extended.lua b/config/nvim/lua/plugins/extras/lang/json-extended.lua similarity index 100% rename from config/nvim/lua/plugins/extras/lang/jason-extended.lua rename to config/nvim/lua/plugins/extras/lang/json-extended.lua diff --git a/config/nvim/lua/plugins/extras/lang/yaml-extended.lua b/config/nvim/lua/plugins/extras/lang/yaml-extended.lua new file mode 100644 index 00000000..3f8bf31b --- /dev/null +++ b/config/nvim/lua/plugins/extras/lang/yaml-extended.lua @@ -0,0 +1,37 @@ +return { + { import = "lazyvim.plugins.extras.lang.yaml" }, + { + "someone-stole-my-name/yaml-companion.nvim", + ft = { "yaml" }, + dependencies = { + { "neovim/nvim-lspconfig" }, + { "nvim-lua/plenary.nvim" }, + { "nvim-telescope/telescope.nvim" }, + }, + opts = {}, + config = function(_, opts) + local cfg = require("yaml-companion").setup(opts) + require("lspconfig")["yamlls"].setup(cfg) + LazyVim.on_load("telescope.nvim", function() + require("telescope").load_extension("yaml_schema") + end) + end, + keys = { + { "cy", "Telescope yaml_schema", desc = "YAML Schema" }, + }, + }, + { + "nvim-lualine/lualine.nvim", + optional = true, + opts = function(_, opts) + local function yaml_schema() + local schema = require("yaml-companion").get_buf_schema(0) + if schema.result[1].name == "none" then + return "" + end + return schema.result[1].name + end + table.insert(opts.sections.lualine_x, 1, yaml_schema) + end, + }, +}