summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/directories.zsh4
-rw-r--r--plugins/emacs/emacs.plugin.zsh2
-rw-r--r--plugins/git/git.plugin.zsh2
-rw-r--r--plugins/transfer/README.md24
-rw-r--r--plugins/transfer/transfer.plugin.zsh67
-rw-r--r--[-rwxr-xr-x]themes/agnoster.zsh-theme42
6 files changed, 113 insertions, 28 deletions
diff --git a/lib/directories.zsh b/lib/directories.zsh
index a50a692c8..14064b86f 100644
--- a/lib/directories.zsh
+++ b/lib/directories.zsh
@@ -28,7 +28,3 @@ alias lsa='ls -lah'
alias l='ls -lah'
alias ll='ls -lh'
alias la='ls -lAh'
-
-# Push and pop directories on directory stack
-alias pu='pushd'
-alias po='popd'
diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh
index c102a5a1e..db0ab13af 100644
--- a/plugins/emacs/emacs.plugin.zsh
+++ b/plugins/emacs/emacs.plugin.zsh
@@ -10,7 +10,7 @@
# - Configuration changes made at runtime are applied to all frames.
-if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then
+if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
# set EDITOR if not already defined.
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index fd55be138..34598fb35 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -181,6 +181,8 @@ alias glgga='git log --graph --decorate --all'
alias glgm='git log --graph --max-count=10'
alias glo='git log --oneline --decorate'
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"
+alias glod="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'"
+alias glods="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all"
alias glog='git log --oneline --decorate --graph'
alias gloga='git log --oneline --decorate --graph --all'
diff --git a/plugins/transfer/README.md b/plugins/transfer/README.md
new file mode 100644
index 000000000..5fa064445
--- /dev/null
+++ b/plugins/transfer/README.md
@@ -0,0 +1,24 @@
+# `transfer` plugin
+
+[`transfer.sh`](https://transfer.sh) is an easy to use file sharing service from the command line
+
+## Usage
+
+Add `transfer` to your plugins array in your zshrc file:
+```zsh
+plugins=(... transfer)
+```
+
+Then you can:
+
+- transfer a file:
+
+```zsh
+transfer file.txt
+```
+
+- transfer a whole directory (it will be automatically compressed):
+
+```zsh
+transfer directory/
+```
diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh
new file mode 100644
index 000000000..7a7cd85ec
--- /dev/null
+++ b/plugins/transfer/transfer.plugin.zsh
@@ -0,0 +1,67 @@
+# transfer.sh Easy file sharing from the command line
+# transfer Plugin
+# Usage Example :
+# > transfer file.txt
+# > transfer directory/
+
+
+
+# Author:
+# Remco Verhoef <remco@dutchcoders.io>
+# https://gist.github.com/nl5887/a511f172d3fb3cd0e42d
+# Modified to use tar command instead of zip
+#
+
+curl --version 2>&1 > /dev/null
+if [ $? -ne 0 ]; then
+ echo "Could not find curl."
+ return 1
+fi
+
+transfer() {
+ # check arguments
+ if [ $# -eq 0 ];
+ then
+ echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
+ return 1
+ fi
+
+ # get temporarily filename, output is written to this file show progress can be showed
+ tmpfile=$( mktemp -t transferXXX )
+
+ # upload stdin or file
+ file=$1
+
+ if tty -s;
+ then
+ basefile=$(basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
+
+ if [ ! -e $file ];
+ then
+ echo "File $file doesn't exists."
+ return 1
+ fi
+
+ if [ -d $file ];
+ then
+ echo $file
+ # tar directory and transfer
+ tarfile=$( mktemp -t transferXXX.tar.gz )
+ cd $(dirname $file) && tar -czf $tarfile $(basename $file)
+ curl --progress-bar --upload-file "$tarfile" "https://transfer.sh/$basefile.tar.gz" >> $tmpfile
+ rm -f $tarfile
+ else
+ # transfer file
+ curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile
+ fi
+ else
+ # transfer pipe
+ curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile
+ fi
+
+ # cat output link
+ cat $tmpfile
+
+ # cleanup
+ rm -f $tmpfile
+} \ No newline at end of file
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 292551f44..b0a794f4d 100755..100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -29,7 +29,6 @@
# A few utility functions to make it easy and re-usable to draw segmented prompts
CURRENT_BG='NONE'
-zmodload zsh/parameter
# Special Powerline characters
@@ -56,23 +55,23 @@ prompt_segment() {
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
- PROMPT+=" %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
+ echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
else
- PROMPT+="%{$bg%}%{$fg%} "
+ echo -n "%{$bg%}%{$fg%} "
fi
CURRENT_BG=$1
- [[ -n $3 ]] && PROMPT+=$3
+ [[ -n $3 ]] && echo -n $3
}
# End the prompt, closing any open segments
prompt_end() {
if [[ -n $CURRENT_BG ]]; then
- PROMPT+=" %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
+ echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
else
- PROMPT+="%{%k%}"
+ echo -n "%{%k%}"
fi
- PROMPT+="%{%f%}"
- CURRENT_BG='NONE'
+ echo -n "%{%f%}"
+ CURRENT_BG=''
}
### Prompt components
@@ -124,7 +123,7 @@ prompt_git() {
zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info
- PROMPT+="${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
+ echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
fi
}
@@ -136,15 +135,15 @@ prompt_bzr() {
revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'`
if [[ $status_mod -gt 0 ]] ; then
prompt_segment yellow black
- PROMPT+="bzr@$revision ✚ "
+ echo -n "bzr@"$revision "✚ "
else
if [[ $status_all -gt 0 ]] ; then
prompt_segment yellow black
- PROMPT+="bzr@$revision"
+ echo -n "bzr@"$revision
else
prompt_segment green black
- PROMPT+="bzr@$revision"
+ echo -n "bzr@"$revision
fi
fi
fi
@@ -158,30 +157,30 @@ prompt_hg() {
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
# if files are not added
prompt_segment red white
- st=' ±'
+ st='±'
elif [[ -n $(hg prompt "{status|modified}") ]]; then
# if any modification
prompt_segment yellow black
- st=' ±'
+ st='±'
else
# if working copy is clean
prompt_segment green black
fi
- PROMPT+="$(hg prompt "☿ {rev}@{branch}")$st"
+ echo -n $(hg prompt "☿ {rev}@{branch}") $st
else
st=""
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
branch=$(hg id -b 2>/dev/null)
if `hg st | grep -q "^\?"`; then
prompt_segment red black
- st=' ±'
+ st='±'
elif `hg st | grep -q "^[MA]"`; then
prompt_segment yellow black
- st=' ±'
+ st='±'
else
prompt_segment green black
fi
- PROMPT+="☿ $rev@$branch$st"
+ echo -n "☿ $rev@$branch" $st
fi
fi
}
@@ -208,7 +207,7 @@ prompt_status() {
symbols=()
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
- [[ ${#jobstates} -ne 0 ]] && symbols+="%{%F{cyan}%}⚙"
+ [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
}
@@ -216,7 +215,6 @@ prompt_status() {
## Main prompt
build_prompt() {
RETVAL=$?
- PROMPT='%{%f%b%k%}'
prompt_status
prompt_virtualenv
prompt_context
@@ -225,8 +223,6 @@ build_prompt() {
prompt_bzr
prompt_hg
prompt_end
- PROMPT+=' '
}
-autoload -U add-zsh-hook
-add-zsh-hook precmd build_prompt
+PROMPT='%{%f%b%k%}$(build_prompt) '