gabebw / most-used

Find your most-used shell commands
BSD 3-Clause "New" or "Revised" License
12 stars 0 forks source link

Set necessary environment variables for Zsh history #20

Closed gabebw closed 7 years ago

gabebw commented 7 years ago

Zsh doesn't have $HISTFILE set by default, but its startup wizard sets it to $HOME/.zsh_history. Thus, default it to $HOME/.zsh_history since we're not loading any startup files. Someone could set $HISTFILE to something else, but for now I don't want to load any RC files.

Both $HISTFILE and $HISTSIZE must be set, otherwise fc only prints commands from the present session. Set $HISTSIZE to something huge so it gets all of the entries, then load the history events with fc -R.

Remove the --no-globalrcs --no-rcs flag so that Zsh knows about custom $HISTFILE settings. However, this also means that (at least on my machine) Zsh puts the path to the Homebrew-installed most-used-exe first, and so it doesn't see the local most-used-exe. So, just copy over the commands from most-used-zsh to run-zsh. It's not very DRY, but it's guaranteed to work.