You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for your suggestion. For this issue, if I understand correctly, you want to have an option to wrap PS1 strings with : and ;. I don't see this as a common use case, but would be interested to see if others want this.
If you start $PS1 with ': ' and end with '; ' then you cut-n-paste entire command lines more easily (no need to grab from the end of the prompt).
Bonus: single-quote the rest of the PS1 to avoid glob injection.
Bonus: set PS2= to further help the cut-n-paste of long command-lines.
Bonus: add number of files dirty (modified/added/deleted in git workspace or index but not committed).
Bonus: add support for other VCSes.
I have support for Fossil, Mercurial, and git, in my shell startup. I've a set of functions for this. I like to format my prompt like this:
: vcs:project[branch]:TOP/.../basename-of-PWD[number-of-dirty-files:number-of-history-commands]%;
plus colors. See my .kshaliases. I then set PS1='$(vcs_ps1)'.
https://github.com/nicowilliams/env/blob/master/.kshaliases
Yes, ksh, I know. Not too hard to port to bash. See https://github.com/jakobi/script-archive/blob/master/cli.shell.functions/dir.shell/cd.nico_cd_for_bash_and_ksh.func for some help with writing ksh/bash compat code (also, those functions are awesome).
The text was updated successfully, but these errors were encountered: