diff --git a/custom/example.zsh b/custom/example.zsh index 28ffcae25..99fa67c5a 100644 --- a/custom/example.zsh +++ b/custom/example.zsh @@ -2,4 +2,11 @@ # 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 +droc=$dro/custom/ +drocp=$droc/plugins +drop=$dro/plugins diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 90d59910c..f0bd7e67e 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -26,6 +26,31 @@ alias ...='cd ../../' alias ....='cd ../../../' alias .....='cd ../../../../' +# Switch the directory with the vim key-binding +alias k='cd ../' +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'; +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' @@ -89,4 +114,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)"}%%[# ]*}//,/ })' - 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 +} diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 763288dfd..d1a7882e7 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"