├── jog └── README.md /jog: -------------------------------------------------------------------------------- 1 | grep -v "jog" ~/.zsh_history_ext | grep -a --color=never "${PWD} " | cut -f1 -d"⋮" | tail 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jog 2 | 3 | Print the last 10 commands you ran in the current directory 4 | 5 | ![Gif of Fezzik jogging memory](https://media1.giphy.com/media/5PNM2yFGbUVK8/giphy.gif?cid=ecf05e47a644d0cfbeab72eab8ea67edb714352983ffd82b&rid=giphy.gif) 6 | 7 | ## Usage 8 | 9 | 1. Add this function to your `.zshrc` 10 | 11 | ``` 12 | function zshaddhistory() { 13 | if [[ "${1}" != ${~HISTORY_IGNORE} ]]; then 14 | echo "${1%%$'\n'}⋮${PWD} " >> ~/.zsh_history_ext 15 | fi 16 | } 17 | ``` 18 | 19 | 2. Download or copy the `jog` script from this repo and place it somewhere in your `$PATH`. 20 | 21 | 3. Run `touch ~/.zsh_history_ext ; chmod 600 ~/.zsh_history_ext` to ensure that only you can read and write your history. 22 | 23 | 4. Restart your current terminal sessions for changes to take effect. `exec $SHELL` 24 | 25 | 5. Use `jog` whenever you find yourself lost and confused. 26 | 27 | It's not possible to retroactively store the directory in which a command was run, so **this tool will only work from this point forward.** 28 | 29 | ## Todo List 30 | 31 | Contributions and feature requests are welcome 32 | 33 | - Add support for other shells: bash, fish. 34 | - Automatically truncate `.zsh_history_ext` when `HISTSIZE` is surpassed 35 | --------------------------------------------------------------------------------