aboutsummaryrefslogtreecommitdiffstats
path: root/_zsh
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-03-19 12:46:30 +0800
committerAaron LI <aaronly.me@outlook.com>2017-03-19 12:46:30 +0800
commit2cc4962be6a65ce3d34197084216318e404cc2a9 (patch)
tree0e406f5ddb804e557a429dfbd4896170059ef266 /_zsh
parent9fee8ed6e79decd9481cde6540e1575b3ba1e9ed (diff)
downloaddotfiles-2cc4962be6a65ce3d34197084216318e404cc2a9.tar.bz2
zsh: Move precmd() and preexec() to hooks.zsh
Diffstat (limited to '_zsh')
-rw-r--r--_zsh/30-prompt.zsh7
-rw-r--r--_zsh/40-hooks.zsh39
2 files changed, 13 insertions, 33 deletions
diff --git a/_zsh/30-prompt.zsh b/_zsh/30-prompt.zsh
index d1c70c2..bd821d1 100644
--- a/_zsh/30-prompt.zsh
+++ b/_zsh/30-prompt.zsh
@@ -32,11 +32,6 @@ function gitpwd() {
function myprompt() {
- case "$TERM" in
- xterm*|rxvt*)
- precmd() { [[ -t 1 ]] && print -Pn "\e]0;%m: %~\a" }
- preexec() { [[ -t 1 ]] && print -n "\e]0;$HOST: ${(q)1//(#m)[$'\000-\037\177-']/${(q)MATCH}}\a" }
- esac
setopt PROMPT_SUBST
nbsp=$'\u00A0'
PROMPT='%B%F{green}%m%(?.. %F{red}%??)%(1j. %F{yellow}%j&.)%b%f $(gitpwd)%B%(!.%F{red}.%F{green})%#${SSH_CONNECTION:+%#}$nbsp%b%f'
@@ -46,7 +41,7 @@ function myprompt() {
}
-# Setup prompts
+# Set prompts
myprompt
diff --git a/_zsh/40-hooks.zsh b/_zsh/40-hooks.zsh
index defee0b..da15a29 100644
--- a/_zsh/40-hooks.zsh
+++ b/_zsh/40-hooks.zsh
@@ -1,34 +1,19 @@
#
# zsh/hooks.zsh
#
-
-# Put the string "hostname::/full/directory/path" in the title bar:
-function set_term_title {
- echo -ne "\e]2;$PWD\a"
-}
-
-# Put the parentdir/currentdir in the tab
-function set_term_tab {
- echo -ne "\e]1;$PWD:h:t/$PWD:t\a"
-}
-
-function precmd {
- set_term_title
- set_term_tab
-}
-
-
-#function set_running_app {
-# printf "\e]1; $PWD:t:$(history $HISTCMD | cut -b7- ) \a"
-#}
-#
-#function preexec {
-# set_running_app
-#}
+# Credit: http://chneukirchen.org/dotfiles/.zshrc
#
-#function postexec {
-# set_running_app
-#}
+
+case "$TERM" in
+xterm*|rxvt*)
+ function precmd() {
+ [[ -t 1 ]] && print -Pn "\e]0;%m: %~\a"
+ }
+ function preexec() {
+ [[ -t 1 ]] && print -n "\e]0;$HOST: ${(q)1//(#m)[$'\000-\037\177-']/${(q)MATCH}}\a"
+ }
+ ;;
+esac
# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: #