From b9f0e4623e89c0c04bf7da82fd52a667fd7eab96 Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Thu, 14 Jul 2022 15:37:52 +0530 Subject: [PATCH] mappings: Add back mappings removed in https://github.com/NvChad/NvChad/commit/0844431d37b762c4fa0ff37dba28280848cf3f09 | Format files --- lua/core/mappings.lua | 16 ++++++++++++++++ lua/core/utils.lua | 6 +++--- lua/plugins/configs/nvimtree.lua | 2 +- lua/plugins/configs/others.lua | 2 +- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 5638d38..8accde7 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -7,6 +7,16 @@ end local M = {} M.general = { + [""] = { + -- Allow moving the cursor through wrapped lines with j, k, and + -- http ://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/ + -- empty mode is same as using :map + -- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour + ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } }, + ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } }, + [""] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } }, + [""] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } }, + }, i = { @@ -56,6 +66,12 @@ M.general = { t = { [""] = { termcodes "", " escape terminal mode" }, }, + + v = { + -- Don't copy the replaced text after pasting in visual mode + -- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste + ["p"] = { 'p:let @+=@0:let @"=@0', opts = { silent = true } }, + }, } M.tabufline = { diff --git a/lua/core/utils.lua b/lua/core/utils.lua index f6041bf..131369c 100644 --- a/lua/core/utils.lua +++ b/lua/core/utils.lua @@ -152,9 +152,9 @@ M.packer_sync = function(...) { "PackerSync" }, { " on a NvChadSnapshot. This will cause issues if NvChad dependencies contain " - .. "any breaking changes! Plugin updates will not be included in this " - .. "snapshot, so they will be lost after switching between snapshots! Would " - .. "you still like to continue? [y/N]\n", + .. "any breaking changes! Plugin updates will not be included in this " + .. "snapshot, so they will be lost after switching between snapshots! Would " + .. "you still like to continue? [y/N]\n", "WarningMsg", }, }, false, {}) diff --git a/lua/plugins/configs/nvimtree.lua b/lua/plugins/configs/nvimtree.lua index 5a75101..d579238 100644 --- a/lua/plugins/configs/nvimtree.lua +++ b/lua/plugins/configs/nvimtree.lua @@ -34,7 +34,7 @@ local options = { }, filesystem_watchers = { enable = true, - }, + }, actions = { open_file = { resize_window = true, diff --git a/lua/plugins/configs/others.lua b/lua/plugins/configs/others.lua index ade0fde..2b437c0 100644 --- a/lua/plugins/configs/others.lua +++ b/lua/plugins/configs/others.lua @@ -112,7 +112,7 @@ M.luasnip = function() options = load_override(options, "L3MON4D3/LuaSnip") luasnip.config.set_config(options) require("luasnip.loaders.from_vscode").lazy_load() - require("luasnip.loaders.from_vscode").lazy_load({ paths = vim.g.luasnippets_path or "" }) + require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" } vim.api.nvim_create_autocmd("InsertLeave", { callback = function()