New feature: now shows current path in the title

and current directory and command when a process is running.
This commit is contained in:
Sindre Sorhus
2013-09-06 16:56:03 +02:00
parent d4d4f2528a
commit b7b0f754f1
3 changed files with 11 additions and 1 deletions

View File

@@ -55,12 +55,21 @@
pure_preexec() { pure_preexec() {
cmd_timestamp=`date +%s` cmd_timestamp=`date +%s`
# shows the current dir and executed command in the title when a process is active
print -Pn "\e]0;$PWD:t: $2\a"
} }
pure_precmd() { pure_precmd() {
# shows the full path in the title
print -Pn '\e]0;%~\a'
# git info
vcs_info vcs_info
# add `%*` to display the time # add `%*` to display the time
print -P '\n%F{blue}%~%F{8}$vcs_info_msg_0_`pure_git_dirty` $username%f %F{yellow}`pure_cmd_exec_time`%f' print -P '\n%F{blue}%~%F{8}$vcs_info_msg_0_`pure_git_dirty` $username%f %F{yellow}`pure_cmd_exec_time`%f'
# reset value since `preexec` isn't always triggered # reset value since `preexec` isn't always triggered
unset cmd_timestamp unset cmd_timestamp
} }

View File

@@ -2,7 +2,7 @@
> Pretty, minimal and fast ZSH prompt > Pretty, minimal and fast ZSH prompt
![screenshot](https://raw.github.com/sindresorhus/pure/master/screenshot.png) ![screenshot](screenshot.png)
## Overview ## Overview
@@ -16,6 +16,7 @@ Most prompts are cluttered, ugly and slow. I wanted something visually pleasing
- Prompt character turns red if the last command didn't exit with 0. - Prompt character turns red if the last command didn't exit with 0.
- Command execution time will be displayed if it exceeds the set threshold. - Command execution time will be displayed if it exceeds the set threshold.
- Username and host is only displayed when in an SSH session. - Username and host is only displayed when in an SSH session.
- Shows the current path in the title and the current directory and command when a process is running.
- Can easily be used as a starting point for your own custom prompt. - Can easily be used as a starting point for your own custom prompt.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 42 KiB