From b4eb4e1f4a4024229fe40782fdb12683c1c69634 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:40:31 +0300 Subject: [PATCH] feat(keymaps): allow `v:count1` when moving lines (#4618) ## Description Allow user to use `v:count1` when moving lines ## Related Issue(s) Closes #4615. ## Screenshots ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/config/keymaps.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index a6f1c574..84bba42c 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -23,12 +23,12 @@ map("n", "", "vertical resize -2", { desc = "Decrease Window Wi map("n", "", "vertical resize +2", { desc = "Increase Window Width" }) -- Move Lines -map("n", "", "m .+1==", { desc = "Move Down" }) -map("n", "", "m .-2==", { desc = "Move Up" }) +map("n", "", "execute 'move .+' . v:count1==", { desc = "Move Down" }) +map("n", "", "execute 'move .-' . (v:count1 + 1)==", { desc = "Move Up" }) map("i", "", "m .+1==gi", { desc = "Move Down" }) map("i", "", "m .-2==gi", { desc = "Move Up" }) -map("v", "", ":m '>+1gv=gv", { desc = "Move Down" }) -map("v", "", ":m '<-2gv=gv", { desc = "Move Up" }) +map("v", "", ":execute \"'<,'>move '>+\" . v:count1gv=gv", { desc = "Move Down" }) +map("v", "", ":execute \"'<,'>move '<-\" . (v:count1 + 1)gv=gv", { desc = "Move Up" }) -- buffers map("n", "", "bprevious", { desc = "Prev Buffer" })