Skip to content

Commit

Permalink
feat(expansion): plays nice with zsh-autosuggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
olets committed Jan 12, 2020
1 parent 8d0b39a commit e19a0a1
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions abbr
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,9 @@ function abbr_expand() {
}

function abbr_expand_accept() {
local lbuffer=$LBUFFER
local rbuffer=$RBUFFER

RBUFFER=$rbuffer # clear suggestions for the abbreviation
abbr_expand
RBUFFER=$rbuffer # clear suggestions for the expanded command

# if [[ $lbuffer == $LBUFFER ]]; then
zle accept-line
# fi
zle autosuggest-clear # play nice with zsh-autosuggestions
zle accept-line
}

function abbr_expand_space() {
Expand Down Expand Up @@ -102,8 +95,7 @@ bindkey "^ " magic-space
bindkey -M isearch "^ " abbr_expand_space
bindkey -M isearch " " magic-space

# return expands and accepts abbreviations
# NOTE: will clear anything after the cursor!!
# enter key expands and accepts abbreviations
zle -N abbr_expand_accept
bindkey "^M" abbr_expand_accept

Expand Down

0 comments on commit e19a0a1

Please sign in to comment.