TIL

It's common to update a shell environment variable by replacing it entirely:

$ SOME_VAR=hi
$ echo $SOME_VAR
hi
$ SOME_VAR=hi2
$ echo $SOME_VAR
hi2

However zshoffers vared, which uses zle to prompt us update the current value without having to read/write it ourselves:

$ SOME_VAR=hi
$ echo $SOME_VAR
hi
~/.dotfiles main $ vared SOME_VAR
hi▋                                 #<-- this is the original prompt with our cursor
hi2▋                                #<-- let's type "2" and hit return
~/.dotfiles main $ echo $SOME_VAR
hi2

handy!

Source:

zsh