Skip to content

Commit

Permalink
Add ecn for emacs using already exist window
Browse files Browse the repository at this point in the history
Other convince changes
  • Loading branch information
qqldd committed Jun 21, 2015
1 parent 9fffe11 commit 9056d2f
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .bash_profile
Expand Up @@ -33,7 +33,7 @@ export DYLD_LIBRARY_PATH=${CUDAHOME}/lib:$DYLD_LIBRARY_PATH

# Perforce
export P4CONFIG=".p4config"
export P4EDITOR="emacs"
export P4EDITOR='emacsclient -t -a ""'

# Path
export PATH=~/bin:$PATH
Expand Down
2 changes: 1 addition & 1 deletion .oh-my-zsh
Submodule .oh-my-zsh updated from 434f3b to 599831
2 changes: 1 addition & 1 deletion .zsh.d/.zshrc
Expand Up @@ -36,6 +36,6 @@ plugins=(git textmate osx cp)


# Customize to your needs...
export PATH=$HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin
export PATH=$HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin

source $ZSH/oh-my-zsh.sh
90 changes: 49 additions & 41 deletions .zsh.d/agnoster-my.zsh-theme
Expand Up @@ -6,7 +6,7 @@
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
# In addition, I recommend the
# [Solarized theme](https://github.com/altercation/solarized/) and, if you're
Expand Down Expand Up @@ -60,16 +60,16 @@ prompt_end() {

# Context: user@hostname (who am I and where am I)
prompt_context() {
local user=`whoami`

if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment yellow black "%(!.%{%F{yellow}%}.)$user@%m"
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
fi
}

# Git: branch/detached head, dirty status
prompt_git() {
local ref dirty
local ref dirty mode repo_path
repo_path=$(git rev-parse --git-dir 2>/dev/null)

if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="$(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
Expand All @@ -79,6 +79,14 @@ prompt_git() {
prompt_segment green black
fi

if [[ -e "${repo_path}/BISECT_LOG" ]]; then
mode=" <B>"
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then
mode=" >M<"
elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then
mode=" >R>"
fi

setopt promptsubst
autoload -Uz vcs_info

Expand All @@ -88,45 +96,45 @@ prompt_git() {
zstyle ':vcs_info:*' stagedstr ''
zstyle ':vcs_info:git:*' unstagedstr ''
zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats '%u%c'
zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info
echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_}"
echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_%% }${mode}"
fi
}

prompt_hg() {
local rev status
if $(hg id >/dev/null 2>&1); then
if $(hg prompt >/dev/null 2>&1); then
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
# if files are not added
prompt_segment red white
st='±'
elif [[ -n $(hg prompt "{status|modified}") ]]; then
# if any modification
prompt_segment yellow black
st='±'
else
# if working copy is clean
prompt_segment green black
fi
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 -Eq "^\?"`; then
prompt_segment red black
st='±'
elif `hg st | grep -Eq "^(M|A)"`; then
prompt_segment yellow black
st='±'
else
prompt_segment green black
fi
echo -n " $rev@$branch" $st
fi
fi
local rev status
if $(hg id >/dev/null 2>&1); then
if $(hg prompt >/dev/null 2>&1); then
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
# if files are not added
prompt_segment red white
st='±'
elif [[ -n $(hg prompt "{status|modified}") ]]; then
# if any modification
prompt_segment yellow black
st='±'
else
# if working copy is clean
prompt_segment green black
fi
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 -Eq "^\?"`; then
prompt_segment red black
st='±'
elif `hg st | grep -Eq "^(M|A)"`; then
prompt_segment yellow black
st='±'
else
prompt_segment green black
fi
echo -n " $rev@$branch" $st
fi
fi
}

# Dir: current working directory
Expand All @@ -137,7 +145,7 @@ prompt_dir() {
# Virtualenv: current working virtualenv
prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV"
if [[ -n $virtualenv_path ]]; then
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
prompt_segment blue black "(`basename $virtualenv_path`)"
fi
}
Expand Down
23 changes: 13 additions & 10 deletions .zsh.d/config.zsh
Expand Up @@ -6,21 +6,16 @@ function set_aliases() {
alias sudo='sudo '
alias dirs='dirs -v'
alias ec='emacsclient -t -a ""'
alias ecn='emacsclient -n'
alias ecc='emacsclient -c -n -a "" ' #-F "((top . 130) (left . 400))"'
alias eck='emacsclient -e "(kill-emacs)"'
}

function set_cuda_evn() {
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/cuda/lib
export CUDA_INSTALL_PATH=/usr/local/cuda
export PATH=$PATH:$CUDA_INSTALL_PATH/bin
}

function set_perforce() {
export P4CONFIG=".p4config"
export P4EDITOR='emacsclient -t -a ""'
export P4PORT=aamodt-pc3:1666
if [[ $1 == "out" ]]; then
export P4PORT=aamodt-pc08:1666
if [[ $1 == "local" ]]; then
export P4PORT=localhost:6416
echo $P4PORT
fi
Expand All @@ -37,15 +32,23 @@ function set_dirs() {
gpgpusim_root=~/Perforce/gpgpu_sim_research/fermi/distribution
}

function change_sdk() {
export MACOSX_DEPLOYMENT_TARGET=10.8
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
}

export JYTHON_HOME=/usr/local/Cellar/jython/2.5.3/libexec

export CLASSPATH=$HOME/Dropbox/courseware/513/sym

set_aliases
set_dirs
set_cuda_evn
set_cudaver
#change_sdk
set_perforce
export EDITOR='emacsclient -t -a ""'
SUBL='subl'
EC='emacsclient -t -a ""'
export EDITOR=$SUBL
export LSCOLORS=exBxhxDxfxhxhxhxhxcxcx
ulimit -S -n 1024
source ~/Softwares/z/z.sh
18 changes: 14 additions & 4 deletions .zsh.d/funs.zsh
@@ -1,9 +1,19 @@
# tabname for iterm 2
function tabname() {
export DISABLE_AUTO_TITLE="true"
echo -e "\033];$1\007";
}
function tabname() {
export DISABLE_AUTO_TITLE="true"
echo -e "\033];$1\007";
}

function gpusim_env() {

}

function brewlist() {
if [[ $1 == "deps" ]]; then
brew list | while read cask; do echo -n $fg[blue] $cask $fg[white]; brew deps $cask | awk '{printf(" %s ", $0)}'; echo ""; done
elif [[ $1 == "uses" ]]; then
brew list | while read cask; do echo -n $fg[blue] $cask $fg[white]; brew uses --installed $cask | awk '{printf(" %s ", $0)}'; echo ""; done
else
echo "Usage: brewlist [deps, uses]"
fi
}

0 comments on commit 9056d2f

Please sign in to comment.