当我安装好oh my zsh之后,这些环境变量都失效了,研究一番才明白,我已经把默认的shell换成.zshrc了。所以需要把所有的环境变量重新配置到zshrc里,把你需要的这些内容拷贝到.zshrc里即可。
配置
zsh的配置主要集中在用户当前目录的.zshrc里,用vim或你喜欢的其他编辑器打开.zshrc
配置快捷命令
可以在此处定义自己的环境变量和别名,当然,oh my zsh在安装时已经自动读取当前的环境变量并进行了设置,你可以继续追加其他环境变量。
接下来进行别名的设置,我自己的部分配置如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
alias cls='clear' alias ll='ls -l' alias la='ls -a' alias vi='vim' alias javac="javac -J-Dfile.encoding=utf8" alias grep="grep --color=auto" alias -s html=mate # 在命令行直接输入后缀为 html 的文件名,会在 TextMate 中打开 alias -s rb=mate # 在命令行直接输入 ruby 文件,会在 TextMate 中打开 alias -s py=vi # 在命令行直接输入 python 文件,会用 vim 中打开,以下类似 alias -s js=vi alias -s c=vi alias -s java=vi alias -s txt=vi alias -s gz='tar -xzvf' alias -s tgz='tar -xzvf' alias -s zip='unzip' alias -s bz2='tar -xjvf'
NOTE:zsh的牛逼之处在于不仅可以设置通用别名,还能针对文件类型设置对应的打开程序,比如:
1 2 3
alias -s html=mate,意思就是你在命令行输入 hello.html,zsh会为你自动打开 TextMat 并读取 hello.html alias -s gz='tar -xzvf',表示自动解压后缀为gz的压缩包。
➜ note hexo g INFO Files loaded in 325 ms INFO Generated: js/script.js INFO Generated: fancybox/jquery.fancybox.pack.js INFO Generated: fancybox/jquery.fancybox.js INFO Generated: fancybox/jquery.fancybox.css INFO Generated: fancybox/helpers/jquery.fancybox-thumbs.js INFO Generated: fancybox/helpers/jquery.fancybox-thumbs.css INFO Generated: fancybox/helpers/jquery.fancybox-media.js INFO Generated: fancybox/helpers/jquery.fancybox-buttons.js INFO Generated: fancybox/helpers/jquery.fancybox-buttons.css INFO Generated: fancybox/helpers/fancybox_buttons.png INFO Generated: fancybox/fancybox_sprite@2x.png INFO Generated: fancybox/fancybox_sprite.png INFO Generated: fancybox/fancybox_overlay.png INFO Generated: fancybox/fancybox_loading@2x.gif INFO Generated: fancybox/fancybox_loading.gif INFO Generated: fancybox/blank.gif INFO Generated: css/style.css INFO Generated: css/images/banner.jpg INFO Generated: css/fonts/fontawesome-webfont.woff INFO Generated: css/fonts/fontawesome-webfont.ttf INFO Generated: css/fonts/fontawesome-webfont.svg INFO Generated: css/fonts/fontawesome-webfont.eot INFO Generated: css/fonts/FontAwesome.otf INFO Generated: 2015/09/29/hello-world/index.html INFO Generated: archives/index.html INFO Generated: archives/2015/index.html INFO Generated: archives/2015/09/index.html INFO Generated: index.html INFO 28 files generated in 1.01 s
看一下文件目录结构:
1 2 3
➜ note ls _config.yml node_modules public source db.json package.json scaffolds themes
# URL ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' url: http://sjq597.github.io/ root: / permalink: :year/:month/:day/:title/ permalink_defaults:
➜ note hexo d INFO Deploying: git INFO Clearing .deploy folder... INFO Copying files from public folder... On branch master nothing to commit, working directory clean Username for'https://github.com': sjq597 Password for'https://sjq597@github.com': To http://github.com/sjq597/sjq597.github.io.git + 5183f8b...aef1a55 master -> master (forced update) Branch master set up to track remote branch master from http://github.com/sjq597/sjq597.github.io.git. INFO Deploy done: git
常见问题
YAMLException
1 2 3 4
FATAL Something\'s wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 13, column 1: # URL ^