-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: vim.v.count
is always 0
#25
Comments
Thanks for bringing it to my attention! I have some time to look at this and the other issue today; this should hopefully be a simple fix |
I've pushed to a new branch. local my_mode = {
g = function()
vim.notify('count: ' .. vim.g.myModeModeCount)
end
}
vim.keymap.set('n', 'M', function()
require('libmodal').mode.enter('My mode', my_mode)
end) Let me know if this will work for you :) |
Too bad |
Given that #30 allows the |
Yeah that might be a good idea 🙂 |
The PR was updated. This now works: local libmodal = require 'libmodal'
-- register keymaps for splitting windows and then closing windows
local fooModeKeymaps =
{
h = function(self)
self.count:set(0)
end,
G = function(self)
local count = self.count:get()
vim.api.nvim_command('norm! ' .. count .. 'G')
end,
}
-- enter the mode using the keymaps
libmodal.mode.enter('FOO', fooModeKeymaps) And FYI, I changed local libmodal = require 'libmodal'
local barModeKeymaps = {
p = function() vim.notify('Hello!') end,
}
-- register key commands and what they do
local fooModeKeymaps =
{
q = 'let g:fooModeExit = 1', -- exits all instances of this mode
w = function(self)
self.exit:set_global(true) -- exits all instances of the mode (with lua)
end,
x = function(self)
self.exit:set_local(true) -- exits this instance of the mode
end,
y = function(self)
self:switch('Bar', barModeKeymaps) -- enters Bar and then exits Foo when it is done
end,
z = libmodal.mode.switch('Bar', barModeKeymaps), -- the same as above, but more convenience
}
-- enter the mode using the keymaps created before
libmodal.mode.enter('FOO', fooModeKeymaps) Documentation has been updated for what values are available in |
Awesome! Thank you! |
Hi! I'm trying to use
vim.v.count
in a mode mapping. However, it seems to always be 0.To reproduce:
M
3g
count: 0
The text was updated successfully, but these errors were encountered: