From 68cec79d32baeb96efc357ba94c0bfe5b4059c90 Mon Sep 17 00:00:00 2001 From: Kyle West Date: Mon, 30 Jan 2012 22:51:58 -0500 Subject: Added documentation to key bindings. Conflicts: lib/key-bindings.zsh --- lib/key-bindings.zsh | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'lib') diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 5f499f3e8..e69de29bb 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -1,50 +0,0 @@ -# TODO: Explain what some of this does.. - -bindkey -e -bindkey '\ew' kill-region -bindkey -s '\el' "ls\n" -bindkey '^r' history-incremental-search-backward -bindkey "^[[5~" up-line-or-history -bindkey "^[[6~" down-line-or-history - -# make search up and down work, so partially type and hit up/down to find relevant stuff -bindkey '^[[A' up-line-or-search -bindkey '^[[B' down-line-or-search - -bindkey "^[[H" beginning-of-line -bindkey "^[[1~" beginning-of-line -bindkey "^[OH" beginning-of-line -bindkey "^[[F" end-of-line -bindkey "^[[4~" end-of-line -bindkey "^[OF" end-of-line -bindkey ' ' magic-space # also do history expansion on space - -bindkey "^[[1;5C" forward-word -bindkey "^[[1;5D" backward-word - -bindkey '^[[Z' reverse-menu-complete - -# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ -bindkey '^?' backward-delete-char -bindkey "^[[3~" delete-char -bindkey "^[3;5~" delete-char -bindkey "\e[3~" delete-char - -# consider emacs keybindings: - -#bindkey -e ## emacs key bindings -# -#bindkey '^[[A' up-line-or-search -#bindkey '^[[B' down-line-or-search -#bindkey '^[^[[C' emacs-forward-word -#bindkey '^[^[[D' emacs-backward-word -# -#bindkey -s '^X^Z' '%-^M' -#bindkey '^[e' expand-cmd-path -#bindkey '^[^I' reverse-menu-complete -#bindkey '^X^N' accept-and-infer-next-history -#bindkey '^W' kill-region -#bindkey '^I' complete-word -## Fix weird sequence that rxvt produces -#bindkey -s '^[[Z' '\t' -# -- cgit v1.2.3-70-g09d2 From f7708d4181374cfbd223e071f7253018f28e5509 Mon Sep 17 00:00:00 2001 From: Kyle West Date: Mon, 30 Jan 2012 23:04:06 -0500 Subject: forgot to save before committing. doh --- lib/key-bindings.zsh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'lib') diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index e69de29bb..195bbb38e 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -0,0 +1,54 @@ +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets + +bindkey -e # Use emacs key bindings + +bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark +bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls +bindkey -s '\e.' '..\n' # [Esc-.] - run command: .. (up directory) +bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line. +bindkey '^[[5~' up-line-or-history # [PageUp] - Up a line of history +bindkey '^[[6~' down-line-or-history # [PageDown] - Down a line of history + +bindkey '^[[A' up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward +bindkey '^[[B' down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward + +bindkey '^[[H' beginning-of-line # [Home] - Go to beginning of line +bindkey '^[[1~' beginning-of-line # [Home] - Go to beginning of line +bindkey '^[OH' beginning-of-line # [Home] - Go to beginning of line +bindkey '^[[F' end-of-line # [End] - Go to end of line +bindkey '^[[4~' end-of-line # [End] - Go to end of line +bindkey '^[OF' end-of-line # [End] - Go to end of line + +bindkey ' ' magic-space # [Space] - do history expansion + +bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word +bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word + +bindkey '^[[Z' reverse-menu-complete # [TODO] - Perform menu completion, like menu-complete, except that if a menu completion is already in progress, move to the previous completion rather than the next. + +# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ +bindkey '^?' backward-delete-char # [Delete] - delete backward +bindkey '^[[3~' delete-char # [fn-Delete] - delete forward +bindkey '^[3;5~' delete-char # [TODO] - delete forward +bindkey '\e[3~' delete-char # [TODO] - delete forward + +# consider emacs keybindings: + +#bindkey -e ## emacs key bindings +# +#bindkey '^[[A' up-line-or-search +#bindkey '^[[B' down-line-or-search +#bindkey '^[^[[C' emacs-forward-word +#bindkey '^[^[[D' emacs-backward-word +# +#bindkey -s '^X^Z' '%-^M' +#bindkey '^[e' expand-cmd-path +#bindkey '^[^I' reverse-menu-complete +#bindkey '^X^N' accept-and-infer-next-history +#bindkey '^W' kill-region +#bindkey '^I' complete-word +## Fix weird sequence that rxvt produces +#bindkey -s '^[[Z' '\t' +# -- cgit v1.2.3-70-g09d2 From 3839c6e9e62a2671b1d3f5662e4d2bc3984c3f9e Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Sat, 17 Mar 2012 22:03:01 -0300 Subject: Don't clobber standard Esc+. behavior Esc+. works as "last arg" on both bash and zsh. Seems like a shame to introduce a new standard. Conflicts: lib/key-bindings.zsh --- lib/key-bindings.zsh | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 195bbb38e..8168c8d90 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -6,7 +6,6 @@ bindkey -e # Use emacs key bindings bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls -bindkey -s '\e.' '..\n' # [Esc-.] - run command: .. (up directory) bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line. bindkey '^[[5~' up-line-or-history # [PageUp] - Up a line of history bindkey '^[[6~' down-line-or-history # [PageDown] - Down a line of history -- cgit v1.2.3-70-g09d2 From ff0cafa14db5b728f823ee486ec1bf5a9d2725eb Mon Sep 17 00:00:00 2001 From: Felix Dreissig Date: Sun, 14 Oct 2012 00:07:47 +0200 Subject: Make sure the terminal is always in application mode when zle is active. --- lib/key-bindings.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 8168c8d90..a57b04122 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -2,6 +2,19 @@ # http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins # http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets +# Make sure that the terminal is in application mode when zle is active, since +# only then values from $terminfo are valid +if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then + function zle-line-init() { + echoti smkx + } + function zle-line-finish() { + echoti rmkx + } + zle -N zle-line-init + zle -N zle-line-finish +fi + bindkey -e # Use emacs key bindings bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark -- cgit v1.2.3-70-g09d2 From 174c9177aa34b4c05bb5a1c6f637e6fa479a8e10 Mon Sep 17 00:00:00 2001 From: Felix Dreissig Date: Sun, 14 Oct 2012 02:32:48 +0200 Subject: Replace hardcoded key escape sequeneces with dynamic ones from terminfo. --- lib/key-bindings.zsh | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index a57b04122..4a00764da 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -20,31 +20,24 @@ bindkey -e # Use emacs key bindings bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line. -bindkey '^[[5~' up-line-or-history # [PageUp] - Up a line of history -bindkey '^[[6~' down-line-or-history # [PageDown] - Down a line of history +bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history +bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history -bindkey '^[[A' up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward -bindkey '^[[B' down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward +bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward +bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward -bindkey '^[[H' beginning-of-line # [Home] - Go to beginning of line -bindkey '^[[1~' beginning-of-line # [Home] - Go to beginning of line -bindkey '^[OH' beginning-of-line # [Home] - Go to beginning of line -bindkey '^[[F' end-of-line # [End] - Go to end of line -bindkey '^[[4~' end-of-line # [End] - Go to end of line -bindkey '^[OF' end-of-line # [End] - Go to end of line +bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line +bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line bindkey ' ' magic-space # [Space] - do history expansion bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word -bindkey '^[[Z' reverse-menu-complete # [TODO] - Perform menu completion, like menu-complete, except that if a menu completion is already in progress, move to the previous completion rather than the next. +bindkey "${terminfo[kcbt]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards -# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ -bindkey '^?' backward-delete-char # [Delete] - delete backward -bindkey '^[[3~' delete-char # [fn-Delete] - delete forward -bindkey '^[3;5~' delete-char # [TODO] - delete forward -bindkey '\e[3~' delete-char # [TODO] - delete forward +bindkey '^?' backward-delete-char # [Backspace] - delete backward +bindkey "${terminfo[kdch1]}" delete-char # [Delete] - delete forward # consider emacs keybindings: -- cgit v1.2.3-70-g09d2 From c9f2c947e4bdc94676aeaf989ba16dbe35aa45ee Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Fri, 29 Nov 2013 14:24:14 +0100 Subject: Added/modified some useful aliases. --- lib/aliases.zsh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 9b3709172..517e4daf7 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -6,6 +6,11 @@ alias po='popd' alias ...='cd ../..' alias -- -='cd -' +# Prevent headaches +alias cp='cp -v' +alias rm='rm -v' +alias mv='mv -v' + # Super user alias _='sudo' alias please='sudo' @@ -17,9 +22,9 @@ alias history='fc -l 1' # List direcory contents alias lsa='ls -lah' -alias l='ls -la' -alias ll='ls -l' -alias la='ls -lA' +alias l='ls -lah' +alias ll='ls -lh' +alias la='ls -lAh' alias sl=ls # often screw this up alias afind='ack-grep -il' -- cgit v1.2.3-70-g09d2 From bbbff94cca497103d0f9854f9d8a67b9049f59c9 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Tue, 31 Dec 2013 00:35:57 +0100 Subject: Fixes rvm_prompt_info() in lib/rvm.zsh --- lib/rvm.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/rvm.zsh b/lib/rvm.zsh index e8744e61e..d14b45632 100644 --- a/lib/rvm.zsh +++ b/lib/rvm.zsh @@ -2,7 +2,7 @@ function rvm_prompt_info() { [ -f $HOME/.rvm/bin/rvm-prompt ] || return local rvm_prompt - rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null) + rvm_prompt=$(eval "$HOME/.rvm/bin/rvm-prompt $ZSH_THEME_RVM_PROMPT_OPTIONS" 2>/dev/null) [[ "${rvm_prompt}x" == "x" ]] && return echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" } -- cgit v1.2.3-70-g09d2 From 468b24a8d54f294ab9802cac3801ba580c5c4397 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Tue, 31 Dec 2013 01:06:14 +0100 Subject: Returns false when rvm is not found. --- lib/rvm.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/rvm.zsh b/lib/rvm.zsh index d14b45632..04d116397 100644 --- a/lib/rvm.zsh +++ b/lib/rvm.zsh @@ -1,8 +1,8 @@ # get the name of the ruby version function rvm_prompt_info() { - [ -f $HOME/.rvm/bin/rvm-prompt ] || return + [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1 local rvm_prompt rvm_prompt=$(eval "$HOME/.rvm/bin/rvm-prompt $ZSH_THEME_RVM_PROMPT_OPTIONS" 2>/dev/null) - [[ "${rvm_prompt}x" == "x" ]] && return + [[ "${rvm_prompt}x" == "x" ]] && return 1 echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" } -- cgit v1.2.3-70-g09d2 From ae6ded5ad795a7f4174bc10a5a02e1c0502e1352 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Tue, 31 Dec 2013 01:15:35 +0100 Subject: Returns false when rbenv is not found. --- lib/rbenv.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/rbenv.zsh b/lib/rbenv.zsh index a8b6c323c..f58074b83 100644 --- a/lib/rbenv.zsh +++ b/lib/rbenv.zsh @@ -1,2 +1,4 @@ # using the rbenv plugin will override this with a real implementation -function rbenv_prompt_info() {} +function rbenv_prompt_info() { + return 1 +} -- cgit v1.2.3-70-g09d2 From 7aa766168cead04f677b4828cc5c837f823f7cd7 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Tue, 31 Dec 2013 01:44:51 +0100 Subject: Adds chruby_prompt_info dummy function. --- lib/chruby.zsh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 lib/chruby.zsh (limited to 'lib') diff --git a/lib/chruby.zsh b/lib/chruby.zsh new file mode 100644 index 000000000..b78d04f86 --- /dev/null +++ b/lib/chruby.zsh @@ -0,0 +1,4 @@ +# using the chruby plugin will override this with a real implementation +function chruby_prompt_info() { + return 1 +} -- cgit v1.2.3-70-g09d2 From 8a887c505282b771193ac3ee6df05a1fa3f8426a Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Tue, 31 Dec 2013 02:11:02 +0100 Subject: Joins ruby prompt files and adds ruby_prompt_info. --- lib/chruby.zsh | 4 ---- lib/rbenv.zsh | 4 ---- lib/ruby_prompts.zsh | 22 ++++++++++++++++++++++ lib/rvm.zsh | 8 -------- 4 files changed, 22 insertions(+), 16 deletions(-) delete mode 100644 lib/chruby.zsh delete mode 100644 lib/rbenv.zsh create mode 100644 lib/ruby_prompts.zsh delete mode 100644 lib/rvm.zsh (limited to 'lib') diff --git a/lib/chruby.zsh b/lib/chruby.zsh deleted file mode 100644 index b78d04f86..000000000 --- a/lib/chruby.zsh +++ /dev/null @@ -1,4 +0,0 @@ -# using the chruby plugin will override this with a real implementation -function chruby_prompt_info() { - return 1 -} diff --git a/lib/rbenv.zsh b/lib/rbenv.zsh deleted file mode 100644 index f58074b83..000000000 --- a/lib/rbenv.zsh +++ /dev/null @@ -1,4 +0,0 @@ -# using the rbenv plugin will override this with a real implementation -function rbenv_prompt_info() { - return 1 -} diff --git a/lib/ruby_prompts.zsh b/lib/ruby_prompts.zsh new file mode 100644 index 000000000..287b3ff0a --- /dev/null +++ b/lib/ruby_prompts.zsh @@ -0,0 +1,22 @@ +# get the name of the rvm ruby version +function rvm_prompt_info() { + [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1 + local rvm_prompt + rvm_prompt=$(eval "$HOME/.rvm/bin/rvm-prompt $ZSH_THEME_RVM_PROMPT_OPTIONS" 2>/dev/null) + [[ "${rvm_prompt}x" == "x" ]] && return 1 + echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" +} + +# using the rbenv plugin will override this with a real implementation +function rbenv_prompt_info() { + return 1 +} + +# using the chruby plugin will override this with a real implementation +function chruby_prompt_info() { + return 1 +} + +function ruby_prompt_info() { + echo $(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info) +} diff --git a/lib/rvm.zsh b/lib/rvm.zsh deleted file mode 100644 index 04d116397..000000000 --- a/lib/rvm.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# get the name of the ruby version -function rvm_prompt_info() { - [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1 - local rvm_prompt - rvm_prompt=$(eval "$HOME/.rvm/bin/rvm-prompt $ZSH_THEME_RVM_PROMPT_OPTIONS" 2>/dev/null) - [[ "${rvm_prompt}x" == "x" ]] && return 1 - echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" -} -- cgit v1.2.3-70-g09d2 From c6aacf611d51f7c00d216f77c3b32174cc3bed9c Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Tue, 31 Dec 2013 02:45:09 +0100 Subject: Refactors ruby_prompts.zsh --- lib/ruby_prompts.zsh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/ruby_prompts.zsh b/lib/ruby_prompts.zsh index 287b3ff0a..2ef334d5f 100644 --- a/lib/ruby_prompts.zsh +++ b/lib/ruby_prompts.zsh @@ -7,13 +7,9 @@ function rvm_prompt_info() { echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" } -# using the rbenv plugin will override this with a real implementation -function rbenv_prompt_info() { - return 1 -} - -# using the chruby plugin will override this with a real implementation -function chruby_prompt_info() { +# using the chruby and/or rbenv plugins will override +# these with real implementations +function chruby_prompt_info rbenv_prompt_info { return 1 } -- cgit v1.2.3-70-g09d2 From 72392a2c27386706c78efe1ace9b84e602d9d1ff Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Mon, 6 Jan 2014 09:57:09 +0100 Subject: Adds all other dummy implementations. --- lib/ruby_prompts.zsh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/ruby_prompts.zsh b/lib/ruby_prompts.zsh index 2ef334d5f..9ca6e1fc7 100644 --- a/lib/ruby_prompts.zsh +++ b/lib/ruby_prompts.zsh @@ -1,3 +1,10 @@ +function chruby_prompt_info hg_prompt_info pyenv_prompt_info \ + rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \ + virtualenv_prompt_info { + return 1 +} + +# oh-my-zsh supports an rvm prompt by default # get the name of the rvm ruby version function rvm_prompt_info() { [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1 @@ -7,12 +14,8 @@ function rvm_prompt_info() { echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" } -# using the chruby and/or rbenv plugins will override -# these with real implementations -function chruby_prompt_info rbenv_prompt_info { - return 1 -} - +# use this to enable users to see their ruby version, no matter which +# version management system they use function ruby_prompt_info() { echo $(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info) } -- cgit v1.2.3-70-g09d2 From 082607c165c6ae16b7b059e941c8bfa3eddabbb8 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Mon, 6 Jan 2014 09:57:23 +0100 Subject: Adds documentation. --- lib/ruby_prompts.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/ruby_prompts.zsh b/lib/ruby_prompts.zsh index 9ca6e1fc7..1aaf9de17 100644 --- a/lib/ruby_prompts.zsh +++ b/lib/ruby_prompts.zsh @@ -1,3 +1,15 @@ +# *_prompt_info functions for usage in your prompt +# +# Plugin creators, please add your *_prompt_info function to the list +# of dummy implementations to help theme creators not receiving errors +# without the need of implementing conditional clauses. +# +# See also lib/bzr.zsh, lib/git.zsh and lib/nvm.zsh for +# git_prompt_info, bzr_prompt_info and nvm_prompt_info + +# Dummy implementations that return false to prevent command_not_found +# errors with themes, that implement these functions +# Real implementations will be used when the respective plugins are loaded function chruby_prompt_info hg_prompt_info pyenv_prompt_info \ rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \ virtualenv_prompt_info { -- cgit v1.2.3-70-g09d2 From 85fde31991dc04f34450390e7d20992a7334c90a Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Mon, 6 Jan 2014 09:58:40 +0100 Subject: Renames the file to prompt_info_functions.zsh --- lib/prompt_info_functions.zsh | 33 +++++++++++++++++++++++++++++++++ lib/ruby_prompts.zsh | 33 --------------------------------- 2 files changed, 33 insertions(+), 33 deletions(-) create mode 100644 lib/prompt_info_functions.zsh delete mode 100644 lib/ruby_prompts.zsh (limited to 'lib') diff --git a/lib/prompt_info_functions.zsh b/lib/prompt_info_functions.zsh new file mode 100644 index 000000000..1aaf9de17 --- /dev/null +++ b/lib/prompt_info_functions.zsh @@ -0,0 +1,33 @@ +# *_prompt_info functions for usage in your prompt +# +# Plugin creators, please add your *_prompt_info function to the list +# of dummy implementations to help theme creators not receiving errors +# without the need of implementing conditional clauses. +# +# See also lib/bzr.zsh, lib/git.zsh and lib/nvm.zsh for +# git_prompt_info, bzr_prompt_info and nvm_prompt_info + +# Dummy implementations that return false to prevent command_not_found +# errors with themes, that implement these functions +# Real implementations will be used when the respective plugins are loaded +function chruby_prompt_info hg_prompt_info pyenv_prompt_info \ + rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \ + virtualenv_prompt_info { + return 1 +} + +# oh-my-zsh supports an rvm prompt by default +# get the name of the rvm ruby version +function rvm_prompt_info() { + [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1 + local rvm_prompt + rvm_prompt=$(eval "$HOME/.rvm/bin/rvm-prompt $ZSH_THEME_RVM_PROMPT_OPTIONS" 2>/dev/null) + [[ "${rvm_prompt}x" == "x" ]] && return 1 + echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" +} + +# use this to enable users to see their ruby version, no matter which +# version management system they use +function ruby_prompt_info() { + echo $(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info) +} diff --git a/lib/ruby_prompts.zsh b/lib/ruby_prompts.zsh deleted file mode 100644 index 1aaf9de17..000000000 --- a/lib/ruby_prompts.zsh +++ /dev/null @@ -1,33 +0,0 @@ -# *_prompt_info functions for usage in your prompt -# -# Plugin creators, please add your *_prompt_info function to the list -# of dummy implementations to help theme creators not receiving errors -# without the need of implementing conditional clauses. -# -# See also lib/bzr.zsh, lib/git.zsh and lib/nvm.zsh for -# git_prompt_info, bzr_prompt_info and nvm_prompt_info - -# Dummy implementations that return false to prevent command_not_found -# errors with themes, that implement these functions -# Real implementations will be used when the respective plugins are loaded -function chruby_prompt_info hg_prompt_info pyenv_prompt_info \ - rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \ - virtualenv_prompt_info { - return 1 -} - -# oh-my-zsh supports an rvm prompt by default -# get the name of the rvm ruby version -function rvm_prompt_info() { - [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1 - local rvm_prompt - rvm_prompt=$(eval "$HOME/.rvm/bin/rvm-prompt $ZSH_THEME_RVM_PROMPT_OPTIONS" 2>/dev/null) - [[ "${rvm_prompt}x" == "x" ]] && return 1 - echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" -} - -# use this to enable users to see their ruby version, no matter which -# version management system they use -function ruby_prompt_info() { - echo $(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info) -} -- cgit v1.2.3-70-g09d2 From b0b79e0abae5f1d228e16c36174bad2bf7ba5fee Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Tue, 7 Jan 2014 19:08:20 +0100 Subject: No need to eval in rvm_prompt_info! Just activate word-splitting. --- lib/prompt_info_functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/prompt_info_functions.zsh b/lib/prompt_info_functions.zsh index 1aaf9de17..335c02a3d 100644 --- a/lib/prompt_info_functions.zsh +++ b/lib/prompt_info_functions.zsh @@ -21,7 +21,7 @@ function chruby_prompt_info hg_prompt_info pyenv_prompt_info \ function rvm_prompt_info() { [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1 local rvm_prompt - rvm_prompt=$(eval "$HOME/.rvm/bin/rvm-prompt $ZSH_THEME_RVM_PROMPT_OPTIONS" 2>/dev/null) + rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null) [[ "${rvm_prompt}x" == "x" ]] && return 1 echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" } -- cgit v1.2.3-70-g09d2 From b0fbe0d11ac60074b4fdc20e332bc2db3e0c0066 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 12 Dec 2013 23:27:22 +0100 Subject: Avoid evaluating special chars in $LINE on title command (fixes #2234) --- lib/termsupport.zsh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 80319e1a8..6eba8f69a 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -27,9 +27,8 @@ function omz_termsupport_preexec { emulate -L zsh setopt extended_glob local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd - local LINE="${2:gs/$/\\$}" - LINE="${LINE:gs/%/%%}" - title "$CMD" "%100>...>$LINE%<<" + local LINE="${2}" + title "$CMD" '%100>...>$LINE%<<' } autoload -U add-zsh-hook -- cgit v1.2.3-70-g09d2 From b73ced397fc74618d92f748e2744e65f901b368f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 14 Dec 2013 02:13:18 +0100 Subject: Use single quotes also in $LINE definiton --- 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 6eba8f69a..d3d8c967f 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -27,7 +27,7 @@ function omz_termsupport_preexec { emulate -L zsh setopt extended_glob local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd - local LINE="${2}" + local LINE='${2}' title "$CMD" '%100>...>$LINE%<<' } -- cgit v1.2.3-70-g09d2 From 3e5de21dc5b71e332a1526ae14beb662a66d6e26 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 14 Dec 2013 04:30:29 +0100 Subject: Revert previous commit, escape % --- 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 d3d8c967f..623bf1f09 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -27,7 +27,7 @@ function omz_termsupport_preexec { emulate -L zsh setopt extended_glob local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd - local LINE='${2}' + local LINE="${2:gs/%/%%}" title "$CMD" '%100>...>$LINE%<<' } -- cgit v1.2.3-70-g09d2 From a951600b4e81d73d71a098e48aa8d296be853bc9 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 16 Dec 2013 09:24:24 +0100 Subject: Avoid 'title:parse error' with single quotes in $CMD Fixes #2182 --- 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 623bf1f09..5f2fe63d4 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -28,7 +28,7 @@ function omz_termsupport_preexec { setopt extended_glob local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd local LINE="${2:gs/%/%%}" - title "$CMD" '%100>...>$LINE%<<' + title '$CMD' '%100>...>$LINE%<<' } autoload -U add-zsh-hook -- cgit v1.2.3-70-g09d2 From b71a2b9d0f21c0b95840a2534eca2d866a48a941 Mon Sep 17 00:00:00 2001 From: Kaiwen Xu Date: Mon, 10 Mar 2014 04:05:14 -0400 Subject: Removed unsolicited aliases. Those aliases should be in user's .zshrc file, instead of being default. --- lib/aliases.zsh | 5 ----- 1 file changed, 5 deletions(-) (limited to 'lib') diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 2094f60a0..3044c9660 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -6,11 +6,6 @@ alias po='popd' alias ...='cd ../..' alias -- -='cd -' -# Prevent headaches -alias cp='cp -v' -alias rm='rm -v' -alias mv='mv -v' - # Super user alias _='sudo' alias please='sudo' -- cgit v1.2.3-70-g09d2