akinsho / toggleterm.nvim

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

[BUG] Reverse range in character class #562

Closed nishantHolla closed 3 months ago

nishantHolla commented 4 months ago

Is there an existing issue for this?

Current Behavior

When toggleterm is opened in a directory containing square brackets in the name ([ and ]) the following error appears:

E5108: Error executing lua vim/_editor.lua:0: nvim_exec2(): Vim:Error executing Lua callback: Vim:E944: Reverse range in character clas
s
stack traceback:
        [C]: in function '_get_dir'
        ...re/nvim/lazy/toggleterm.nvim/lua/toggleterm/terminal.lua:395: in function '__spawn'
        ...re/nvim/lazy/toggleterm.nvim/lua/toggleterm/terminal.lua:469: in function 'spawn'
        ...re/nvim/lazy/toggleterm.nvim/lua/toggleterm/terminal.lua:486: in function 'open'
        ...re/nvim/lazy/toggleterm.nvim/lua/toggleterm/terminal.lua:508: in function 'toggle'
        ...local/share/nvim/lazy/toggleterm.nvim/lua/toggleterm.lua:79: in function 'toggle_nth_term'
        ...local/share/nvim/lazy/toggleterm.nvim/lua/toggleterm.lua:290: in function 'toggle'
        ...local/share/nvim/lazy/toggleterm.nvim/lua/toggleterm.lua:265: in function 'toggle_command'
        ...local/share/nvim/lazy/toggleterm.nvim/lua/toggleterm.lua:419: in function <...local/share/nvim/lazy/toggleterm.nvim/lua/togg
leterm.lua:419>

Expected Behavior

ToggleTerm should open regardless of whether the directory name contains square brackets or not.

Steps To Reproduce

  1. Install toggleterm using lazy package manager
  2. Using this config
    require('toggleterm').setup({
    direction = 'horizontal',
    })
  3. Open toggleterm in a directory that has both open and close square brackets eg: ~/[slug]

Environment

- OS: Arch Linux 6.7.8-arch1-1
- neovim version: NVIM v0.9.5
- Shell: zsh 5.9 (x86_64-pc-linux-gnu)

Anything else?

I guess it is similar to this bug