From 5f79ab5547f51bd32dcd0a1b21fc26c8720711ba Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Tue, 27 Jan 2015 21:00:07 -0600 Subject: Move chpwd update output from chpwd hook to precmd to avoid contaminating script/function output --- lib/termsupport.zsh | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index d9f2b64d4..ce36f229f 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -16,12 +16,19 @@ function title { ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" -#Appears when you have the prompt +# Runs when you have the prompt function omz_termsupport_precmd { title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE + + # Notify Terminal.app of current directory using undocumented OSC sequence + # found in OS X 10.9 and 10.10's /etc/bashrc + if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then + local PWD_URL="file://$HOSTNAME${PWD// /%20}" + printf '\e]7;%s\a' "$PWD_URL" + fi } -#Appears at the beginning of (and during) of command execution +# Runs at the beginning of (and during) of command execution function omz_termsupport_preexec { emulate -L zsh setopt extended_glob @@ -33,18 +40,5 @@ function omz_termsupport_preexec { title '$CMD' '%100>...>$LINE%<<' } -#Appears each time pwd is changed -function omz_termsupport_chpwd { - #Notify Terminal.app of current directory using undocumented OSC sequence - #found in OS X 10.10's /etc/bashrc - if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then - local PWD_URL="file://$HOSTNAME${PWD// /%20}" - printf '\e]7;%s\a' "$PWD_URL" - fi -} -#Fire it once so the pwd is set properly upon shell startup -omz_termsupport_chpwd - precmd_functions+=(omz_termsupport_precmd) preexec_functions+=(omz_termsupport_preexec) -chpwd_functions+=(omz_termsupport_chpwd) -- cgit v1.2.3-70-g09d2 From be7028012ecc97bf8976d5de0aed51869720be2a Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Wed, 4 Feb 2015 01:00:51 -0500 Subject: Reword comments on termsupport internal functions. --- lib/termsupport.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index ce36f229f..bd0cf6ffe 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -16,7 +16,7 @@ function title { ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" -# Runs when you have the prompt +# Runs before showing the prompt function omz_termsupport_precmd { title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE @@ -28,7 +28,7 @@ function omz_termsupport_precmd { fi } -# Runs at the beginning of (and during) of command execution +# Runs before executing the command function omz_termsupport_preexec { emulate -L zsh setopt extended_glob -- cgit v1.2.3-70-g09d2 From 25b1cd687b28cb8d05229130ee5a0e2494276894 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Fri, 10 Jan 2014 23:32:20 +0100 Subject: Brings all directory stuff to directories.zsh - Cleans out aliases.zsh. - Removes unneeded cd function. --- lib/aliases.zsh | 13 ------------- lib/directories.zsh | 38 +++++++++++++++----------------------- 2 files changed, 15 insertions(+), 36 deletions(-) (limited to 'lib') diff --git a/lib/aliases.zsh b/lib/aliases.zsh index aae865046..c67f854a7 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -1,11 +1,3 @@ -# Push and pop directories on directory stack -alias pu='pushd' -alias po='popd' - -# Basic directory operations -alias ...='cd ../..' -alias -- -='cd -' - # Super user alias _='sudo' alias please='sudo' @@ -25,11 +17,6 @@ then else alias history='fc -l 1' fi -# List direcory contents -alias lsa='ls -lah' -alias l='ls -lah' -alias ll='ls -lh' -alias la='ls -lAh' alias afind='ack-grep -il' diff --git a/lib/directories.zsh b/lib/directories.zsh index 02743e0c7..1693d5dd1 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -3,12 +3,10 @@ setopt auto_pushd setopt pushd_ignore_dups setopt pushdminus -alias ..='cd ..' -alias cd..='cd ..' -alias cd...='cd ../..' -alias cd....='cd ../../..' -alias cd.....='cd ../../../..' -alias cd/='cd /' +alias -g ...='../..' +alias -g ....='../../..' +alias -g .....='../../../..' +alias -g ......='../../../../..' alias 1='cd -' alias 2='cd -2' @@ -20,23 +18,17 @@ alias 7='cd -7' alias 8='cd -8' alias 9='cd -9' -cd () { - if [[ "x$*" == "x..." ]]; then - cd ../.. - elif [[ "x$*" == "x...." ]]; then - cd ../../.. - elif [[ "x$*" == "x....." ]]; then - cd ../../../.. - elif [[ "x$*" == "x......" ]]; then - cd ../../../../.. - elif [ -d ~/.autoenv ]; then - source ~/.autoenv/activate.sh - autoenv_cd "$@" - else - builtin cd "$@" - fi -} - alias md='mkdir -p' alias rd=rmdir alias d='dirs -v | head -10' + +# List direcory contents +alias lsa='ls -lah' +alias l='ls -la' +alias ll='ls -l' +alias la='ls -lA' +alias sl=ls # often screw this up + +# Push and pop directories on directory stack +alias pu='pushd' +alias po='popd' -- cgit v1.2.3-70-g09d2 From d33b0aae917c62012bf203538ba86d6236869834 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Fri, 10 Jan 2014 23:50:19 +0100 Subject: Refactors history alias and moves it. More compact case statement instead of the ugly if elif... else statement. Moves it to history.zsh --- lib/aliases.zsh | 14 -------------- lib/history.zsh | 9 +++++++++ 2 files changed, 9 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/aliases.zsh b/lib/aliases.zsh index c67f854a7..da29fde58 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -4,19 +4,5 @@ alias please='sudo' #alias g='grep -in' -# Show history -if [ "$HIST_STAMPS" = "mm/dd/yyyy" ] -then - alias history='fc -fl 1' -elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ] -then - alias history='fc -El 1' -elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ] -then - alias history='fc -il 1' -else - alias history='fc -l 1' -fi - alias afind='ack-grep -il' diff --git a/lib/history.zsh b/lib/history.zsh index e78a98e9e..5de71c2d3 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -6,6 +6,15 @@ fi HISTSIZE=10000 SAVEHIST=10000 +# Show history +case $HIST_STAMPS in + "mm/dd/yyyy") alias history='fc -fl 1' ;; + "dd.mm.yyyy") alias history='fc -El 1' ;; + "yyyy-mm-dd") alias history='fc -il 1' ;; + *) alias history='fc -l 1' ;; +esac + +setopt append_history setopt extended_history setopt hist_expire_dups_first setopt hist_ignore_dups # ignore duplication command history list -- cgit v1.2.3-70-g09d2 From 101149b1ae6fb5ce0b982289fca901b2feab5439 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Fri, 10 Jan 2014 23:53:14 +0100 Subject: Moves remaining aliases to misc and deletes file. There were only three aliases left in aliases.zsh File deleted! --- lib/aliases.zsh | 8 -------- lib/misc.zsh | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) delete mode 100644 lib/aliases.zsh (limited to 'lib') diff --git a/lib/aliases.zsh b/lib/aliases.zsh deleted file mode 100644 index da29fde58..000000000 --- a/lib/aliases.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# Super user -alias _='sudo' -alias please='sudo' - -#alias g='grep -in' - -alias afind='ack-grep -il' - diff --git a/lib/misc.zsh b/lib/misc.zsh index a8678b8ec..892d78ef3 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -13,3 +13,10 @@ export PAGER="less" export LESS="-R" export LC_CTYPE=$LANG + +## super user alias +alias _='sudo' +alias please='sudo' + +## more intelligent acking for ubuntu users +alias afind='ack-grep -il' -- cgit v1.2.3-70-g09d2 From 83c4e0620689d2410056bddcdfbf8e300673e982 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Fri, 10 Jan 2014 23:55:10 +0100 Subject: Moves a bindkey call from misc to key-bindings. --- lib/key-bindings.zsh | 3 +++ lib/misc.zsh | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 9063c6a18..eb2b58058 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -64,6 +64,9 @@ autoload -U edit-command-line zle -N edit-command-line bindkey '\C-x\C-e' edit-command-line +# file rename magick +bindkey "^[m" copy-prev-shell-word + # consider emacs keybindings: #bindkey -e ## emacs key bindings diff --git a/lib/misc.zsh b/lib/misc.zsh index 892d78ef3..ea8a05fcb 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -2,9 +2,6 @@ autoload -U url-quote-magic zle -N self-insert url-quote-magic -## file rename magick -bindkey "^[m" copy-prev-shell-word - ## jobs setopt long_list_jobs -- cgit v1.2.3-70-g09d2 From 4b4292a496c139039807f082425cc5507f762c0d Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Sat, 15 Mar 2014 00:00:14 +0100 Subject: Fix a typo --- lib/directories.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/directories.zsh b/lib/directories.zsh index 1693d5dd1..b7a53ecfe 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -22,7 +22,7 @@ alias md='mkdir -p' alias rd=rmdir alias d='dirs -v | head -10' -# List direcory contents +# List directory contents alias lsa='ls -lah' alias l='ls -la' alias ll='ls -l' -- cgit v1.2.3-70-g09d2 From 51946eb3ce8021aebe940f879225828d89c12317 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 9 Feb 2015 20:29:10 +0100 Subject: Implement deletion of sl alias as per #3055 --- lib/directories.zsh | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/directories.zsh b/lib/directories.zsh index b7a53ecfe..1a9698544 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -27,7 +27,6 @@ alias lsa='ls -lah' alias l='ls -la' alias ll='ls -l' alias la='ls -lA' -alias sl=ls # often screw this up # Push and pop directories on directory stack alias pu='pushd' -- cgit v1.2.3-70-g09d2 From 2193135ebc4ce0778ff6949b448e4526dbd34284 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 9 Feb 2015 20:43:48 +0100 Subject: Clean up appearance lib file and redundant `colors` calls in other files --- lib/theme-and-appearance.zsh | 8 +++----- plugins/git-prompt/git-prompt.plugin.zsh | 3 --- plugins/jump/jump.plugin.zsh | 1 - themes/adben.zsh-theme | 15 ++++++--------- themes/apple.zsh-theme | 1 - themes/gnzh.zsh-theme | 3 +-- themes/half-life.zsh-theme | 2 -- themes/jonathan.zsh-theme | 5 +---- themes/kolo.zsh-theme | 2 -- themes/mikeh.zsh-theme | 2 -- themes/simonoff.zsh-theme | 5 +---- themes/steeef.zsh-theme | 2 -- themes/zhann.zsh-theme | 2 -- 13 files changed, 12 insertions(+), 39 deletions(-) (limited to 'lib') diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 0353f9db4..926303ca4 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -1,14 +1,13 @@ # ls colors -autoload colors; colors; +autoload -U colors && colors export LSCOLORS="Gxfxcxdxbxegedabagacad" -#export LS_COLORS # Enable ls colors if [ "$DISABLE_LS_COLORS" != "true" ] then # Find the option for using colors in ls, depending on the version: Linux or BSD if [[ "$(uname -s)" == "NetBSD" ]]; then - # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); + # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); # otherwise, leave ls as is, because NetBSD's ls doesn't support -G gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' elif [[ "$(uname -s)" == "OpenBSD" ]]; then @@ -23,7 +22,7 @@ fi #setopt no_beep setopt auto_cd setopt multios -setopt cdablevarS +setopt cdablevars if [[ x$WINDOW != x ]] then @@ -43,4 +42,3 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is c # Setup the prompt with pretty colors setopt prompt_subst - diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh index 01b8a88d9..d868a5fe1 100644 --- a/plugins/git-prompt/git-prompt.plugin.zsh +++ b/plugins/git-prompt/git-prompt.plugin.zsh @@ -2,9 +2,6 @@ # http://github.com/olivierverdier/zsh-git-prompt # export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt -# Initialize colors. -autoload -U colors -colors # Allow for functions in the prompt. setopt PROMPT_SUBST diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh index b16814fe4..d082c11e5 100644 --- a/plugins/jump/jump.plugin.zsh +++ b/plugins/jump/jump.plugin.zsh @@ -27,7 +27,6 @@ unmark() { rm -i "$MARKPATH/$1" } -autoload colors marks() { for link in $MARKPATH/*(@); do local markname="$fg[cyan]${link:t}$reset_color" diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme index 6869c8a20..212b823a5 100644 --- a/themes/adben.zsh-theme +++ b/themes/adben.zsh-theme @@ -69,17 +69,17 @@ function precmd { #Choose from all databases, regardless of whether they are considered "offensive" fortune -a } - #obtains the tip + #obtains the tip ps1_command_tip () { wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d' - } + } prompt_header () { if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then ps1_command_tip else ps1_fortune - fi - } + fi + } PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}" # set a simple variable to show when in screen if [[ -n "${WINDOW}" ]]; then @@ -99,11 +99,8 @@ prompt_context () { set_prompt () { # required for the prompt setopt prompt_subst - autoload colors zsh/terminfo - if [[ "$terminfo[colors]" -gt 8 ]]; then - colors - fi - + autoload zsh/terminfo + # ######### PROMPT ######### PROMPT='${PROMPT_HEAD} ${RED_START}$(prompt_context) diff --git a/themes/apple.zsh-theme b/themes/apple.zsh-theme index 275341dc6..95e6249fa 100644 --- a/themes/apple.zsh-theme +++ b/themes/apple.zsh-theme @@ -7,7 +7,6 @@ get_git_dirty() { } autoload -Uz vcs_info -autoload -U colors && colors zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme index 0519fbefb..ab154c1e5 100644 --- a/themes/gnzh.zsh-theme +++ b/themes/gnzh.zsh-theme @@ -2,8 +2,7 @@ # Based on bira theme # load some modules -autoload -U colors zsh/terminfo # Used in the colour alias below -colors +autoload -U zsh/terminfo # Used in the colour alias below setopt prompt_subst # make some aliases for the colours: (could use normal escape sequences too) diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme index 942affa94..a3c505706 100644 --- a/themes/half-life.zsh-theme +++ b/themes/half-life.zsh-theme @@ -13,8 +13,6 @@ function virtualenv_info { PR_GIT_UPDATE=1 setopt prompt_subst -autoload colors -colors autoload -U add-zsh-hook autoload -Uz vcs_info diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index bca92970c..2f0e77431 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -44,10 +44,7 @@ setprompt () { ### # See if we can use colors. - autoload colors zsh/terminfo - if [[ "$terminfo[colors]" -ge 8 ]]; then - colors - fi + autoload zsh/terminfo for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' diff --git a/themes/kolo.zsh-theme b/themes/kolo.zsh-theme index e743289c3..51b0af724 100644 --- a/themes/kolo.zsh-theme +++ b/themes/kolo.zsh-theme @@ -1,5 +1,3 @@ -autoload -U colors && colors - autoload -Uz vcs_info zstyle ':vcs_info:*' stagedstr '%F{green}●' diff --git a/themes/mikeh.zsh-theme b/themes/mikeh.zsh-theme index 943f04d38..a95383ba5 100644 --- a/themes/mikeh.zsh-theme +++ b/themes/mikeh.zsh-theme @@ -1,6 +1,4 @@ setopt prompt_subst -autoload colors -colors autoload -U add-zsh-hook autoload -Uz vcs_info diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme index fb4d32e24..63ce4261b 100644 --- a/themes/simonoff.zsh-theme +++ b/themes/simonoff.zsh-theme @@ -63,10 +63,7 @@ setprompt () { ### # See if we can use colors. - autoload colors zsh/terminfo - if [[ "$terminfo[colors]" -ge 8 ]]; then - colors - fi + autoload zsh/terminfo for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index e38188d35..13728ca9a 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -15,8 +15,6 @@ function virtualenv_info { PR_GIT_UPDATE=1 setopt prompt_subst -autoload colors -colors autoload -U add-zsh-hook autoload -Uz vcs_info diff --git a/themes/zhann.zsh-theme b/themes/zhann.zsh-theme index 5c0854730..27597ec6c 100644 --- a/themes/zhann.zsh-theme +++ b/themes/zhann.zsh-theme @@ -1,5 +1,3 @@ -autoload -U colors && colors - autoload -Uz vcs_info zstyle ':vcs_info:*' stagedstr '%F{green}●' -- cgit v1.2.3-70-g09d2 From 4fc6dccb4286828c7cd53d3612ec69b0c0d9aaf2 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Sat, 20 Dec 2014 02:24:26 -0500 Subject: term: Move DISABLE_AUTO_TITLE check to hooks Move the DISABLE_AUTO_TITLE check from title() to the preX hook functions that call it, to allow the title() function to be used directly by user or other callers. --- lib/termsupport.zsh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index bd0cf6ffe..2fa61c431 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -1,8 +1,16 @@ -#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title -#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 -#Fully support screen, iterm, and probably most modern xterm and rxvt +# Set terminal window and tab/icon title +# +# usage: title short_tab_title [long_window_title] +# +# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 +# Fully supports screen, iterm, and probably most modern xterm and rxvt +# (In screen, only short_tab_title is used) +# Limited support for Apple Terminal (Terminal can't set window and tab separately) function title { - if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then + if [[ $2 == "" ]]; then + 2="$1" + fi + if [[ "$EMACS" == *term* ]]; then return fi if [[ "$TERM" == screen* ]]; then @@ -18,6 +26,10 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" # Runs before showing the prompt function omz_termsupport_precmd { + if [[ $DISABLE_AUTO_TITLE == true ]]; then + return + fi + title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE # Notify Terminal.app of current directory using undocumented OSC sequence @@ -30,6 +42,10 @@ function omz_termsupport_precmd { # Runs before executing the command function omz_termsupport_preexec { + if [[ $DISABLE_AUTO_TITLE == true ]]; then + return + fi + emulate -L zsh setopt extended_glob -- cgit v1.2.3-70-g09d2 From b7e5dd35efb0750634eb16b7040337ce80f67684 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 10 Feb 2015 19:43:25 +0100 Subject: Quick-fix code style --- lib/termsupport.zsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 2fa61c431..f21b0b041 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -7,12 +7,12 @@ # (In screen, only short_tab_title is used) # Limited support for Apple Terminal (Terminal can't set window and tab separately) function title { - if [[ $2 == "" ]]; then - 2="$1" - fi - if [[ "$EMACS" == *term* ]]; then - return - fi + [[ "$EMACS" == *term* ]] && return + + # if $2 is unset use $1 as default + # if it is set and empty, leave it as is + : ${2=$1} + if [[ "$TERM" == screen* ]]; then print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ $TERM == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then -- cgit v1.2.3-70-g09d2 From 2e41d06b7655067272cee1e54d2d66693136a90f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 10 Feb 2015 19:53:40 +0100 Subject: Use quoted $TERM value everywhere --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index f21b0b041..58c6203a0 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -15,7 +15,7 @@ function title { if [[ "$TERM" == screen* ]]; then print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars - elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ $TERM == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then print -Pn "\e]2;$2:q\a" #set window name print -Pn "\e]1;$1:q\a" #set icon (=tab) name fi -- cgit v1.2.3-70-g09d2 From 448e966129bb5c08c7b2da4636491f0f890cf0ab Mon Sep 17 00:00:00 2001 From: frozen_dude Date: Mon, 29 Jul 2013 20:04:23 +0200 Subject: Fix for bad LC_CTYPE entry LANG is a colon-separated list of prefered locales; LC_CTYPE is single entry, therefore we need to remove all but one entry. Also, there is no need setting it if it is already set (LC_ALL also sets LC_CTYPE, so we check it too). --- lib/misc.zsh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/misc.zsh b/lib/misc.zsh index ea8a05fcb..6987c099c 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -9,11 +9,21 @@ setopt long_list_jobs export PAGER="less" export LESS="-R" -export LC_CTYPE=$LANG - ## super user alias alias _='sudo' alias please='sudo' ## more intelligent acking for ubuntu users alias afind='ack-grep -il' + +## how to interpret text characters +if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then # only define if undefined + export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG + [[ -z "$LC_CTYPE" ]] && \ + export LC_CTYPE=`locale -a | grep en_US.utf8 | head -1` + [[ -z "$LC_CTYPE" ]] && \ + export LC_CTYPE=`locale -a | grep en_US | head -1` + [[ -z "$LC_CTYPE" ]] && \ + export LC_CTYPE=C # default to internal encoding. +fi + -- cgit v1.2.3-70-g09d2 From 0edf416bea1a180e82a8f5f96444d74fabb5867f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 9 Feb 2015 18:57:23 +0100 Subject: Temporarily delete over-engineered solution --- lib/misc.zsh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/misc.zsh b/lib/misc.zsh index 6987c099c..0b7cb2696 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -16,14 +16,7 @@ alias please='sudo' ## more intelligent acking for ubuntu users alias afind='ack-grep -il' -## how to interpret text characters -if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then # only define if undefined - export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG - [[ -z "$LC_CTYPE" ]] && \ - export LC_CTYPE=`locale -a | grep en_US.utf8 | head -1` - [[ -z "$LC_CTYPE" ]] && \ - export LC_CTYPE=`locale -a | grep en_US | head -1` - [[ -z "$LC_CTYPE" ]] && \ - export LC_CTYPE=C # default to internal encoding. +# only define LC_CTYPE if undefined +if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then + export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG fi - -- cgit v1.2.3-70-g09d2