Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advise to start with ': ' first and end with '; ' -- helps cut-n-paste #17

Open
nicowilliams opened this issue Aug 14, 2013 · 1 comment

Comments

@nicowilliams
Copy link

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).

@xta
Copy link
Owner

xta commented Aug 15, 2013

Hi @nicowilliams

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants