I want to add zsh-autosuggestions
plugin to ~/.zshrc
by script.
original text:
plugins=(git)
or
plugins=(git
some1
some2)
target :
plugins=(git
zsh-autosuggestions)
This doesn't work.
sed -i 's/^plugins=\(([^\)]*)\)/plugins=\(\1\nzsh-autosuggestions\n\)/' ~/.zshrc
I am confused, I think this
([^\)]*)
is group 1, but why it not workbut remove first group's
()
sed -i 's/^plugins=\([^\)]*\)/plugins=\(\1\nzsh-autosuggestions\n\)/' ~/.zshrc
turn out to
plugins=((git zsh-autosuggestions ) )
I have escaped the
()
by\
, why it became group 1?