1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2025-12-12 15:34:50 +08:00

Compare commits

...

2 Commits

Author SHA1 Message Date
daddeffe
cd17aed9e1
sudo: keep space before the command to ignore it in the history (#9178)
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-08-23 22:58:08 +02:00
Kirill Suslov
c785db621e
Update README with new update command (#9203)
Note: `upgrade_oh_my_zsh` is deprecated. Use `omz update` instead.
2020-08-23 21:52:11 +02:00
2 changed files with 12 additions and 1 deletions

View File

@ -273,7 +273,7 @@ DISABLE_AUTO_UPDATE=true
If you'd like to upgrade at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run:
```shell
upgrade_oh_my_zsh
omz update
```
Magic! 🎉

View File

@ -14,6 +14,14 @@
sudo-command-line() {
[[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)"
# Save beginning space
local WHITESPACE=""
if [[ ${LBUFFER:0:1} == " " ]] ; then
WHITESPACE=" "
LBUFFER="${LBUFFER:1}"
fi
if [[ -n $EDITOR && $BUFFER == $EDITOR\ * ]]; then
if [[ ${#LBUFFER} -le ${#EDITOR} ]]; then
RBUFFER=" ${BUFFER#$EDITOR }"
@ -38,6 +46,9 @@ sudo-command-line() {
else
LBUFFER="sudo $LBUFFER"
fi
# Preserve beginning space
LBUFFER="${WHITESPACE}${LBUFFER}"
}
zle -N sudo-command-line
# Defined shortcut keys: [Esc] [Esc]