akinsho / toggleterm.nvim

A neovim lua plugin to help easily manage multiple terminal windows
GNU General Public License v3.0
4.24k stars 170 forks source link

[BUG] open_mapping not working #491

Closed li-yang23 closed 1 year ago

li-yang23 commented 1 year ago

Is there an existing issue for this?

Current Behavior

I'm using neovim v0.9.1 and packer. My installation config for toggleterm in plugins-setup.lua is

use ({'akinsho/toggleterm.nvim', tag = 'v2.*', config = [[require('toggleterm')]] }) and my toggleterm config toggleterm.lua is like this:

require('toggleterm').setup{ direction = 'float', open_mapping = [[<C-j>]], auto_scroll = true, }

also, i tried to set a keymap in my keymaps.lua config:

keymap.set("n", "<c-j>", ":ToggleTerm<CR>")

when i use :so in toggleterm.lua or plugins-setup.lua, and press ctrl+j the open_mapping keymaps work just fine, but when I open a new file(i tried init.lua in the very same directory and files in other directories) it stops working, ctrl+j won't open anything.

Expected Behavior

I'm expecting pressing ctrl+j in normal mode in any file opened with neovim and a terminal opens

Steps To Reproduce

  1. neovim v0.9.1
  2. configs are in current behavior description
  3. press ctrl+j
  4. nothing happened

Environment

- OS: macOS Ventura 13.5.2
- neovim version: v0.9.1
- Shell: iterm2+zsh(I use oh-my-zsh)

Anything else?

No response

li-yang23 commented 1 year ago

something else: I used <leader>j as open_mapping once and it seems work, but neovim would wait a little bit every time i press space button(which I use as leader key) and it really bothers me. So I changed back

akinsho commented 1 year ago

@li-yang23, so issues that boil down to how a user configures their neovim unfortunately are looked into by me, otherwise I'd spend all my time debugging user configs when the plugin itself isn't broken. You should check that the terminal isn't using <c-j> for something else and re. leader j the delay is probably because you have something else bound to leader j e.g. leader j + l. All of these are normal config based issues and not plugin problems.