git not found

有很多问题是zshrc解决的, 关于zshrc的说明参考旁边2016-12-09的blog.

~/.zshrc
ZSH_THEME="random"   #”robbyrussell"
path有可能需要加上git

各种安装巨慢, brew 可能需要手工更新

因为他们都在第一步做了brew update, 因此, 你可能需要手工更新brew

 echo "$(brew --repository)"   #这个可以看到brew的安装目录.
 gf #然后就正常git操作就好了.

或许需要安装ruby

如果报错是rvm….. 那么需要安装ruby.
参考: https://ruby-china.org/wiki/install_ruby_guide

.zshrc里面加这两项:
#这个里面加上$PATH
export PATH="$PATH: /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Users/m/Downloads/temp/bin:/Applications/apache-ant-1.9.6/bin:/Users/m/Library/Android/sdk/platform-tools:/Users/m/Library/Android/sdk/tools:/Users/m/Desktop/python/vlfeat/bin/maci64:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/m/bin/FDK/Tools/osx"
source $ZSH/oh-my-zsh.sh
#rvm puby need this 这个地方引入这个文件
source ~/.profile
###################################################
.profile文件有啥呢? 下面两句是关键.
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

千万记得要修改源为国内的源, 否则慢死.

theme引发的问题

echo $RANDOM_THEME #这个命令查看当前theme
/Users/m/.oh-my-zsh/themes/jtriley.zsh-theme
这个theme会不显示文件, ll或者ls的时候
simple也不行, 怀疑是这个窗口出问题了.

各种command not find

print $RANDOM_THEME                           
/Users/m/.oh-my-zsh/themes/adben.zsh-theme
ps1_fortune:2: command not found: fortune  
# brew install fortune 参考这个: https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/adben.zsh-theme
# 原来这货就是各种小段子, 自动出来啊. 

print $RANDOM_THEME
/Users/m/.oh-my-zsh/themes/mira.zsh-theme
zsh: command not found: jenv_prompt_info
# 在.zshrc加入prompt, 参考: https://wiki.archlinux.org/index.php/Zsh#Prompts
autoload -Uz promptinit
promptinit
###### 奇怪的是, 这个问题又出现了.
###### 搞不定了, 只能祈祷, 重启动会好. 马蛋.

print $RANDOM_THEME
/Users/m/.oh-my-zsh/themes/kiwi.zsh-theme
zsh: command not found: battery_pct_prompt 
# 在.zshrc加入battery 难道说这个是显示电量?
# 参考: http://hgdev.co/fix-zsh-command-not-found-battery_pct_prompt-error/
plugins=(git battery)

print $RANDOM_THEME
/Users/m/.oh-my-zsh/themes/trapd00r.zsh-theme
prompt_jnrowe_precmd:3: command not found: zsh_path
# 解决方案, 在$path包含的目录里面:我用了~/bin 
# 参考:https://luxing.im/zsh-trapd00r-theme-fix/
# attention: ~/bin will not work, must be /Users/m/bin
wget https://raw.githubusercontent.com/trapd00r/utils/master/zsh_path
chmod +x zsh_path
# 这个地方我用brew安装了wget, 后来发现其实curl也行: https://coolestguidesontheplanet.com/install-and-configure-wget-on-os-x/
# 然后出现了另一个错误:  Term::ExtendedColor not installed
wget http://search.cpan.org/CPAN/authors/id/W/WO/WOLDRICH/Term-ExtendedColor-0.224.tar.gz # 下载模块
tar xvzf Term-ExtendedColor*.tar.gz # 解压, 自己到finder里面去解压也行.
cd Term-ExtendedColor* # 进入目录, 进入之前改目录名也行, 反正就用这么一次.
perl Makefile.PL  # 执行脚本.
make #貌似这一命令是编译?
sudo make install #安装之后, 天下大吉, 这个世界清净了.

既然prompt引起了很多问题, 那么使用prompt有啥用呢?

答案: prompt可以快速切换theme

#Available prompt themes are listed by running the command:
prompt -l
#For example, to use the walters theme, enter:
prompt walters
#To preview all available themes, use this command:
prompt -p

插件textmate没有反应

tm filename.txt # textmate插件提示错误
tm:7: command not found: mate
#然后解决方案一般都是让你去搞路径, 包括官网. 其实特别扯淡, 你要在textmate里面[⌘,]去配置里面安装terminal插件. 妹的.

theme agnoster.zsh-theme

agnoster.zsh-theme show ☐, 这是一个老问题, 需要安装字体.

####用这行代码测试是否成功了
echo -e "\ue0a0\ue0a1\ue0a2\ue0b0\ue0b1\ue0b2"

####安装字体, 无论如何都要安装.
git clone https://github.com/powerline/fonts.git
#上面这个货clone之后, 再安装, 那么一部分字符会变好, 还有两个字符是错的.

#据说装了fontforge会好. 只能试试了.
brew install fontforge --with-python
安装google和adobe的Source Code Pro#这个方案也没啥用.
wget https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip
unzip 1.050R-it.zip

find source-code-pro-2.030R-ro-1.050R-it/TTF/ -name \*.ttf -exec powerline-fontpatcher --source-font=$powerline_symbols --no-rename {} \;
mv *.ttf /Library/Font
#####################################################################
最后是一个戏剧性的解决方案, 在terminal的preference里面修改字体, 改为powerline系列的.
建议sourcecode light或者roboto mono light #个人偏好纤细的字体.

参考链接

  1. https://support.apple.com/en-us/HT201749
  2. https://github.com/adobe-fonts/source-code-pro/releases/tag/2.030R-ro/1.050R-it
  3. https://github.com/robbyrussell/oh-my-zsh/issues/1906
  4. https://gist.github.com/agnoster/3712874#file-agnoster-zsh-theme
  5. https://github.com/CyberLight/agnoster.zsh-theme
  6. https://gist.github.com/qrush/1595572
  7. 参考这个, 做了很多, 其实不必要: https://github.com/powerline/fonts/issues/68
  8. https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/agnoster.zsh-theme
  9. https://github.com/agnoster/agnoster-zsh-theme

字体

  1. http://sourcefoundry.org/hack/
  2. https://github.com/powerline/fonts
  3. https://github.com/adobe-fonts/source-code-pro
  4. 需要安装 https://github.com/ryanoasis/nerd-fonts
  5. 需要安装 https://github.com/tonsky/FiraCode

怀疑奇怪问题, 和我错误安装了某些东西有关

  • 参考这个, 做了很多, 其实不必要: https://github.com/powerline/fonts/issues/68

结论, 不要太玩命, 他们有bug是正常的事, 有些可以解决, 有些要等官方修复.