Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events stopped working after update #25755

Closed
Guilherhast opened this issue Oct 23, 2023 · 1 comment
Closed

Events stopped working after update #25755

Guilherhast opened this issue Oct 23, 2023 · 1 comment
Labels
closed:question issues that are closed as usage questions

Comments

@Guilherhast
Copy link

Problem

All code I wrote that used events with more than one word stopped working:

vim.api.nvim_create_autocmd({'TermOpen term://*'}, { callback=_G.set_terminal_keymaps})
vim.api.nvim_create_autocmd({'TermOpen term://*'}, { command="startinsert"})
vim.api.nvim_create_autocmd(
	{ 'FileType c, cpp, php' },
	{ command = 'imap<leader>. ->' }
)

vim.api.nvim_create_autocmd(
	{ 'FileType gdscript' },
	{ command = 'noremap <buffer> <F4> :GodotRunLast<CR>' }
)

And I get errors like this:

Error detected while processing /home/hastenreiter/.config/nvim/init.lua:
E5113: Error while calling lua chunk: ...e/hastenreiter/.config/nvim/lua/GuilherHast/commands.lua:81: Invalid 'event': 'FileType c, cpp, php'
stack traceback:
	[C]: in function 'nvim_create_autocmd'
	...e/hastenreiter/.config/nvim/lua/GuilherHast/commands.lua:81: in main chunk
	[C]: in function 'require'
	/home/hastenreiter/.config/nvim/lua/GuilherHast/init.lua:6: in main chunk
	[C]: in function 'require'
	/home/hastenreiter/.config/nvim/init.lua:8: in main chunk
Error detected while processing /home/hastenreiter/.config/nvim/init.lua:
E5113: Error while calling lua chunk: ...e/hastenreiter/.config/nvim/lua/GuilherHast/commands.lua:81: Invalid 'event': 'FileType c, cpp, php'
stack traceback:
	[C]: in function 'nvim_create_autocmd'
	...e/hastenreiter/.config/nvim/lua/GuilherHast/commands.lua:81: in main chunk
	[C]: in function 'require'
	/home/hastenreiter/.config/nvim/lua/GuilherHast/init.lua:6: in main chunk
	[C]: in function 'require'
	/home/hastenreiter/.config/nvim/init.lua:8: in main chunk
E5108: Error executing lua ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:347: Invalid 'event': 'User TelescopeFindPre'
stack traceback:
	[C]: in function 'nvim_exec_autocmds'
	...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:347: in function 'find'
	...r/start/telescope.nvim/lua/telescope/builtin/__files.lua:342: in function 'v'
	...r/start/telescope.nvim/lua/telescope/builtin/__files.lua:570: in function 'v'
	...cker/start/telescope.nvim/lua/telescope/builtin/init.lua:511: in function 'find_files'
	[string ":lua"]:1: in main chunk

This code was working before:

NVIM v0.9.0
Build type: Release
LuaJIT 2.1.1697887905

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

Run :checkhealth for more info

Does not work now:

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1697887905

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

Run :checkhealth for more info

Steps to reproduce

nvim --clean
:lua vim.api.nvim_create_autocmd({'TermOpen term://*'}, { command='startinsert' } ) --Or any of the code above

Expected behavior

I expected it to work as it did before.

Neovim version (nvim -v)

NVIM v0.9.4

Vim (not Nvim) behaves the same?

No

Operating system/version

Linux Archer 6.1.59-1-lts #1 SMP PREEMPT_DYNAMIC Fri, 20 Oct 2023 05:42:57 +0000 x86_64 GNU/Linux

Terminal name/version

terminator 2.1.3

$TERM environment variable

xterm-256color

Installation

pacman

@Guilherhast Guilherhast added the bug issues reporting wrong behavior label Oct 23, 2023
@clason
Copy link
Member

clason commented Oct 23, 2023

That never should have worked. The proper format is

vim.api.nvim_create_autocommand({ 'event1', 'event2', ... }, { pattern = 'term://*', ... })

This is just strictly validated now so you actually notice that you're entering nonsense.

@clason clason closed this as not planned Won't fix, can't repro, duplicate, stale Oct 23, 2023
@zeertzjq zeertzjq added closed:question issues that are closed as usage questions and removed bug issues reporting wrong behavior labels Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed:question issues that are closed as usage questions
Projects
None yet
Development

No branches or pull requests

3 participants