0

[leading dots elided because I don't want to type them]

An alias--gl--is set to git pull by a plugin in my zshrc. I want to set it to a git log command.

I'm on macOS and, as expected, /etc/zshrc is not aliasing anything to git pull. My zprofile is empty, and I have no zlogin. The last three lines of my zshrc are:

unalias gl
alias gl="git log --pretty=medium --decorate --date=short"
alias gpl="git pull"

After an exec zsh the unalias command errs with "no such hash table element: gl". An immediate alias gl returns gl='git pull'.

Running zsh -ixc : | grep "alias gl" returns nothing. zsh -ixc : | grep "git pull" returns nothing. However immediately running alias gl returns gl='git pull'.

I can unalias and realias gl to my desired command on the command line.

7
  • Your greps won't work because the thing you're trying to grep is in stderr.
    – muru
    Nov 30, 2021 at 0:32
  • Ahah! Thank you @muru -- I'll take a new look. Unfortunately that's not the problem. If I redirect to 2>&1 and grep for "bindkey" all of the appropriate results show up.
    – meangrape
    Nov 30, 2021 at 2:50
  • 1
    Those aliases could very well be set from within code where the xtrace option is disabled or stderr is redirected to /dev/null. Like in zsh -xc '() { emulate -LR zsh; alias gl="git pull"; }' or zsh -xc '{ alias gl="git pull"; } 2> /dev/null' Nov 30, 2021 at 6:47
  • 1
    Maybe a plugin sets up a hook function that changes aliases when the current directory is a git worktree. Does it make a difference if the current directory is a git worktree when you restart zsh? Try typeset -f | grep alias to see if some functions change aliases. Nov 30, 2021 at 9:34
  • There are, indeed, 30 more lines inside of a git worktree. Some of which mention aliases. I'll need to dig down and see exactly what's going on. Thanks so much!
    – meangrape
    Nov 30, 2021 at 12:41

1 Answer 1

0

^R was bound to history-incremental-search-backward by the plugin zsh-vim-mode. Commenting it out allowed my binding of ^R to fzf-history-widget to work.

The original mapping was achieved by vim-mode-bindkey viins vicmd -- history-incremental-search-backward '^R'.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .