Closed yudistrange closed 1 year ago
It looks like wincmd is an ex command, not a function, a subtle but important difference. winnr IS a function which is why you can call it.
The suspect the reason it's showing up when you list all properties is simply an artifact of how the Lua metatable is set up for vim.fn. It's basically metaprogramming, so when you call vim.fn.foo a function is invoked that tries to look up "foo" and invoke it in nvim. If it doesn't exist, you get an error, but that property appears to get cached as a function under vim.fn.foo that always throws that same "doesn't exist" error.
On Fri, 15 Sep 2023, 12:30 yudistrange, @.***> wrote:
I'm trying to use the wincmd fn using aniseed in my neovim config. But if I try evaluating it, I get the following error
(vim.fn.wincmd "k")
; eval (current-form): (vim.fn.wincmd "k") ; Vim:E117: Unknown function: wincmd
But the function is there. I can see it being listed under vim.fn if I do the following.
(each [k v (pairs vim.fn)] (print k v))
I also tried evaluating the vim.fn.winc function. But that also results in the same error.
I tried evaluating other fns under vim.fn and they work as expected. For instance I can use vim.fn.winnr. Not sure if I'm missing on something very basic.
— Reply to this email directly, view it on GitHub https://github.com/Olical/aniseed/issues/145, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACM6XIHR6RLQG3GWD3BAOTX2Q35TANCNFSM6AAAAAA4ZVPT4Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>
So to call wincmd, you'll need to use the nvim API for invoking ex commands. I'm on my phone so I'm afraid I can't get a good example of that right now but it's well documented.
On Fri, 15 Sep 2023, 13:08 Oliver Caldwell, @.***> wrote:
It looks like wincmd is an ex command, not a function, a subtle but important difference. winnr IS a function which is why you can call it.
The suspect the reason it's showing up when you list all properties is simply an artifact of how the Lua metatable is set up for vim.fn. It's basically metaprogramming, so when you call vim.fn.foo a function is invoked that tries to look up "foo" and invoke it in nvim. If it doesn't exist, you get an error, but that property appears to get cached as a function under vim.fn.foo that always throws that same "doesn't exist" error.
On Fri, 15 Sep 2023, 12:30 yudistrange, @.***> wrote:
I'm trying to use the wincmd fn using aniseed in my neovim config. But if I try evaluating it, I get the following error
(vim.fn.wincmd "k")
; eval (current-form): (vim.fn.wincmd "k") ; Vim:E117: Unknown function: wincmd
But the function is there. I can see it being listed under vim.fn if I do the following.
(each [k v (pairs vim.fn)] (print k v))
I also tried evaluating the vim.fn.winc function. But that also results in the same error.
I tried evaluating other fns under vim.fn and they work as expected. For instance I can use vim.fn.winnr. Not sure if I'm missing on something very basic.
— Reply to this email directly, view it on GitHub https://github.com/Olical/aniseed/issues/145, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACM6XIHR6RLQG3GWD3BAOTX2Q35TANCNFSM6AAAAAA4ZVPT4Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thanks @Olical for clarifying that.
It worked after I moved to nvim.ex.wincmd
. Now I can finally wrap the navigation keys!
I'm trying to use the
wincmd
fn using aniseed in my neovim config. But if I try evaluating it, I get the following errorBut the function is there. I can see it being listed under
vim.fn
if I do the following.I also tried evaluating the
vim.fn.winc
function. But that also results in the same error.I tried evaluating other fns under
vim.fn
and they work as expected. For instance I can usevim.fn.winnr
. Not sure if I'm missing on something very basic.