zbirenbaum / nvterm

NvChad's Official Terminal Plugin ( Unmaintained but still usable and stable), wait for v3.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Telescope terminal selector gives key error when selecting vertical and horizontal terminals.

AlexanderHott opened this issue · comments

Describe the bug
Using Telescope to select terminals sometimes results in a key error.

To Reproduce
Steps to reproduce the behavior:

  1. alt+v to open a vertical terminal
  2. alt+v to close the vertical terminal
  3. alt+i to open a floating terminal
  4. alt+i to close the floating terminal
  5. :Telescope terms to open telescope terminal picker
  6. pick the vertical terminal (first one)

It will also error when selecting a horizontal terminal, but not a floating one.

Expected behavior
The vertical terminal should be shown.

Traceback

E5108: Error executing lua ...im/site/pack/packer/start/nvterm/lua/nvterm/terminal.lua:83: attempt to index local 'term' (a nil value)
stack traceback:
        ...im/site/pack/packer/start/nvterm/lua/nvterm/terminal.lua:83: in function 'show_term'
        ...im/site/pack/packer/start/nvterm/lua/nvterm/terminal.lua:91: in function 'get_and_show'
        ...ker/start/extensions/lua/telescope/_extensions/terms.lua:109: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
        ...ack/packer/opt/telescope.nvim/lua/telescope/mappings.lua:242: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk

Desktop (please complete the following information):

  • Operating System
    • Windows (WSL2)
  • Terminal
    • Windows terminal
  • Version of Neovim
NVIM v0.8.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Additional context
This is on a fresh install of NvChad
commit 1381e924cf72c6fbc513d9ffc7a09766ff50b6f2

use 0.7 btw

also terms that can be picked are those which are spawned from leader + v / h

also terms that can be picked are those which are spawned from leader + v / h

I'm still getting the error when spawning the terminals with leader,h and leader,v. It seems to be an issue picking the first terminal, because when I open and close a vertical, then a horizontal terminal, telescope errors when I try to select the first one.

Also, what is the designed way to close a terminal window (not exit).

Edit: I switched to neovim 0.7 and nothing changed.

@zbirenbaum look onto this when free!

Can you guys spawn terminals using A-h? for some reason all the other keys work fine, as does remapping to A-s but A-h does nothing. No idea why.

Can you guys spawn terminals using A-h? for some reason all the other keys work fine, as does remapping to A-s but A-h does nothing. No idea why.

yes it works for me here

maybe your WM or DE or terminal uses that keybind too? 🤔

maybe your WM or DE or terminal uses that keybind too? thinking

ah it was tmux.

So I was hoping to have this done tonight but its late and the root cause is actually a much bigger problem. This occurs due to having multiple terminals, but the internal terminal tracker only shows 1. I did a bunch of stuff but I cannot figure out for my life why this is happening, so may take a little longer.

I think this should be fixed. There was a line checking the length of the wrong thing which seemed to be causing it. However, while debugging I ran into some other strange behavior related to terminal id indexing, so if anything else pops up don't hesitate to let me know.