From ccf94b7df09799feb201d1a59928932fda4e24f4 Mon Sep 17 00:00:00 2001 From: David Runge Date: Fri, 31 Oct 2014 18:30:03 +0100 Subject: zsh: Adding config files for zprezto, zsh settings and prompts, to comply with the way zprezto gets started --- .zsh.before/aliases.zsh | 11 ++++++++++- .zsh.before/custom_prompt_path.zsh | 4 ++++ .zsh.before/functions.zsh | 7 +++++++ .zsh.before/git.zsh | 4 ++++ .zsh.before/key-bindings.zsh | 10 ++++++++++ .zsh.before/last-command.zsh | 7 +++++++ .zsh.before/noglob.zsh | 4 ++++ .zsh.before/rm.zsh | 2 ++ .zsh.before/vi-mode.zsh | 3 +++ 9 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .zsh.before/custom_prompt_path.zsh create mode 100644 .zsh.before/git.zsh create mode 100644 .zsh.before/key-bindings.zsh create mode 100644 .zsh.before/last-command.zsh create mode 100644 .zsh.before/noglob.zsh create mode 100644 .zsh.before/rm.zsh create mode 100644 .zsh.before/vi-mode.zsh (limited to '.zsh.before') diff --git a/.zsh.before/aliases.zsh b/.zsh.before/aliases.zsh index b38dc53..2fc2c1d 100644 --- a/.zsh.before/aliases.zsh +++ b/.zsh.before/aliases.zsh @@ -1 +1,10 @@ -alias brew='echo' +# Global aliases +alias -g ...='../..' +alias -g ....='../../..' +alias -g .....='../../../..' +alias -g C='| wc -l' +alias -g H='| head' +alias -g L="| less" +alias -g N="| /dev/null" +alias -g S='| sort' +alias -g G='| grep' # now you can do: ls foo G something diff --git a/.zsh.before/custom_prompt_path.zsh b/.zsh.before/custom_prompt_path.zsh new file mode 100644 index 0000000..18e68b9 --- /dev/null +++ b/.zsh.before/custom_prompt_path.zsh @@ -0,0 +1,4 @@ +#Load themes from yadr and from user's custom prompts (themes) in ~/.zsh.prompts +autoload promptinit +fpath=($HOME/.zsh.prompts $fpath) +promptinit diff --git a/.zsh.before/functions.zsh b/.zsh.before/functions.zsh index 01bc224..4b2ef1a 100644 --- a/.zsh.before/functions.zsh +++ b/.zsh.before/functions.zsh @@ -1,3 +1,10 @@ +# Functions +# +# (f)ind by (n)ame +# usage: fn foo +# to find all files containing 'foo' in the name +function fn() { ls **/*$1* } + if [ -e $HOME/bin/functions.sh ] then . $HOME/bin/functions.sh diff --git a/.zsh.before/git.zsh b/.zsh.before/git.zsh new file mode 100644 index 0000000..c87ec5a --- /dev/null +++ b/.zsh.before/git.zsh @@ -0,0 +1,4 @@ +# Makes git auto completion faster favouring for local completions +__git_files () { + _wanted files expl 'local files' _files +} diff --git a/.zsh.before/key-bindings.zsh b/.zsh.before/key-bindings.zsh new file mode 100644 index 0000000..c1c7d8e --- /dev/null +++ b/.zsh.before/key-bindings.zsh @@ -0,0 +1,10 @@ +# 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 -v # Use vi key bindings +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. + +# emacs style +bindkey '^a' beginning-of-line +bindkey '^e' end-of-line diff --git a/.zsh.before/last-command.zsh b/.zsh.before/last-command.zsh new file mode 100644 index 0000000..9f7486b --- /dev/null +++ b/.zsh.before/last-command.zsh @@ -0,0 +1,7 @@ +# Use Ctrl-x,Ctrl-l to get the output of the last command +zmodload -i zsh/parameter +insert-last-command-output() { +LBUFFER+="$(eval $history[$((HISTCMD-1))])" +} +zle -N insert-last-command-output +bindkey "^X^L" insert-last-command-output diff --git a/.zsh.before/noglob.zsh b/.zsh.before/noglob.zsh new file mode 100644 index 0000000..ede67c9 --- /dev/null +++ b/.zsh.before/noglob.zsh @@ -0,0 +1,4 @@ +# Don't try to glob with zsh so you can do +# stuff like ga *foo* and correctly have +# git add the right stuff +alias git='noglob git' diff --git a/.zsh.before/rm.zsh b/.zsh.before/rm.zsh new file mode 100644 index 0000000..26508a3 --- /dev/null +++ b/.zsh.before/rm.zsh @@ -0,0 +1,2 @@ +# Override rm -i alias which makes rm prompt for every action +alias rm='nocorrect rm' diff --git a/.zsh.before/vi-mode.zsh b/.zsh.before/vi-mode.zsh new file mode 100644 index 0000000..4ac7453 --- /dev/null +++ b/.zsh.before/vi-mode.zsh @@ -0,0 +1,3 @@ +set -o vi +export EDITOR=vim +export VISUAL=vim -- cgit v1.2.3-54-g00ecf