Improve comments
This commit is contained in:
parent
0593b06daf
commit
342d792a9d
1 changed files with 9 additions and 6 deletions
15
bash-abbr
15
bash-abbr
|
|
@ -223,7 +223,7 @@ _try_abbrev_internal () {
|
|||
# [[ $point -eq ${#line} || "${line:point:1}" = ["${_bash_meta_chars[*]}"] ]] &&
|
||||
# NOTE: Above line commented out, it's actually not that useful.
|
||||
|
||||
# Determine word to complete
|
||||
# Determine word to complete by stripping leading shell metacharacters
|
||||
# Uses the same word separators as bash (| & ; ( ) space tab newline) (aka "shell metacharacters")
|
||||
# But < and > are ignored, since they always expect a file/delimiter/string afterwards and not a command
|
||||
declare -r word_at_point=${line_until_point##*["${_bash_meta_chars_without_left_right_angle_brackets[*]}"]} &&
|
||||
|
|
@ -306,16 +306,19 @@ _try_abbrev_internal () {
|
|||
fi
|
||||
|
||||
# Advance mark if it's set and right of (or on) the point.
|
||||
[[ $mark && mark -ge point ]] && eval "$new_mark"'=$((mark+offset))'
|
||||
[[ $mark && mark -gt point ]] && eval "$new_mark"'=$((mark+offset))'
|
||||
[[ -v "$new_mark" ]] || eval "$new_mark"'=$mark'
|
||||
|
||||
# Advance point.
|
||||
eval "$new_point"'=$((point+offset))'
|
||||
# NB: READLINE_ARGUMENT is deliberately ignored.
|
||||
# NB: READLINE_ARGUMENT is deliberately ignored, as it doesn't make sense for interactive alias expansion.
|
||||
}
|
||||
|
||||
_try_abbrev () {
|
||||
# For use within bind -x.
|
||||
# Perform abbreviation lookup and interactive expansion on the word left to the cursor (no quote parsing).
|
||||
# Takes a single argument which is the character to self-insert (usually space or another shell metacharacter).
|
||||
# For use within bash's bind -x builtin.
|
||||
# Perform interactive alias expansion on the word left to the cursor (no quote parsing) and also *on* the cursor if the
|
||||
# self-insertion character is empty (which represents pressing enter).
|
||||
# Takes a single argument which is the character to self-insert (usually space or another shell metacharacter, or empty for newline/enter).
|
||||
|
||||
# To prevent infinite recursion, we need to keep track
|
||||
# of which aliases have been expanded. This function re-initializes the global associative array (used as a hash set)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue