Prompt
m (explain PWD shortening colourisation) |
(refactor page into implemented/consideration/to be ignored. some new info.) |
||
Line 1: | Line 1: | ||
− | == my personal (zsh) prompt setups has, on one line == |
+ | As a commandline junkie, my prompt is important. It is a key element to my interface. |
+ | |||
+ | It needs to be both informative and terse (I can't stand 2line prompts for eg) |
||
+ | |||
+ | I have used ZSH as my shell of preference since roughly the turn of the century. (previously: bash). Part of the incentive to switch was the prompt interface features found in zsh that were not in bash at the time. (my memory has right-aligned-prompt as notable, but I'm sure there were more reasons than just that ;) |
||
+ | |||
+ | The prompt I use dates it's heritage back to an old dos (specifically: [[wikipedia:4DOS|4DOS]]) prompt that I setup in... 1994, for a guess. |
||
+ | |||
+ | |||
+ | == Features currently implemented == |
||
* last job exit status (invisible when zero) |
* last job exit status (invisible when zero) |
||
Line 13: | Line 13: | ||
* current tty |
* current tty |
||
− | == ideas I don't currently implement == |
+ | == featured under consideration == |
+ | these have been suggested, but not yet implemented. Or maybe I wont implement them - but I haven't decided yet |
||
+ | |||
* per-host auto-colourisation |
* per-host auto-colourisation |
||
** http://screwtape.jottit.com/per-host_prompt_colouring |
** http://screwtape.jottit.com/per-host_prompt_colouring |
||
Line 19: | Line 19: | ||
** http://ft.bewatermyfriend.org/comp/zsh/functions/prompt_ft_setup.html |
** http://ft.bewatermyfriend.org/comp/zsh/functions/prompt_ft_setup.html |
||
*** [http://bewatermyfriend.org/media/vcs_info0.png example of vcs_info] |
*** [http://bewatermyfriend.org/media/vcs_info0.png example of vcs_info] |
||
+ | * active group when not default |
||
+ | |||
+ | == features suggested to me, but will NOT be implemented == |
||
+ | note: some of these were clearly suggested in jest, whilst others are common in other prompt configs |
||
+ | |||
+ | * UID=0 indication (technically simple, but I prefer a more obvious change for my root user prompt. |
||
+ | * username - this is not included mainly for space reasons. I know my username because I'm seeing *my prompt*. I tend to leave the default prompt set for other users on the system (including root) |
||
---- |
---- |
Revision as of 10:13, 12 May 2010
As a commandline junkie, my prompt is important. It is a key element to my interface.
It needs to be both informative and terse (I can't stand 2line prompts for eg)
I have used ZSH as my shell of preference since roughly the turn of the century. (previously: bash). Part of the incentive to switch was the prompt interface features found in zsh that were not in bash at the time. (my memory has right-aligned-prompt as notable, but I'm sure there were more reasons than just that ;)
The prompt I use dates it's heritage back to an old dos (specifically: 4DOS) prompt that I setup in... 1994, for a guess.
Features currently implemented
- last job exit status (invisible when zero)
- host:path in network friendly (ish) format
- path shortening to last three components, plus subtle visual indication when this occurs (deliminating colon changes from host colour to directory colour)
- this shortening balances path context needs with space limitations. and is why the preceeding 'network friendly' format is "ish" :)
- path colourisation to indicate whether $PWD is RW or not (not usually means RO, but may also mean 'directory does not exist')
- count of background jobs (invisible if zero)
- ^ and $ reminder mnemonic for regex start/end line matching (I have a dyslexia about this!)
- live time and load average (load gets dynamic colourisation also, but is invisible below threshold (set to 0.3 for me)
- for values of "live" that = "20 second refresh"
- this refresh ensures that an abandoned prompt will keep-alive a remote shell over dodgy NAT :)
- current tty
featured under consideration
these have been suggested, but not yet implemented. Or maybe I wont implement them - but I haven't decided yet
- per-host auto-colourisation
- vcs_info (I would probably replace tty info with this, with a colourisation to help the glancing eye notice)
- active group when not default
features suggested to me, but will NOT be implemented
note: some of these were clearly suggested in jest, whilst others are common in other prompt configs
- UID=0 indication (technically simple, but I prefer a more obvious change for my root user prompt.
- username - this is not included mainly for space reasons. I know my username because I'm seeing *my prompt*. I tend to leave the default prompt set for other users on the system (including root)
here is my prompt:
http://wiki.thorx.net/~nemo/s/zsh_ps1.txt
warning: it's full of comments and code cruft, both from old revisions, and also future plans.
screenshot in action