toggleterm.nvim icon indicating copy to clipboard operation
toggleterm.nvim copied to clipboard

[BUG] set_opfunc is undefined

Open 10b14224cc opened this issue 1 year ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

I'm putting this keybinding in my config file, as suggested in the README:

-- Send motion to terminal
vim.keymap.set("n", "<leader>im", function()
  set_opfunc(function(motion_type)
    require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count })
  end)
  vim.api.nvim_feedkeys("g@", "n", false)
end)

But when I issue <leader>im I get:

E5108: Error executing lua: .../USERNAME/.config/nvim/lua/plugins/config/toggleterm.lua:83: attempt to call global 'set_opfunc' (a nil value)
stack traceback:
    .../USERNAME/.config/nvim/lua/plugins/config/toggleterm.lua:83: in function <.../USERNAME/.config/nvim/lua/plugins/config/toggleterm.lua:82>

Expected Behavior

<leader>imw should send a word to the terminal

Steps To Reproduce

See above

Environment

- OS: Arch Linux
- neovim version:
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1702233742

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"
- Shell: bash

Anything else?

No response

10b14224cc avatar Feb 15 '24 08:02 10b14224cc