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] Running custom terminal return "attempt to index local 'self' (a nil value)" #465

Closed Carbone13 closed 1 year ago

Carbone13 commented 1 year ago

Is there an existing issue for this?

Current Behavior

Toggling/Spawning a custom terminal result in a crash.

E5113: Error while calling lua chunk: ...re/nvim/lazy/toggleterm.nvim/lua/toggleterm/terminal.lua:494: attempt to index local 'self' (a nil value)

Expected Behavior

Terminal is actually toggled/spawned

Steps To Reproduce

Using the provided snippet for installation with lazy :

local Terminal  = require('toggleterm.terminal').Terminal
local function cmake_configure_prompt ()
    local term = Terminal:new({
        cmd = "cmake -S . -B .build -G Ninja"
    })
    term.toggle()
end
cmake_configure_prompt()

Running this (:luafile %) result in :

E5113: Error while calling lua chunk: ...re/nvim/lazy/toggleterm.nvim/lua/toggleterm/terminal.lua:494: attempt to index local 'self' (a nil value)

Environment

- OS: MacOS Ventura 13.4.1
- neovim version: 0.9.1 (LuaJIT 2.1.0-beta3)
- Shell: zsh

Anything else?

No response

Carbone13 commented 1 year ago

Alright I guess I was a bit tired... It's of course term:toggle() instead of term.toggle()