mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Adding special case when the command launched is in another directory
This commit is contained in:
parent
626e54825c
commit
606ea84e60
1 changed files with 6 additions and 5 deletions
|
|
@ -15,16 +15,17 @@
|
||||||
nohup-command-line() {
|
nohup-command-line() {
|
||||||
[[ -z $BUFFER ]] && zle up-history
|
[[ -z $BUFFER ]] && zle up-history
|
||||||
if [[ $BUFFER == nohup\ * ]]; then
|
if [[ $BUFFER == nohup\ * ]]; then
|
||||||
LBUFFER="${LBUFFER#nohup }"
|
BUFFER="${BUFFER#nohup }"
|
||||||
LBUFFER="${LBUFFER%\ &\>*}"
|
BUFFER="${BUFFER%\ &\>*}"
|
||||||
else
|
else
|
||||||
tokens=("${(@s/ /)LBUFFER}")
|
tokens_slash=("${(@s|/|)BUFFER}")
|
||||||
|
tokens_space=("${(@s/ /)tokens_slash[-1]}")
|
||||||
i=1
|
i=1
|
||||||
if [[ $tokens[1] == sudo ]]; then
|
if [[ $tokens_slash[1] == sudo ]]; then
|
||||||
(( i++ ))
|
(( i++ ))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LBUFFER="nohup $LBUFFER &> $tokens[$i].out &"
|
BUFFER="nohup $BUFFER &> $tokens_space[$i].out &"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
zle -N nohup-command-line
|
zle -N nohup-command-line
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue