-
-
Notifications
You must be signed in to change notification settings - Fork 5
v:count
parameter passed to Lua functions causing conflicts
#2
Comments
That's odd, it should work in both cases and I do this quite often in my own config. I tested your third example and it works on my end. Can you share your full configuration? |
Note that Lua functions are called with the value of |
Thank-you for the reply. Actually, named functions are working but for some reason I'm not able to bind functions from other plugins. It might be a lazy-loading misconfiguration by me in packer.nvim. I ended up reducing my config to this and am still not able to figure out whats wrong though
The error:
I'm not able able to bind |
This config works perfectly, though:
|
Yes, this is being caused by the I regret this design decision and I'd like to remove it which would fix your issue. Unfortunately, it's difficult or impossible to detect whether or not someone is relying on this argument in order to give them a deprecation warning. I will consider how to best phase this out without breaking anyone's configurations. In the mean time, you can do something like this as a workaround: local function wrap(fn)
return function()
return fn()
end
end
local packer = require 'packer'
packer.startup(function(use)
use {
'nvim-telescope/telescope.nvim',
requires = 'b0o/mapx.nvim',
config = function()
local telescope = require 'telescope'
local builtin = require 'telescope.builtin'
local m = require 'mapx'
telescope.load_extension 'fzf'
m.nnoremap('<c-p>', wrap(builtin.find_files))
m.nnoremap('<c-t>', wrap(builtin.live_grep))
m.nnoremap('<c-b>', wrap(builtin.buffers))
end,
}
end) |
Thank-you! |
v:count
parameter passed to Lua functions causing conflicts
This will be fixed in v1 as a breaking change. |
Hello, I really like the idea of this plugin and have something similar implemented in my dotfiles:
This generates the [nivts]noremap family of functions which have two arguments. The first argument is the input keybinding and the second is either a string which can be a vim command OR it can be lua callback. This allows me to make the following types of mappings:
I tried switching to mapx.nvim, mainly for the which-key.nvim integration and while example 1 and 2 work I'm not able to bind named functions. I know I can wrap the functions in an anonymous function but I'm just wondering why it doesn't work and what mistake I'm making.
The text was updated successfully, but these errors were encountered: