From 2e136e574d96091393b3f76f27ae1fbb3691871d Mon Sep 17 00:00:00 2001 From: MartyJiang Date: Sun, 7 Dec 2014 10:35:25 +0800 Subject: [PATCH 1/7] Switch the directory with the wim key-binding --- plugins/common-aliases/common-aliases.plugin.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 90d59910c..259a6fd9d 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -26,6 +26,11 @@ alias ...='cd ../../' alias ....='cd ../../../' alias .....='cd ../../../../' +# Switch the directory with the vim key-binding +alias k='cd ../' +alias 2k='cd ../../' +alias 3k='cd ../../../' + # Command line head / tail shortcuts alias -g H='| head' alias -g T='| tail' @@ -89,4 +94,3 @@ fi # Make zsh know about hosts already accessed by SSH zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' - From 359f7448d07d824d27cd060b35dd1203d283b01c Mon Sep 17 00:00:00 2001 From: msrty Date: Thu, 18 Dec 2014 21:05:21 +0800 Subject: [PATCH 2/7] Chance /home/msrty/Dropbox/linux/oh-my-zsh --- templates/zshrc.zsh-template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index a12eca2a0..c6a1e4b87 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -1,11 +1,11 @@ # Path to your oh-my-zsh installation. -export ZSH=$HOME/.oh-my-zsh +export ZSH=$HOME/Dropbox/linux/oh-my-zsh # Set name of the theme to load. # Look in ~/.oh-my-zsh/themes/ # Optionally, if you set this to "random", it'll load a random theme each # time that oh-my-zsh is loaded. -ZSH_THEME="robbyrussell" +ZSH_THEME="gnzh" # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" From dc9676f39e773c721236eb95b47db6a326bdb5be Mon Sep 17 00:00:00 2001 From: msrty Date: Fri, 19 Dec 2014 00:52:03 +0800 Subject: [PATCH 3/7] First add plugin file x.plugin.zsh --- plugins/x/x.plugin.zsh | 92 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 plugins/x/x.plugin.zsh diff --git a/plugins/x/x.plugin.zsh b/plugins/x/x.plugin.zsh new file mode 100644 index 000000000..597e9b727 --- /dev/null +++ b/plugins/x/x.plugin.zsh @@ -0,0 +1,92 @@ +# Quick touch file and exec chmod command + +# If the arguments is only one +# 1. it not exist before,then create it and edit it auto,else +# 2. else,chmod it +# +# else if there are many arguments chmod all of them and edit +# or not as you choice,default edit is vim.If no argument given +# or only option you can chmod file stilly. +# +# Example: x -e vim test.md test1.md +function x { + local EDIT=vim + local V + local HELP + local FILES + # No args given + [ $# -eq 0 ] && \ + read -p "Which file(s) you want give it(them) privilege?\n`ls`" choice + if [ -z $choice ]; then + return 0 + else + _xfile $@ + fi + # Args is given and config local argvs + for item in $@; do + case $item in + -h) + HELP=yes;; + -e) + if `which $2`; then + EDIT=$2 + fi + shift;; + -v) + V=yes;; + *) + FILES="$item $FILES" + esac + shift + done + + # Behaves depend on local config varibles + # For $HELP var + if [ -z $HELP ]; then + _xhelp + return $? + fi + # For $DEIT var i have no better idea + if which $EDIT &> /dev/null; then + $EDIT=`which $EDIT` + fi + + # For $FILES + if [ -n $FILES ]; then + _xfile $FILES + fi + + # Edit file apply by the number of it + if [ $? -eq 0]; then + read -p "Which file you want edit by `basename $EDIT`?\n${FILES}" choice + if [ -z $choice ]; then + return 127 + else + choice=${FILES:choice} + _xfile $choice + unset $choice + fi + fi + +} + +# Create file if necessary and chmod file +function _xfile { + for i in $@; do + if [ ! -f $i ]; then + touch $i + fi + [ -e $i ] && chmod u+x $i + done + unset i +} + +# Help message for the -h agrv and continue +function _xhelp { + read -p \ + "Which file you want exec command chmod u+x or touch it if not exist?\n`ls`\n:" choice + if [ -n "$choice" ]; then + _xfile $choice + fi + unset $choice +} From 5ff7a299ad78175b846def5a8827bdb2597a97e3 Mon Sep 17 00:00:00 2001 From: msrty Date: Fri, 19 Dec 2014 09:26:48 +0800 Subject: [PATCH 4/7] Some aliases added in common-alias.plugin.zsh --- plugins/common-aliases/common-aliases.plugin.zsh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 259a6fd9d..0f19c6f04 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -30,7 +30,22 @@ alias .....='cd ../../../../' alias k='cd ../' alias 2k='cd ../../' alias 3k='cd ../../../' +# My aliases +alias jget='sudo apt-get install'; +alias s='sudo'; +alias jic='sudo pppoeconf'; +alias jc='sudo pon dsl-provider'; +alias jdc='sudo poff -a'; +alias jtc='ping -c 5 baidu.com'; + +alias jas='vim ~/.bash_aliases'; +alias jbc='vim ~/.bashrc'; +alias js='source'; +alias jsb='source ~/.bashrc'; +alias fq='cd /home/msrty/Downloads/smartladder-master/goagent+/ && python proxy.py'; + +alias jt='cd $HOME/tmp'; # Command line head / tail shortcuts alias -g H='| head' alias -g T='| tail' From 547af2c2e3d8565dcc88dbb34ee7a0e206e291f5 Mon Sep 17 00:00:00 2001 From: msrty Date: Fri, 19 Dec 2014 09:43:10 +0800 Subject: [PATCH 5/7] Some aliases added in common-alias.plugin.zsh --- plugins/common-aliases/common-aliases.plugin.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 0f19c6f04..f0bd7e67e 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -32,13 +32,18 @@ alias 2k='cd ../../' alias 3k='cd ../../../' # My aliases alias jget='sudo apt-get install'; +alias jup='sudo apt-get update' +alias jug='sudo apt-get upgrate' alias s='sudo'; +alias t='cd' +alias p='echo' +alias zshrc='vim ~/.zshrc' alias jic='sudo pppoeconf'; alias jc='sudo pon dsl-provider'; alias jdc='sudo poff -a'; alias jtc='ping -c 5 baidu.com'; - +alias jsz='source ~/.zshrc' alias jas='vim ~/.bash_aliases'; alias jbc='vim ~/.bashrc'; alias js='source'; From 2d6c0679d5bffb29e388de36dd6077b2597fbb41 Mon Sep 17 00:00:00 2001 From: msrty Date: Fri, 19 Dec 2014 09:55:38 +0800 Subject: [PATCH 6/7] cutshort for me --- custom/example.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom/example.zsh b/custom/example.zsh index 28ffcae25..e447ac45c 100644 --- a/custom/example.zsh +++ b/custom/example.zsh @@ -2,4 +2,8 @@ # Example: # # brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr -# \ No newline at end of file +# + +dr=$Dr +drl=$Dr/linux +dro=$Dr/linux/oh-my-zsh From 3699e4f933268f190acaf90b28f9e4f634c87d34 Mon Sep 17 00:00:00 2001 From: msrty Date: Fri, 19 Dec 2014 10:06:58 +0800 Subject: [PATCH 7/7] cutshort to oh-my-zsh --- custom/example.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom/example.zsh b/custom/example.zsh index e447ac45c..99fa67c5a 100644 --- a/custom/example.zsh +++ b/custom/example.zsh @@ -7,3 +7,6 @@ dr=$Dr drl=$Dr/linux dro=$Dr/linux/oh-my-zsh +droc=$dro/custom/ +drocp=$droc/plugins +drop=$dro/plugins