From 18abfa775499f6e929632f577fee5c3f50c6f2f6 Mon Sep 17 00:00:00 2001 From: jdhao Date: Mon, 17 Oct 2022 00:06:10 +0800 Subject: [PATCH] feat: add a mapping to blink cursor --- core/mappings.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/mappings.lua b/core/mappings.lua index 3f5a7b7..8a1e2e6 100644 --- a/core/mappings.lua +++ b/core/mappings.lua @@ -1,5 +1,6 @@ local keymap = vim.keymap local api = vim.api +local uv = vim.loop -- Save key strokes (now we do not need to press shift to enter command mode). keymap.set({ "n", "x" }, ";", ":") @@ -223,3 +224,22 @@ keymap.set("c", "", "") -- Delete the character to the right of the cursor keymap.set("i", "", "") + +keymap.set("n", "cb", function() + local cnt = 0 + local blink_times = 7 + local timer = uv.new_timer() + + timer:start(0, 100, vim.schedule_wrap(function() + vim.cmd[[ + set cursorcolumn! + set cursorline! + ]] + + if cnt == blink_times then + timer:close() + end + + cnt = cnt + 1 + end)) +end)