0

I'm getting the following error output when trying to start Neovim ($ nvim ...):

bash: _longopt: line 6: syntax error near unexpected token `('
bash: _longopt: line 6: ` --!(no-*)dir*)'
bash: error importing function definition for `_longopt'
bash: _parse_usage: line 16: syntax error near unexpected token `('
bash: _parse_usage: line 16: ` -?(\[)+([a-zA-Z0-9?]))'
bash: error importing function definition for `_parse_usage'
bash: _services: line 5: syntax error near unexpected token `('
bash: _services: line 5: ` COMPREPLY=($(printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions|README)));'

What can I do to resolve this? It worked just a second ago... all that I did was remove a ROS source statement from my bashrc using nvim, and since then it will not work.

steeldriver
  • 142,475

1 Answers1

0

The errors you’re seeing aren’t Neovim itself crashing—they’re Bash complaining about “broken” function‐definitions in your environment. In other words, when you run nvim, Bash is importing some exported functions (like _longopt, _parse_usage, _services) whose contents now contain unescaped “extended‐glob” patterns (e.g. !(no-*) or ?([a-zA-Z0-9?])) that Bash isn’t set up to parse. Those function bodies probably came from ROS’s setup scripts or some completion file you sourced earlier, and by removing that ROS line, you left behind half‐defined exports that Bash can no longer read.

Try this:

env | grep '^[A-Za-z0-9_]\+=\(\)' \ | cut -d= -f1 \ | xargs -r -n1 unset -f

  • env | grep '^[A-Za-z0-9_]\+=\(\)' finds all “VAR=()” lines in your environment (i.e. exported functions).
  • cut -d= -f1 pulls out just the function names.
  • xargs -r -n1 unset -f unsets each one.