From 9465ba0de456d270418457b486c308a2d49ed9c6 Mon Sep 17 00:00:00 2001 From: gwjo Date: Wed, 3 Nov 2010 16:57:15 -0400 Subject: Completion fixes Use /etc/hosts in addtion to $HOME/.ssh/known_hosts as the source for hostname completion Turn on completion caching to speed up certain comands When completing usernames, don't include system accounts by default --- lib/completion.zsh | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/completion.zsh b/lib/completion.zsh index 52cc5b53c..9c2dfecca 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -34,9 +34,31 @@ zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories cdpath=(.) +# use /etc/hosts and known_hosts for hostname completion +[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() +[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$( Date: Tue, 21 Dec 2010 14:28:40 -0500 Subject: Added function to mkdir and immediately change to it --- lib/directories.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/directories.zsh b/lib/directories.zsh index 56d7a2316..bb114f615 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -36,5 +36,9 @@ cd () { alias md='mkdir -p' alias rd=rmdir +alias d='dirs -v' -alias d='dirs -v' \ No newline at end of file +# mkdir & cd to it +function mcd() { + mkdir -p "$1" && cd "$1"; +} \ No newline at end of file -- cgit v1.2.3-70-g09d2 From ff0b25b745494d96ae06694321b2299991620b14 Mon Sep 17 00:00:00 2001 From: SuprDewd Date: Fri, 24 Dec 2010 22:20:57 +0000 Subject: Added a function to extract various archives. Also an alias for the function. --- lib/aliases.zsh | 2 ++ lib/functions.zsh | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'lib') diff --git a/lib/aliases.zsh b/lib/aliases.zsh index d2d3aed81..b47de5bde 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -21,3 +21,5 @@ alias ll='ls -l' alias sl=ls # often screw this up alias afind='ack-grep -il' + +alias x=extract diff --git a/lib/functions.zsh b/lib/functions.zsh index e3c0de43e..99b75409c 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -37,3 +37,24 @@ function take() { mkdir -p $1 cd $1 } + +function extract() { + if [[ -f $1 ]]; then + case $1 in + *.tar.bz2) tar xvjf $1;; + *.tar.gz) tar xvzf $1;; + *.bz2) bunzip $1;; + *.rar) unrar $1;; + *.gz) gunzip $1;; + *.tar) tar xvf $1;; + *.tbz2) tar xvjf $1;; + *.tgz) tar xvzf $1;; + *.zip) unzip $1;; + *.Z) uncompress $1;; + *.7z) 7z x $1;; + *) echo "'$1' cannot be extracted via >extract<";; + esac + else + echo "'$1' is not a valid file" + fi +} -- cgit v1.2.3-70-g09d2 From f0136f2aec4efdd11e976ddbbfd204ca5e113498 Mon Sep 17 00:00:00 2001 From: SuprDewd Date: Sat, 25 Dec 2010 13:28:16 +0000 Subject: Support for more archive formats. --- lib/functions.zsh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/functions.zsh b/lib/functions.zsh index 99b75409c..4246f8811 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -43,6 +43,8 @@ function extract() { case $1 in *.tar.bz2) tar xvjf $1;; *.tar.gz) tar xvzf $1;; + *.tar.xz) tar xvJf $1;; + *.tar.lzma) tar --lzma -xvf $1;; *.bz2) bunzip $1;; *.rar) unrar $1;; *.gz) gunzip $1;; -- cgit v1.2.3-70-g09d2 From 8294cf44d1d348fd1590ee28b5be8483fb012153 Mon Sep 17 00:00:00 2001 From: Michael Komitee Date: Sat, 8 Jan 2011 23:34:47 -0500 Subject: Postponing sourcing of the theme until after local customizations --- lib/appearance.zsh | 2 -- oh-my-zsh.sh | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/appearance.zsh b/lib/appearance.zsh index ffee52b5e..aec67721a 100644 --- a/lib/appearance.zsh +++ b/lib/appearance.zsh @@ -34,5 +34,3 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is c # Setup the prompt with pretty colors setopt prompt_subst -# Load the theme -source "$ZSH/themes/$ZSH_THEME.zsh-theme" \ No newline at end of file diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 848e48eb5..291772dfe 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -14,6 +14,9 @@ for config_file ($ZSH/custom/*.zsh) source $config_file plugin=${plugin:=()} for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh +# Load the theme +source "$ZSH/themes/$ZSH_THEME.zsh-theme" + # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] then -- cgit v1.2.3-70-g09d2 From bcc235e1420f39a0dbd8a7672dffc0f0c81e9b53 Mon Sep 17 00:00:00 2001 From: Robin Ramael Date: Mon, 10 Jan 2011 17:34:38 +0100 Subject: Added an option to remove file afterwards. --- lib/functions.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/functions.zsh b/lib/functions.zsh index 4246f8811..914f2ef25 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -39,6 +39,12 @@ function take() { } function extract() { + unset REMOVE_ARCHIVE + + if test "$1" = "-r"; then + REMOVE=1 + shift + fi if [[ -f $1 ]]; then case $1 in *.tar.bz2) tar xvjf $1;; @@ -56,7 +62,14 @@ function extract() { *.7z) 7z x $1;; *) echo "'$1' cannot be extracted via >extract<";; esac + + if [[ $REMOVE_ARCHIVE -eq 1 ]]; then + echo removing "$1"; + /bin/rm "$1"; + fi + else echo "'$1' is not a valid file" fi } + -- cgit v1.2.3-70-g09d2