mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
refactor(jump): improve robustness of getmark function
This commit refactors the `getmark` function in the `jump` plugin to improve its robustness and consistency with the rest of the file. The `LANG=` prefix is added to ensure that the output of the `realpath` command is in a consistent, predictable format. The `command` prefix is used to bypass any potential aliases for `realpath` and `echo`, ensuring that the script executes the intended commands.
This commit is contained in:
parent
d1c04d8a33
commit
2757306ef1
1 changed files with 5 additions and 0 deletions
|
|
@ -45,11 +45,16 @@ marks() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getmark {
|
||||||
|
LANG= command echo $(command realpath "$MARKPATH/$1") || command echo "No such mark: $1"
|
||||||
|
}
|
||||||
|
|
||||||
_completemarks() {
|
_completemarks() {
|
||||||
reply=("${MARKPATH}"/{,.}*(@N:t))
|
reply=("${MARKPATH}"/{,.}*(@N:t))
|
||||||
}
|
}
|
||||||
compctl -K _completemarks jump
|
compctl -K _completemarks jump
|
||||||
compctl -K _completemarks unmark
|
compctl -K _completemarks unmark
|
||||||
|
compctl -K _completemarks getmark
|
||||||
|
|
||||||
_mark_expansion() {
|
_mark_expansion() {
|
||||||
setopt localoptions extendedglob
|
setopt localoptions extendedglob
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue