mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-12 21:39:48 +01:00
jump: fix for `marks' and CTRL+G key binding
- marks printed an error when $MARKPATH didn't exist or didn't have any marks in it. - The CTRL+G key binding overwrote an argument when it couldn't match it to an existing mark.
This commit is contained in:
parent
3c5bbcf5b9
commit
561e7169ac
1 changed files with 3 additions and 3 deletions
|
@ -30,13 +30,13 @@ unmark() {
|
||||||
|
|
||||||
marks() {
|
marks() {
|
||||||
local link max=0
|
local link max=0
|
||||||
for link in $MARKPATH/{,.}*(@); do
|
for link in $MARKPATH/{,.}*(@N); do
|
||||||
if [[ ${#link:t} -gt $max ]]; then
|
if [[ ${#link:t} -gt $max ]]; then
|
||||||
max=${#link:t}
|
max=${#link:t}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
local printf_markname_template="$(printf -- "%%%us " "$max")"
|
local printf_markname_template="$(printf -- "%%%us " "$max")"
|
||||||
for link in $MARKPATH/{,.}*(@); do
|
for link in $MARKPATH/{,.}*(@N); do
|
||||||
local markname="$fg[cyan]${link:t}$reset_color"
|
local markname="$fg[cyan]${link:t}$reset_color"
|
||||||
local markpath="$fg[blue]$(readlink $link)$reset_color"
|
local markpath="$fg[blue]$(readlink $link)$reset_color"
|
||||||
printf -- "$printf_markname_template" "$markname"
|
printf -- "$printf_markname_template" "$markname"
|
||||||
|
@ -53,7 +53,7 @@ compctl -K _completemarks unmark
|
||||||
_mark_expansion() {
|
_mark_expansion() {
|
||||||
setopt localoptions extendedglob
|
setopt localoptions extendedglob
|
||||||
autoload -U modify-current-argument
|
autoload -U modify-current-argument
|
||||||
modify-current-argument '$(readlink "$MARKPATH/$ARG")'
|
modify-current-argument '$(readlink "$MARKPATH/$ARG" || echo "$ARG")'
|
||||||
}
|
}
|
||||||
zle -N _mark_expansion
|
zle -N _mark_expansion
|
||||||
bindkey "^g" _mark_expansion
|
bindkey "^g" _mark_expansion
|
||||||
|
|
Loading…
Reference in a new issue