PROMPTã«branchåã表示ãããããªã¼ã¨æã£ã¦èª¿ã¹ã¦ãã¦è¾¿ãçããã®ãã
Git だろうと Mercurial だろうと、ブランチ名をzshのプロンプトにスマートに表示する方法 - mollifier delta blog
ã§ãvcs_infoã¨ããã®ã便å©ããã ãã¨æãã使ã£ã¦ã¿ããã¨ããããã©ãã使ããªãã£ã½ãã
vcs_info: function definition file not found - 写経日記
4.3.6ãããããå
¥ã£ãæ©è½ãããããªãã»ã©ãèªåã®MacBookã«æ¨æºã§å
¥ã£ã¦ãã/bin/zshã¯4.3.4ã ã
% /bin/zsh --version zsh 4.3.4 (i386-apple-darwin9.0)
zshã®install
ã¨ãããã¨ã¯æ°ããzshãå ¥ããªãã¨ãããªãã£ã½ããã©ãããMac Portsããã§å¤§ä¸å¤«ããã
% port variants zsh-devel zsh-devel has the variants: darwin_8: Platform variant, do not select manually mp_completion: Install port(1) completion file pcre: Add regular expressions support in builtin functions through PCRE doc: Install extra documentation examples: Install configuration examples universal: Build for multiple architectures % sudo port install zsh-devel +mp_completion +doc +example ... % /opt/local/bin/zsh --version zsh 4.3.10 (i386-apple-darwin9.8.0)
ã¨ãã£ã¦ã¿ããä»å調ã¹ã¦ãã¦"port variants"ã§è¿½å æ©è½ã調ã¹ãããã¨ããã®ãåãã¦ç¥ã£ããã
諸è¨å®
ã§ãããã¤ãæ¨æºã®shellã«è¨å®ãããã¨chshã§å¤æ´ãããã¨ãã¦ãã¨ã©ã¼ã«ãªããã¨â¦ã
zshをMacPortsでアップデートする - はてブロ@ama-ch
ãã®ã¸ããåèã«ã/etc/shellsãç·¨é
% cat /etc/shells # List of acceptable shells for chpass(1). # Ftpd will not allow users to connect who are not using # one of these shells. /bin/bash /bin/csh /bin/ksh /bin/sh /bin/tcsh /bin/zsh /opt/local/bin/zsh
ã¨ãªã¹ãã«å ¥ãã¦ãã£ã¦ããchshã§Shellã«"/opt/local/bin/zsh"ãè¨å®ã
ãã¨èªåã¯~/.zshrcã®PATHè¨å®ãå¾®å¦ã«çã£ã¦ããã®ã§å°ãä¿®æ£
... export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:$PATH export MANPATH=/opt/local/share/man:$MANPATH ...
ã¨ã
ããã§ä»ã¾ã§ã¨åãããã«æ®éã«æ°ããzshã使ããã£ã½ãã
æ¹ãã¦.zshrcãå¤æ´
åã³Git だろうと Mercurial だろうと、ブランチ名をzshのプロンプトにスマートに表示する方法 - mollifier delta blogãåèã«ãã¤ã¤ã.zshrcãæ¸ãæããã
ä»åPROMPTã«é¢ãã¦å¤æ´ããã®ã¯ä»¥ä¸ã®é¨åã
autoload -U colors colors autoload -Uz vcs_info zstyle ':vcs_info:*' enable git svn zstyle ':vcs_info:*' formats '%{'${fg[red]}'%}[%s %b] %{'$reset_color'%}' setopt prompt_subst precmd () { LANG=en_US.UTF-8 vcs_info LOADAVG=$(sysctl -n vm.loadavg | perl -anpe '$_=$F[1]') PROMPT='${vcs_info_msg_0_}%{${fg[yellow]}%}%* ($LOADAVG) %%%{$reset_color%} ' } RPROMPT='%{${fg[green]}%}%/%{$reset_color%}'
gitã®branchãåå¨ããå ´åã¯èµ¤ã§PROMPTã®å·¦ç«¯ã«è¡¨ç¤ºããããã«ãã¦ã¿ãã
å®è¡ã¤ã¡ã¼ã¸ã¯ä»¥ä¸ã®ãããªã«ã³ã¸ã
ã¾ãã¬ã¤ã¢ã¦ãã¯ãã¨ã§ä½¿ããªãã調æ´ããã¨ãã¦ãã¨ãããã表示ããããã¨ãã§ããããã«ãªã£ãï¼ãã¼ã