zsh: shorten window title
This commit is contained in:
		
							parent
							
								
									4724527b74
								
							
						
					
					
						commit
						650a1b0e21
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
					@ -35,6 +35,11 @@ prompt.set_bang() {
 | 
				
			||||||
    prompt_symbols[bang]=$1
 | 
					    prompt_symbols[bang]=$1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					precmd.window_title() {
 | 
				
			||||||
 | 
					    typeset dir=$(pwd)
 | 
				
			||||||
 | 
					    printf '\033]0;%s:%s\007' ${HOST%%.*} ${dir##*/}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
precmd.is_git_repo() {
 | 
					precmd.is_git_repo() {
 | 
				
			||||||
    typeset prompt_git_dir
 | 
					    typeset prompt_git_dir
 | 
				
			||||||
    prompt_git_dir=$(git rev-parse --git-dir 2>/dev/null) || return 1
 | 
					    prompt_git_dir=$(git rev-parse --git-dir 2>/dev/null) || return 1
 | 
				
			||||||
| 
						 | 
					@ -132,10 +137,6 @@ precmd.prompt.update() {
 | 
				
			||||||
    zle && zle reset-prompt
 | 
					    zle && zle reset-prompt
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
precmd.window_title() {
 | 
					 | 
				
			||||||
    printf '\033]0;%s %s\007' ${HOST%%.*} $(pwd)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
precmd() {
 | 
					precmd() {
 | 
				
			||||||
    precmd.window_title
 | 
					    precmd.window_title
 | 
				
			||||||
    if precmd.is_git_repo; then
 | 
					    if precmd.is_git_repo; then
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue