repmo-vim icon indicating copy to clipboard operation
repmo-vim copied to clipboard

Is it possible to use repmo-vim with VSCode Neovim?

Open griiid opened this issue 1 year ago • 1 comments

I am using VSCode with VSCode Neovim extension. I'd like to use repmo-vim to repeat commands such as [[, ]], [], ][, ]m, [m, ]M, [M, but it's not working.

Here's my config with lua:

vim.g.repmo_map_key = ";"
vim.g.repmo_reverse_map_key = ","

vim.keymap.set("n", "f", function() return vim.fn["repmo#ZapKey"]("f") end, { expr = true, noremap = true })
vim.keymap.set("n", "F", function() return vim.fn["repmo#ZapKey"]("F") end, { expr = true, noremap = true })
vim.keymap.set("n", "t", function() return vim.fn["repmo#ZapKey"]("t") end, { expr = true, noremap = true })
vim.keymap.set("n", "T", function() return vim.fn["repmo#ZapKey"]("T") end, { expr = true, noremap = true })

local jump_keys = { { "[[", "]]" }, { "[]", "][" }, { "[m", "]m" }, { "[M", "]M" }, { "{", "}" } }

for _, keys in ipairs(jump_keys) do
  vim.keymap.set("n", keys[1], function() return vim.fn["repmo#SelfKey"](keys[1], keys[2]) end, { expr = true, noremap = true })
  vim.keymap.set("n", keys[2], function() return vim.fn["repmo#SelfKey"](keys[2], keys[1]) end, { expr = true, noremap = true })
end

griiid avatar Mar 13 '25 16:03 griiid

I don't use VSCode, Neovim, Lua ... just guessing what your code means.

vim.g is a "dictionary" (associative array, whatever) of Vim global variables? Repmo does not make use of variables g:repmo_map_key, g:repmo_reverse_map_key:

vim.g.repmo_map_key = ";"
vim.g.repmo_reverse_map_key = ","

(I think these assignments do nothing).

Instead you should try resembling these key mappings using vim.keymap.set():

:map <expr> ; repmo#LastKey(';')|sunmap ;
:map <expr> , repmo#LastRevKey(',')|sunmap ,

I think you left that out.

Houl avatar Apr 15 '25 07:04 Houl