如何修复 oh-my-zsh 的自定义别名?
How to I fix custom alias from oh-my-zsh?
我正在尝试在我的 oh-my-zsh/custom 文件夹中创建一个自定义文件,以便更好地组织我的别名。问题是,当我将它添加到我的 .oh-my-zsh/custom/aliases.zsh
文件时,每次我重新启动 shell(我通过命令:source ~/.zshrc
)时,它实际上每次都会在顶部打印我的别名。我该如何阻止这种情况发生?
这是我的 .zshrc 文件的问题吗?我组织得更好一些,但也许我在某处破坏了配置。你能看看我的 .zshrc 有没有问题?如果不是,您认为可能是什么问题?
# ------------| .ZSHRC | ----------------
#----------------------------------------
# ------ Export Paths
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/cnode/.oh-my-zsh"
export PATH=$PATH:/opt/WebDriver/bin >> ~/.profile
export PATH=$PATH:/Users/cnode/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/Deviot/penv/bin
# test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
export LANG=en_US.UTF-8
# ------ ZSH Config
ZSH_THEME="af-magic"
#ZSH_THEME="robbyrussell"
# ZSH_THEME="avit"
plugins=(git iterm2 z)
#-- For zsh-z
autoload -U compinit && compinit
# zstyle ':completion:*' menu select
# --------Preferred Editor
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='subl -w'
else
export EDITOR='vim'
fi
source $ZSH/oh-my-zsh.sh
source ~/.iterm2_shell_integration.zsh
# ------- Dir Browsing
d='dirs -v | head -10'
1='cd -'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
6='cd -6'
7='cd -7'
8='cd -8'
9='cd -9'
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
alias edit="subl ~/.zshrc"
alias editzsh="subl ~/.zshrc"
alias editomzsh="subl ~/.oh-my-zsh"
alias rst="source ~/.zshrc"
alias appid="appID"
alias cheat="vim ~/cube/cmdDoc/cheatsheet.txt"
alias cheatsheet="subl ~/cube/cmdDoc/cheatsheet.txt"
alias putbinhere='putbin'
alias connex='ssh jrapa86@107.180.93.44'
alias npmr='npm run'
alias npmi='npm install --save '
alias goto-hexo='cd /Users/cnode/cube/jsEnv/hexo/blog'
alias go-hexo='goto-hexo'
function hexotheme(){
tmpDir='/Users/cnode/tmp/hexotheme.tmp'
themeDir='/Users/cnode/cube/jsEnv/hexo/blog/themes'
$(pwd)>>/Users/cnode/tmp/hexotheme.tmp
cd $themeDir
git clone `pbpaste`
cd ~
}
function paste(){
ps aux | pbcopy
echo `pbpaste`
}
appID(){
osascript -e 'id of app "''"'
}
add_function(){
newfxn=$(
echo '(){'
echo ""
echo '}'
)
echo $newfxn>>~/.zshrc
rst
}
run(){
sh '.sh'
}
makeExec(){
FILE=
chmod u+x $FILE
echo $FILE' is now executable'
}
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
export EDITOR='subl -w'
# Added Custom Functions from the command line
#------------------------------------------
不要像 source ~/.config/zshalias
那样在 .sh 文件源中放置别名
另外OMZ是一个clustermess,避免,没有它你可以达到same/similar。
我正在尝试在我的 oh-my-zsh/custom 文件夹中创建一个自定义文件,以便更好地组织我的别名。问题是,当我将它添加到我的 .oh-my-zsh/custom/aliases.zsh
文件时,每次我重新启动 shell(我通过命令:source ~/.zshrc
)时,它实际上每次都会在顶部打印我的别名。我该如何阻止这种情况发生?
这是我的 .zshrc 文件的问题吗?我组织得更好一些,但也许我在某处破坏了配置。你能看看我的 .zshrc 有没有问题?如果不是,您认为可能是什么问题?
# ------------| .ZSHRC | ----------------
#----------------------------------------
# ------ Export Paths
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/cnode/.oh-my-zsh"
export PATH=$PATH:/opt/WebDriver/bin >> ~/.profile
export PATH=$PATH:/Users/cnode/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/Deviot/penv/bin
# test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
export LANG=en_US.UTF-8
# ------ ZSH Config
ZSH_THEME="af-magic"
#ZSH_THEME="robbyrussell"
# ZSH_THEME="avit"
plugins=(git iterm2 z)
#-- For zsh-z
autoload -U compinit && compinit
# zstyle ':completion:*' menu select
# --------Preferred Editor
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='subl -w'
else
export EDITOR='vim'
fi
source $ZSH/oh-my-zsh.sh
source ~/.iterm2_shell_integration.zsh
# ------- Dir Browsing
d='dirs -v | head -10'
1='cd -'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
6='cd -6'
7='cd -7'
8='cd -8'
9='cd -9'
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
alias edit="subl ~/.zshrc"
alias editzsh="subl ~/.zshrc"
alias editomzsh="subl ~/.oh-my-zsh"
alias rst="source ~/.zshrc"
alias appid="appID"
alias cheat="vim ~/cube/cmdDoc/cheatsheet.txt"
alias cheatsheet="subl ~/cube/cmdDoc/cheatsheet.txt"
alias putbinhere='putbin'
alias connex='ssh jrapa86@107.180.93.44'
alias npmr='npm run'
alias npmi='npm install --save '
alias goto-hexo='cd /Users/cnode/cube/jsEnv/hexo/blog'
alias go-hexo='goto-hexo'
function hexotheme(){
tmpDir='/Users/cnode/tmp/hexotheme.tmp'
themeDir='/Users/cnode/cube/jsEnv/hexo/blog/themes'
$(pwd)>>/Users/cnode/tmp/hexotheme.tmp
cd $themeDir
git clone `pbpaste`
cd ~
}
function paste(){
ps aux | pbcopy
echo `pbpaste`
}
appID(){
osascript -e 'id of app "''"'
}
add_function(){
newfxn=$(
echo '(){'
echo ""
echo '}'
)
echo $newfxn>>~/.zshrc
rst
}
run(){
sh '.sh'
}
makeExec(){
FILE=
chmod u+x $FILE
echo $FILE' is now executable'
}
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
export EDITOR='subl -w'
# Added Custom Functions from the command line
#------------------------------------------
不要像 source ~/.config/zshalias
那样在 .sh 文件源中放置别名
另外OMZ是一个clustermess,避免,没有它你可以达到same/similar。