Hacker News new | ask | show | jobs
by dijit 880 days ago
here's a tip for people that I stole from PLAN9:

If your shell is ZSH and you have `setopt autocd` in your .zshrc (though I think this setting is on by default):

export PS1="%~; "

this will result in the prompt: `~; ` where the ~ will change to a path relative to home.

Why do this? Well; it means you can select and paste any line in your history: your prompt becomes part of setting the proper context and is part of the command. Just select the entire line. :D

1 comments

zsh-histdb achieves something similar. Combined with zsh-autosuggestions it's quite nice.

https://github.com/larkery/zsh-histdb