When LP_PATH_KEEP=0 and current dirname were over maximum length the
name was also shorten. With this fixed _lp_shorten_path should now
always return at least the complete current dirname.
The previous implementation had shell specific paths which did not
produce the same result. It did not respect the maximum length which it
calculated. And for specific cases even repeated part of the path.
This implementation is portable across bash and zsh.
It respects maximum length strictly and only exceeds it when it has to
respect LP_PATH_KEEP leading dirs.
It adds support for only showing the current directory, without leading
ones. This fixes Issue #219.
(Rebased by Olivier Mengué on top of more recent changes in that
fucntion)
Parse `git diff --shortstat` to get the line count of *unstaged* changes.
Improvements of the git related stuff are still possible, using more
plumbing commands, like:
* `git diff-index --quiet HEAD` to check for uncommitted changes (branch
color), rather than relying on the `git diff --shortstat HEAD`
* `git ls-files --exclude-standard --others` to check for untracked
files
Complete rewrite of the _lp_get_dirtrim into _lp_set_dirtrim with a much
faster implementation that avoids char by char processing of $PWD.
Also use (( )) builtin.
Reset the LP_OLD_PWD variable on startup.
This makes debugging easier: previously we had to change directory
after a reload to see the changes of the new code for the PWD-cached
parts.
Improvements:
- check if update_terminal_cwd is available instead of relying on the
kernel version
- test the feature once at init time instead of at prompt time
Note that zsh is not yet supported for that feature unless the
update_terminal_cwd has been imported in your environment.
I think it would be possible to support it, but I don't have access to
MacOS X machines, so... patches are welcome!
In some cases (multi user enabled in screen for example), the count of
detached screen sessions was incorrect. The command to locate these has
been improved using a more tolerant regex, which also makes sure the
"Detached" word appears inside a parenthesis (so it's not an attached
screen to a machine called Detach for example).