zshã®ããã³ããã«pyenv(Python)ã®ç¶æ ã表示ãã
ä¹
ã
ãªã®ã§ã²ã£ããã¨æ´æ°
ãªãããªãå
¼ãã¦è»½ãã®ãã®ã1ã¤ã
ã¯ããã«
æè¿éãè °ãããã¦ãããã Python ã®éçºç°å¢ãpyenvã«ç§»è¡ãã¾ããã
ã¾ã 使ãå§ããã°ããã§ãããªããªãã®å¥½æ触ã
ãã ãpyenv ã使ã£ã¦ã¦æ°ã«ãªã£ãã®ããç¾å¨ã©ã® Python ã使ã£ã¦ããã®ããåããã¥ããã¨ããç¹ã
ããããPATHæ¸ãæãæ¹å¼ã§ã¯ãªãã®ã§ãwhich(type) ã³ãã³ãã§ãã¹ãè¦ã¦ãåãããªããã§ãããã
æåä»çµã¿ãç解ãã¦ãªãã¦æ©ãã§ãã¾ãã¾ããâ¦
$ pyenv version system (set by /Users/yonchu/.pyenv/version) $ which python /Users/yonchu/.pyenv/shims/python $ pyenv global 2.7.8 $ pyenv version 2.7.8 (set by /Users/yonchu/.pyenv/version) $ which python /Users/yonchu/.pyenv/shims/python
pyenv ã³ãã³ãã使ãã°åãã話ãªã®ã§ãããpyenv ãå
¥ãã¦ãç°å¢ã»å
¥ãã¦ãªãç°å¢ã»å
¥ãã¦ããã©ä½¿ã£ã¦ãªãç°å¢ãæ··å¨ããã¨æ··ä¹±ãã¡ãããã§ãããã
çµ±ä¸ãããã£ã¦è©±ã§ããâ¦
ã¨ããããã§ãzsh ã®ããã³ããã« Python ã®ãã¼ã¸ã§ã³ã¨ä»®æ³ç°å¢åã表示ããããã¨ã«ãã¾ããã
zsh-python-prompt ãä½ã£ã
zsh ã®ãã©ã°ã¤ã³ã¨ãã¦ä»¥ä¸ã«å ¬éãã¾ããã
zsh ã¹ã¯ãªããã®ãªãããªããããã£ãã®ã§ãautoload ãªããã使ã£ã¦ zsh ãããä»ä¸ãã¦ã¿ã¾ããã
å°å ¥æ¹æ³
zsh-python-prompt ãé©å½ãªå ´æã«é ç½®
$ git clone https://github.com/yonchu/zsh-python-prompt.git
.zshrc å ã§ä»¥ä¸ã®ããã« source ããã(ãã¹ã¯é©å®æ¸ãæãã¦ä¸ãã)
source /path/to/zsh-python-prompt/zshrc.zsh
ããã³ããã«è¨å®
PROMPT+='$ZSH_PYTHON_PROMPT'
以ä¸
ããã
ä»åã¯ãããªæãã§ãä¹ ã ã®æ´æ°ã§ããã
ãã£ãã·ã¥æ©è½ä»ãã§ããããåä½ã軽ãã®ã§ãè¯ããã°ä½¿ã£ã¦ã¿ã¦ãã ããã
è£è¶³
ä¸ã§ zsh で source して使うプラグインを作るのは止めにしよう - Qiita ã¨ããè¨äºã¸ã®ãªã³ã¯ãå¼µã£ã¦ãããªãããsource ãã¦ããããã¼ãã¨è¨ããããã§ãããã³ã¼ãã®è¦éããå°å ¥ã®ç°¡åããªã©ãèãã¦ãåæè¨å®ç¨ã®ã³ã¼ãã®ã¿ source ããããã«ãã¾ããã
zsh ã®è£å®é¢æ°ã§ ãã£ãã·ã¥æ©è½(cache-policy) ã使ã
ä»å㯠grunt ã³ãã³ãã®è£å®é¢æ°ãä¾ã¨ã㦠ãã£ãã·ã¥æ©è½(cache-policy) ã«ã¤ãã¦è§£èª¬ãã¦ããã¾ãã
grunt ã«ã¤ãã¦ã¯ç¥ããªãã¦ã大ä¸å¤«ã ã¨æãã¾ãã
ãã£ãã·ã¥æ©è½(cache-policy) ã«ã¤ãã¦ã®è§£èª¬ãã¡ã¤ã³ãªã®ã§ãzsh è£å®é¢æ°ã®åºæ¬çãªèª¬æã¯çç¥ãã¾ãã
ãã®ä»£ãããã³ã¼ãå
ã«ã³ã¡ã³ãã§ç°¡åãªèª¬æãæ¸ãã¾ããã®ã§ãã¡ããåèã«ãã¦ä¸ããã
â» ã¨ã¦ãé·ãè¨äºãªã®ã§ã誤åè±åãããããããã¾ãããã容赦ä¸ãããm(_ _)m
(è¦ã¤ãããæãã¦ãããã¨å©ããã¾ã)
ã¯ããã«
grunt ã«ã¯æ¨æºã§ bash ã®è£å®ãã¤ãã¦ãã¾ãã
ããããzsh ç¨ã®è£å®é¢æ°ã¯ç¡ããbash ã®è£å®ã¨åãæ¹æ³ã§å®è£
ããã®ã§ã¯ãªãã·ã§ã³ãã¿ã¹ã¯ã®èª¬æã表示ããã¾ããã
ãªãã·ã§ã³ã®èª¬æã¯ãã¿æ¸ãã§ããã¨ãã¦ããã¿ã¹ã¯ã®èª¬æã¯ããã¯ããã¾ããã
ã¨ãããã¨ã§ä½æããã®ããgrunt-zsh-completion ã§ãã
grunt ã®ã¿ã¹ã¯ã¯ã"grunt --version --verbose" ã¾ã㯠"grunt --help" ã§åå¾ãããã¨ãã§ãã¾ãããåè ã¯å®è¡ãæ©ã代ããã«ã¿ã¹ã¯ã®èª¬æãåå¾ã§ãã¾ãããå¾è ã¯å®è¡ãé ããããã«ã¿ã¹ã¯ã®èª¬æãåå¾ãããã¨ãã§ãã¾ãã
bash ã®è£å®ã§ã¯åè ãæ¡ç¨ããã¦ãããä»åä½æãã grunt-zsh-completion ã§ã¯å¾è ãæ¡ç¨ãã¾ããã
ããã«ã"grunt --help" ã®é ããã«ãã¼ããããã« ãã£ãã·ã¥æ©è½(cache-policy) ãå®è£ ãã¾ããã
ä»å㯠grunt-zsh-completion ãä¾ã¨ãã¦è§£èª¬ããããã§ãããå®éã®ã³ã¼ãã§ã¯ã¡ãã£ã¨è¤éãããã®ã§è§£èª¬ç¨ã«ä½åãªé¨åãçããã³ã¼ãã§è¦ã¦ãããã¨ã«ãã¾ãã
ãã£ãã·ã¥æ©è½ãæå¹ã«ãã
解説ã®åã«ãã¾ãã¯ãã£ãã·ã¥ãæå¹ã«ãã¾ãããã
ãããè£å®é¢æ°ããã£ãã·ã¥æ©è½ãå®è£ ãã¦ãã¦ããããã使ç¨ããã¦ã¼ã¶ããã£ãã·ã¥ãæå¹ã«ãã¦ããªããã°æå³ãããã¾ããã
æä½é以ä¸ã®è¨å®ã .zshrc ã«æ¸ãã¦ããã¦ä¸ããã
zstyle ':completion:*' use-cache yes
è£å®é¢æ°ãä½ãäºå®ã®ãªãæ¹ã§ãããã£ãã·ã¥ãæå¹ã«ãã¦ãããæ¹ãè¯ããã¨æãã¾ãã
(ã¨ãã£ã¦ããã£ãã·ã¥ã«å¯¾å¿ããè£å®é¢æ°ã¯ãã¾ãå¤ãããã¾ããã)
ãã£ãã·ã¥ã®ä¿åå ´æã«ã¤ãã¦
ãã£ãã·ã¥ã¯ ~/.zcompcache ãã£ã¬ã¯ããªé ä¸ã«ããã£ãã·ã¥æ¯ã«ãã¡ã¤ã«ãä½ããã¾ãã
ä»åã®å ´åãgrunt ã¨ããååã§ãã£ãã·ã¥ãã¡ã¤ã«ãä½ãããã¯ãã§ãã
ãã£ãã·ã¥ãã¡ã¤ã«åã¯ãå®è£
è
ãèªç±ã«æ±ºãããã¨ãã§ãã¾ãã
$ ls ~/.zcompcache
grunt
ãã£ãã·ã¥ãã¡ã¤ã«ã®ä¸ã«ã¯ãå¤æ°åã¨ãã®å¤ãæ¸ããã¦ãã¦ã
ãã¡ã¤ã«ããã®ã¾ã¾ source ããã°ãã£ãã·ã¥ã復å
ã§ãããããªå½¢å¼ã«ãªã£ã¦ãã¾ãã
ãã£ãã·ã¥ã®å¾©å
ã¯å°ç¨ã®é¢æ°ãç¨æããã¦ããã®ã§èªèº«ã§ source ããå¿
è¦ã¯ããã¾ãã
è£å®é¢æ°ã®å ¨ä½ã³ã¼ã
ããã§ã¯å®è£
ã®èª¬æã§ãã
ã¾ãã¯å
¨ä½ã®ã³ã¼ããè¦ã¦ã¿ã¾ãããã
以ä¸ã®ã³ã¼ãã¯å®éã«åããã¦åä½ç¢ºèªãè¡ããã¨ãã§ãã¾ãã
ãã ããè£å®ããããªãã·ã§ã³ãã¿ã¹ã¯ã¯è§£èª¬ç¨ã®ããã¼ã«ãªã£ã¦ãã¾ãã
ããã§ã¯ãã³ã¼ãå ã®çªå·ãæ¯ã£ã¦ããã¨ãããä¸å¿ã«è§£èª¬ãã¦ããããã¨æãã¾ãã
å®è£ 解説
1.cache-policy ãè¨å®
############################### # 1.cache-policy ãè¨å® ############################### zstyle -s ":completion:${curcontext}:" cache-policy update_policy if [[ -z $update_policy ]]; then zstyle ":completion:${curcontext}:" cache-policy __grunt_caching_policy fi
ã¾ãå é ã®ã
zstyle -s ":completion:${curcontext}:" cache-policy update_policy
ã¨ããæ§æã¯ãã³ã³ããã¹ã ":completion:${curcontext}:" ã® ã¹ã¿ã¤ã« cache-policy ã®å¤ã
update_policy å¤æ°ã«è¨å®ããã¨ããæå³ã«ãªãã¾ãã
-s ã¯æååã¨ãã¦åå¾ããã¨ããæå³ã§ãã
ãã㦠if æã®ä¸ã«ããã
zstyle ":completion:${curcontext}:" cache-policy __grunt_caching_policy
ã¨ããæ§æã¯ãcache-policy ã« __grunt_caching_policy ã¨ããæååãè¨å®ãã¦ãã¾ãã
ã³ã³ããã¹ã ã ã¹ã¿ã¤ã« ã¨ãã£ãç¨èªã¯ãããã§ã¯ãã¾ãæ·±ãèããã«ããããç¨èªã ã¨æã£ã¦ä¸ããã
ã³ã³ããã¹ã ãåå空éãã¹ã¿ã¤ã« 㯠ãã¼ ã ã¨èããã¨åãããããã¨æãã¾ãã
é£ãããã«è¦ãã¾ãããä¸åº¦èªåã§ä½¿ã£ã¦ã¿ãã¨ããã«ç解ã§ãã¾ãã
ä¾ãã°ä»¥ä¸ã®ããã«èªåã§ä½¿ç¨ãããã¨ãã§ãã¾ãã
(ã³ã³ããã¹ããæ¢åã®ãã®ã¨è¢«ã£ã¦ããªããã°èªç±ã«ä½¿ãã¾ã)
# ":hoge:hoge" fuga ã« something ã¨ããæååãè¨å® $ zstyle ":hoge:hoge" fuga something # å¤æ° var ã«è¨å®ããã¦ããå¤ãåå¾ãã $ zstyle -s ":hoge:hoge" fuga var $ echo "$va" something
ãã®ããã«ãzstyle ã使ç¨ãããã¨ã§ã°ãã¼ãã«ç©ºéãæ±æãããã¨ãªãå¤ãä¿åãããã¨ãã§ãã¾ãã
zsh ã®ãã©ã°ã¤ã³ãä½ãå ´åãªã©ã«ãè¨å®å¤ãä¿æããã®ã«å©ç¨ããã¨è¯ãã§ãããã
ã°ãã¼ãã«ãªã·ã§ã«å¤æ°ãç°å¢å¤æ°ã使ç¨ããããã¹ãã¼ãã§ãã
話ãæ»ãã¾ãã
cache-policy ã«è¨å®ãã __grunt_caching_policy ã¨ããæååã¯ããã£ãã·ã¥ãæå¹ãã©ãã
å¤å¥ããã®ã«ä½¿ç¨ããé¢æ°ã®ååã§ããèªåã§å®ç¾©ããé¢æ°ã®ååãè¨å®ãã¦ãã¾ãã
ãã®é¢æ°ã®ä¸èº«ãããããã¤å¼ã°ããããªã©ã«ã¤ãã¦ã¯ãã¾ãå¾ã§èª¬æãã¾ãã
2.ãã£ãã·ã¥ã®å¾©å ã¨æ´æ°ãè¡ã
######################################## # 2.ãã£ãã·ã¥ã®å¾©å ã¨æ´æ°ãè¡ã ######################################## # ã°ãã¼ãã«å¤æ° __grunt_tasks ã«ã¿ã¹ã¯æ å ±ãè¨å®ããã if __grunt_retrieve_update_cache; then update_msg='(cache updated)' fi
__grunt_retrieve_update_cache é¢æ°ãå®è¡ããã¨ã ã°ãã¼ãã«å¤æ° __grunt_tasks ã«ã¿ã¹ã¯æ å ±ãè¨å®ãããããã«ãªã£ã¦ãã¾ãã
詳ããã¯å¾è¿°ãã¾ãããã¾ãã¯å ¨ä½ã®æµããç¥ã£ã¦ãããããã®ã§ãããã§ã¯ __grunt_tasks å¤æ°ã«ã¿ã¹ã¯æ å ±ãè¨å®ããããã¨ãããã¨ã ãç解ãã¦ããã¦ä¸ããã
ã¾ãããã®é¢æ°ã¯ãã£ãã·ã¥ãæ´æ°ããå ´åã«æ»ãå¤ãçã«ãªãããã«ãªã£ã¦ãã¾ãã
update_msg å¤æ°ã¯ããã£ãã·ã¥ãæ´æ°ããããã¨ãã¦ã¼ã¶ã«ç¥ããããããè£å®ã表示ããã¨ãã«ä½¿ç¨ãã¾ãã
å¿
é ã§ã¯ããã¾ãããããããã°ã«ãå½¹ç«ã¤ã®ã§ããããã§ãã
(ãã³ãã¯ãããã°ç¨ã«ä½¿ã£ã¦ããã ãã©ã便å©ã ã£ãã®ã§æ¬å®è£
ã«ãæ®ããã£ã¦ã ããªãã§ããã©)
3.ã¿ã¹ã¯è£å®
###################### # 3.ã¿ã¹ã¯è£å® ###################### case $state in tasks) ### 3.ã¿ã¹ã¯è£å® # __grunt_tasks å¤æ°ã¨ _describe é¢æ°ã使ç¨ãã¦ã¿ã¹ã¯ãè£å® _describe "grunt task$update_msg" __grunt_tasks || return 1 ;; esac
ããã§ã¯ã__grunt_tasks å¤æ°ã¨ _describe é¢æ°ã使ç¨ãã¦ã¿ã¹ã¯ãè£å®ãã¾ãã
_describe é¢æ°ã¯ zsh ãæä¾ãã¦ããé¢æ°ã§ã第1å¼æ°ã«è£å®ã°ã«ã¼ãåãã第2å¼æ°ã«è£å®æ å ±ã®å ¥ã£ãå¤æ°ã®å¤æ°åãæå®ãã¾ãã
ã°ã«ã¼ãåã¯èªç±ã«ã¤ãããã¨ãã§ãã¾ãã
$ grunt [Tab] -- grunt task (cache updated) -- << ããã«è£å®ã°ã«ã¼ãåã表示ããã clean -- Clean files and folders fuga -- fuga task hoge -- hoge task
4.ãã£ãã·ã¥ã®å¾©å ã¨æ´æ°
ç¶ãã¦ãå¾è¿°ããã¨è¨ã£ã __grunt_retrieve_update_cache é¢æ°ã®èª¬æããã¾ãã
ããããä¸çªéè¦ãªé¨åã§ãã
ãã£ãã·ã¥ã®ç¨®é¡ãå¢ãããããã£ã·ã¥ã®æ´æ°/復å
æ¡ä»¶ãè¤éã«ãªãã¨ãå®è£
ãé£è§£ã«ãªã£ã¦ãã¾ãã
############################################################ # 4.ãã£ãã·ã¥ã®å¾©å ã¨å¿ è¦ãªããã£ãã·ã¥ã®æ´æ°ãè¡ã ############################################################ # ãã£ãã·ã¥ãã¡ã¤ã«å: grunt # ãã£ãã·ã¥å¤æ°å: __grunt_tasks function __grunt_retrieve_update_cache() { if ( ! (( $+__grunt_tasks )) \ || _cache_invalid 'grunt' ) \ && ! _retrieve_cache 'grunt'; then ### ãã£ãã·ã¥ã®æ´æ°ãå¿ è¦ # æ°ãã« grunt ã®ã¿ã¹ã¯æ å ±ãåå¾ __grunt_tasks=(${(f)"$(__grunt_get_tasks)"}) ### ãã£ãã·ã¥ãä¿å _store_cache 'grunt' __grunt_tasks return 0 fi return 1 }
ã¾ãã
if ( ! (( $+__grunt_tasks )) \ .... fi
ã¨ããæ§æã¯ã__grunt_tasks å¤æ°ãå®ç¾©ããã¦ãããã©ãããå¤å¥ãã¦ãã¾ãã
$+__grunt_tasks 㯠$+ ã«ç¶ãå¤æ°ãå®ç¾©ããã¦ããã° é0 ããå®ç¾©ããã¦ããªããã° 0 ãè¿ãã¾ãã
ããã¦ã( ( ... ) ) ã¯ç®è¡å¼è©ä¾¡ã¨ãã£ã¦ãä¸ã®å¼ã é0 ãªã "ç"ã0 ãªã "å½" ã«ãªãã¾ãã
ãã£ã¦ãã®æ§æã¯ã__grunt_tasks å¤æ°ãæªå®ç¾©ãªã "ç" ã¨ãªãã¾ãã
ç¶ãã¦ã
_cache_invalid 'grunt'
ã¨ããé¨åã¯ããã£ãã·ã¥ãç¡å¹ãã©ãããå¤å¥ãã¦ãã¾ãã
_cache_invalid é¢æ°ã¯ zsh ãæä¾ããé¢æ°ã§ãå¼æ°ã«æå®ãããã£ãã·ã¥ã ç¡å¹ãªã "ç"ãæå¹ãªã"å½" ãè¿ãã¾ãã
å¼æ°ã«æå®ãããã£ãã·ã¥åã¯èªç±ã«æ±ºãããã¨ãã§ãã¾ãã
ããã¦ããã®ãã£ãã·ã¥åãåè¿°ã® ãã£ãã·ã¥ãã¡ã¤ã«å ã¨ãã¦å©ç¨ããã¾ãã
ç¶ãã¦ã
! _retrieve_cache 'grunt'
ã¨ããé¨åã¯ãååã®éããã£ãã·ã¥ãåå¾(復å
)ãã¦ãã¾ãã
å¼æ°ã«ãã£ãã·ã¥åãæå®ãããã£ãã·ã¥ãæå¹ãªã復å
ããæ»ãå¤ã "ç" ã¨ãªãã¾ãã
ä¾ã _cache_invalid ãå½ãè¿ããã¨ãã¦(ãã£ãã·ã¥ãæå¹ã§ã)ãã¦ã¼ã¶ããã£ãã·ã¥æ©è½ãç¡å¹ã«ãã¦ããå ´åã«ã¯ããã£ãã·ã¥ã®å¾©å
ã«å¤±æãã¾ãã
ãã®ãããæ»ãå¤ã®ãã§ãã¯ãè¡ãªã£ã¦ãã¾ãã
çµå±ããã£ãã·ã¥ã復å
åºæ¥ãªããã° if æã®ä¸ãå®è¡ãããããã«ãªã£ã¦ãã¾ãã
(ã¡ãã£ã¨ããªããã¼ãªæ¸ãæ¹ã§ããããã®æ¸ãæ¹ãä¸çªç°¡æ½ãã¨æãã¾ã)
ç¶ãã¦ãif æã®ä¸èº«ã«ã¤ãã¦ã§ãã
### ãã£ãã·ã¥ã®æ´æ°ãå¿ è¦ # æ°ãã« grunt ã®ã¿ã¹ã¯æ å ±ãåå¾ __grunt_tasks=(${(f)"$(__grunt_get_tasks)"}) ### ãã£ãã·ã¥ãä¿å _store_cache 'grunt' __grunt_tasks return 0
ãã£ãã·ã¥ãå©ç¨ã§ããªãã®ã§ grunt ã®ã¿ã¹ã¯æ
å ±ãæ°ãã«åå¾ãã¾ãã
ããã¦ãåå¾ããã¿ã¹ã¯æ
å ±ãã
_store_cache 'grunt' __grunt_tasks
ã¨ããé¨åã§ãã£ãã·ã¥ã¨ãã¦ä¿åãã¦ãã¾ãã
第1å¼æ°ã«ãã£ãã·ã¥åãã第2å¼æ°ä»¥éã«ä¿åããå¤æ°åãæå®ãã¾ãã
ãã£ãã·ã¥ãä¿åããã¨ããã£ãã·ã¥ãã¡ã¤ã«(~/zcompcache/grunt) ãä½ããã¾ãã
ä¸èº«ã¯ä»¥ä¸ã®ããã«ãªãã¯ãã§ãã
$ cat ~/.zcompcache/grunt __grunt_tasks=( 'hoge:hoge task' 'fuga:fuga task' 'clean:Clean files and folders' )
ããã¦ãåè¿°ã® _retrieve_cache é¢æ°ã§ãã£ãã·ã¥ã復å
ããã¨ã_store_cache é¢æ°ã§æå®ããå¤æ°åã®å¤æ°ã«ãã£ãã·ã¥ã復å
ããã¾ãã
(ä¸è¨ãã£ãã·ã¥ãã¡ã¤ã«ã source ãããã¨èããã¨åãããããã§ã)
ã¾ããä»åã¯1å¤æ°ããä¿åãã¾ããã§ãããã_store_cache ã«è¤æ°ã®å¤æ°ã渡ããã¨ãã§ãã¾ãã
_store_cache 'grunt' __grunt_tasks hoge fuga
注æãã¹ãç¹ã¨ãã¦ã_store_cache é¢æ°ã¯å¸¸ã«æ°ãããã£ã·ã¥ãçæãããããè¤æ°è¡ã«åãã¦å®è¡ãããã¨ã¯ã§ãã¾ããã
è¤æ°è¡ã«åãã¦å®è¡ããå ´åã¯ãæå¾ã®ã¿æå¹ã«ãªãã¾ãã(å¤æ°åãå¤ãã¦ããã¡ã§ã)
å¿
è¦ãªãå¥ã®ãã£ãã·ã¥åãæå®ãã¾ãããã
æå¾ã«ããã£ãã·ã¥ãæ´æ°ããã®ã§ return 0 㧠"ç" ãè¿ãã¦ãã¾ãã
5.cache-policy ã«è¨å®ããé¢æ°
cache-poilcy ã«è¨å®ããé¢æ°ã®èª¬æã§ãã
ãã®é¢æ°ã¯ã_cache_invalid ã¾ãã¯ã_retrieve_cache é¢æ°å®è¡æã«ããã£ãã·ã¥ãæå¹ãã©ãããã§ãã¯ããããã«å¼ã°ãã¾ãã
ãã®é¢æ°ã§ã¯ã$1 å¤æ°ã«ãã£ãã·ã¥ãã¡ã¤ã«ã®ãã¹ãè¨å®ããã¾ãã
ä»åã®å ´åã¯ã~/.zcompcache/grunt ãè¨å®ãããã¯ãã§ãã
ã¾ããæ»ãå¤ã "ç" (return 0) ãªããã£ãã·ã¥ãç¡å¹ã¨å¤æããã"å½" (return éã¼ã) ãªãæå¹ã¨å¤æããã¾ãã
####################################### # 5.cache-policy ã«è¨å®ããé¢æ° ####################################### # $1 ã«ãã£ãã·ã¥ãã¡ã¤ã«ã®ãã¹ãå ¥ã£ã¦ãã¾ã # # æ»ãå¤: # ç (return 0) : ãã£ãã·ã¥ç¡å¹ # å½ (return éã¼ã) : ãã£ãã·ã¥æå¹ function __grunt_caching_policy() { local -a oldp # Nm+7 ã¨æå®ããã¨ãã£ãã·ã¥ã®æå¹æéã 7æ¥ ã¨ãªã # Nmw+1 ã¨æå®ãã㨠1é±é # Nmh+1 ã¨æå®ãã㨠1æé # Nmm+1 ã¨æå®ãã㨠1å oldp=( "$1"(Nm+7) ) (( $#oldp )) }
ã¾ãã
oldp=( "$1"(Nm+7) )
ã¨ããæ§æã«ã¤ãã¦ã§ãã
ãã®ä¸ã® "$1"(Nm+7) ã¨ããé¨åã¯ãã°ãã修飾å (Glob Qualifiers) ãç¨ãã ãã¡ã¤ã«åçæ(ã°ããã³ã°) ã¨ãã£ã¦ããã¡ã¤ã«åã®æ«å°¾ã« (Nm+7) ã®ãããªã°ãã修飾åãã¤ãããã¨ã§ãæ¡ä»¶ã«ããããããã¡ã¤ã«åã®ã¿æ®ãã¨ããææ³ã§ãã
(N) ã¯ãæ¡ä»¶ã«ããããããã¡ã¤ã«ããªãå ´åã«ã¨ã©ã¼ã¨ããªãã°ãã修飾åã§ãã
(m+7) ã¯ããã¡ã¤ã«ã®æçµå¤æ´æ¥æãã7æ¥ä»¥ä¸çµã£ã¦ãããã®ãã¨ããæå³ã®ã°ãã修飾åã§ãã
ãã£ãã·ã¥ãã¡ã¤ã«ãå¤æ´ããã¦ãã7æ¥ä»¥ä¸çµã£ã¦ããã°ãæ¡ä»¶ã«ãããããã®ã§ "$1" ããã®ã¾ã¾æ®ãã¾ãã
7æ¥æªæºãªããæ¡ä»¶ã«ãããããªãã®ã§ç©ºã«ãªãã¾ãã
(ãã®ã¨ãã¨ã©ã¼ã«ããªãããã«ã(N) ã¨ããã°ãã修飾åã使ã£ã¦ãã¾ã)
ä»ã«ã (a+7) ã§ã¢ã¯ã»ã¹æ¥æã(c+7) ã§iãã¼ãå¤æ´æ¥æããã§ãã¯ãããã¨ãã§ãã¾ãã
ç¶ãã¦ã
oldp=(...)
ã¨ããé¨åã¯ãé
åã oldp å¤æ°ã«ä»£å
¥ãã¦ãã¾ãã
ããã¯ããã¡ã¤ã«åçæ(ã°ããã³ã°) ãå®è¡ããããã«ããããæ¸ãæ¹ããã¦ãã¾ãã
ããã§ããã£ãã·ã¥ãã¡ã¤ã«ãå¤æ´ããã¦ãã7æ¥ä»¥ä¸çµã£ã¦ããã°ãoldp é åã«ãã£ãã·ã¥ãã¡ã¤ã«åãè¨å®ãããããã«ãªãã¾ãã
æå¾ã«ã
(( $#oldp ))
ã¨ããé¨åã§ãã
ããã¯ãã§ã«ç´¹ä»ããç®è¡å¼è©ä¾¡ã®æ§æã§ãoldp é
åã® length ã é0 ãªã "ç"ã0 ãªã "å½" ã¨ãªãã¾ãã
ã¤ã¾ãããã£ãã·ã¥ãã¡ã¤ã«ãå¤æ´ããã¦ãã7æ¥ä»¥ä¸çµã£ã¦ããã°ãoldp é åã«ãã£ãã·ã¥ãã¡ã¤ã«åãè¨å®ãããã®ã§ length ã 1 ã¨ãªããç®è¡å¼è©ä¾¡ã®çµæã "ç" ã¨ãªãã¾ãã
ããã¦ãé¢æ°å 㧠return æãçç¥ããã¨æé»ã® return ãå®è¡ãããæå¾ã«è©ä¾¡ããå¼ã®æ»ãå¤ãé¢æ°å ¨ä½ã®æ»ãå¤ã¨ãªãã¾ãã
ããã¯ãåã« return ã¨æ¸ããå ´åããreturn $? ã¨æ¸ããå ´åã¨åãæå³ã«ãªãã¾ãã
å®è£ 説æçµãã
å®è£ ã®èª¬æã¯ä»¥ä¸ã§ãã
ãããã§ããã§ããããï¼
å°ãã§ãç解ã®å©ãã«ãªãã°å¹¸ãã§ãã
è£å®é¢æ°ãæ¸ãä¸ã§åèã«ãªããããªãªã³ã¯
æå¾ã«ãè£å®é¢æ°ã®åºæ¬ãç解ããã®ã«å½¹ç«ã¡ãããªè¨äºã®ãªã³ã¯ãå¼µã£ã¦ããã¾ãã
ä»ã«ããããã®è¨äºãªã©ããã°æãã¦ãã ããã
ããã¨ã以ä¸ã®æ¸ç± "zshã®æ¬" ãè¶
絶ããããã§ãã
ãã£ãã·ã¥ã«é¢ãã¦ã¯æ®å¿µãªããè¨è¿°ã¯ããã¾ããã§ãããããã以å¤ãªãã ãããæ¸ãã¦ã¾ãã
(ç´¢å¼ãå¼±ãã®ã ããé£ç¹)
zshã®æ¬ (ã¨ãã»ã³ã·ã£ã«ã½ããã¦ã§ã¢ã¬ã¤ãããã¯) åºç¬ éäº æè¡è©è«ç¤¾ 2009-06-17 売ãä¸ãã©ã³ãã³ã° : 231694
|
ç¨èªããã©ã°ã調ã¹ããå ´åã¯ã以ä¸ã®æ¹æ³ãããããã§ãã
ããã
ãã£ãã·ã¥æ©è½ãå¿ è¦ã«ãªãã±ã¼ã¹ã¯ç¨ããããã¾ããããããå¿ è¦ã«ãªã£ãæã«ã¯ãã®è¨äºãæãåºãã¦é ããã°ã¨æãã¾ãã
ãã¨ãå®éã® grunt è£å®ããå©ç¨ã«ãªãããæ¹ã¯ã以ä¸ã®ææ°çãã使ç¨ä¸ããã
解説ç¨ã®ãµã³ãã«ã¨æ¯ã¹ãã¨ããªãè¤éã«ãªã£ã¦ãã¾ãã
èå³ã®ããæ¹ã¯è§£æãã¦ã¿ã¦ä¸ããã
以ä¸ã§è§£èª¬ã¯çµããã§ãã
質åãããã£ã¨ãã®è¾ºã詳ããæ¸ãã¦æ¬²ãããªã©ããã¾ãããããæ°è»½ã«ãå°ããã ããã
ã·ã§ã«ã¹ã¯ãªããã®ãããã°ã¯ typeset ã¾ã㯠declare ã使ãã¨è¯ããã
ã¯ããã«
ã¤ãæè¿ç¥ã£ã便å©ãªãããã°æ¹æ³
(é·å¹´ã·ã§ã«ã¹ã¯ãªãããæ¸ãã¦ããã®ã«ç¥ããªãã£ããããã常èã ã£ããæ¥ããããâ¦)
ã·ã§ã«ã¹ã¯ãªããã®ãããã°ã§ã¯ echo ã§å¤æ°ã®ä¸èº«ãè¦ãã¨ããåå§çãªæ¹æ³ããã使ããã¨æãã¾ãã
ãããã ããªã³ããããã° ã¨ãããã¤ã§ããã
ããå°ã詳ãããããã°ãå¿ è¦ãªå ´åã¯ã set -x 㨠set +x ã§ãããã°ãããé¨åãå²ãã¨ããæ¹æ³ãããã¾ãã
ä»å㯠ããªã³ããããã° ã§ä½¿ã echo ã®ä»£ããã« typeset or declare ã使ãã¨è¯ãã¨ããã話ã§ãã
ããªã³ããããã°ã¯ typeset or declare ã使ãã
typeset or declare ã¯å¤æ°å®£è¨ãªã©ã§ãã使ãã³ãã³ãã§ãããå¤æ°ã®ä¸èº«ãè¦ãã®ã«ã使ãã¾ãã
echo ã¨æ¯ã¹ã¦ä½ãè¯ãã®ãã¨ããã¨ãå¤æ°ã®ä¸èº«ã¯ãã¡ããå¤æ°åãå¤æ°ã®åã表示ãã¦ãããé åã®å ´åã«ãè¯ãæãã«è¡¨ç¤ºãã¦ãããã®ã§ãã
ãããã echo "hoge=$hoge" ã¨ã echo "hoge=${hoge[@]}" ãªã©ã¨ããªãã¦ãè¯ãã
typeset or declare ã¯ãã«ãã¤ã³ã³ãã³ããªã®ã§ä½¿ç¨ããã·ã§ã«ã«ãã£ã¦è¥å¹²ã®éããããã¾ãã
ä»åã¯ç§ããã使ã sh/bash 㨠zsh ã«ã¤ãã¦è§¦ãã¾ãã
(sh 㨠bash ã¯ä»åã®å ´åã¯åããªã®ã§åºå¥ãã¾ãã)
sh/bash
bash ã§ã¯ãtypeset 㯠obsolete ã¨ãªã£ã¦ãã¾ãã
declare ã使ç¨ã§ããç°å¢ã§ã¯ declare ã使ãã¨è¯ãã§ãããã
(typeset ã®æ¹ã馴æã¿æ·±ãããããã¾ããã)
## æåå $ str='This is a pen.' $ declare -p str declare -- str="This is a pen." ## é å $ array=('This is' a pen.) $ declare -p array declare -a array='([0]="This is" [1]="a" [2]="pen.")'
å¤æ°åãåã表示ããã¦ãã¦ãé åãè¦ãããæ´å½¢ããã¦ããã®ãåããã¾ããã
zsh
zsh ã§ã¯ typeset 㨠declare ã¯å ¨ãåãã§ãã
## æåå $ str='This is a pen.' $ typeset str str='This is a pen.' $ typeset -p str typeset str='This is a pen.' ## é å $ array=('This is' a pen.) $ typeset array array=('This is' a pen.) $ typeset -p array typeset -a array array=('This is' a pen.) # é åå ã®ãã¼ã¿ãå¤ãå ´åãªã©ã¯ä»¥ä¸ã®ããã«ãã¦æ¹è¡åºåãã§è¡¨ç¤ºãããã¨è¯ãã§ããã # j ãã©ã°ã«ã¤ãã¦ã¯å¾è¿° $ echo "${(j:\n:)array[@]}" This is a pen ## é£æ³é å $ typeset -A associative $ associative=(key1 val1 key2 val2) $ typeset associative associative=(key1 val1 key2 val2 ) $ typeset -p associative typeset -A associative associative=(key1 val1 key2 val2 )
zsh ã 㨠åæ å ±ãªãã§ãã -p ãªãã·ã§ã³ãä»ããªãã¦ã表示ãããã®ã§ãã¿ã¤ãæ°ãå°ãªãã¦ãã¿ã¾ããã
(é£æ³é
åã®è¡¨ç¤ºã¯ããå°ãè¯ãæãã«è¡¨ç¤ºãã¦ããã¦ãè¯ãã®ã§ã¯ã¨æããªãããªãã
ã¨ããããé
åãbashã®æ¹ãåããããããããªæ°ãâ¦)
ããã¨ãæ°ã¥ãã人ãããããããã¾ããããtypeset or declare ã®åºåããã®ã¾ã¾ãã¡ã¤ã«ã«ä¿åãã¦ããã¨ã§ãã®ãã¡ã¤ã«ã source ãããã¨ã§ãã¼ã¿ã復å
ãããã¨ãã§ãã¾ãã(sh/bash, zsh ã¨ãã«å¯è½)
(ã¨ãããå
ã
ããããç¨éãªã®ãããããªã)
ã·ãªã¢ã¢ã©ã¤ãºã®ãããªãã®ã§ããã
è²ã ã¨ä½¿ãéãããããã§ãã
ãã¾ã - zsh ã®å¤æ°å±éã®ãããã°ã«ã¤ãã¦
ããããã¯ã¡ãã£ã¨æ¿ã話ã«ãªãã¾ãã
zsh ã使ããªãæ¹ã§ããzsh ã®åããåããã®ã§ãå¦ççµæã ãã§ãè¦ã¦ã¿ã¦ä¸ããã
zsh ã«ã¯ããã©ã°ã使ã£ãå¤æ°å±éã¨ããæ©è½ãããã¾ãã
ã¨ã¦ã便å©ãªæ©è½ãªã®ã§ããããããã°ããã®ãé常ã«å¤§å¤ã§ãã
è¦æ
£ãã¦ãªã人ã ã¨ãå ´åã«ãã£ã¦ã¯çºçãããã¾ããã
ããã§ä»åç´¹ä»ããã®ããå¤æ°å±éã® q ãã©ã°ã§ãã
å®éã«ä¾ãè¦ã¦ã¿ã¾ãããã
ä¾ãã°ã以ä¸ã®æ§ãªè¤æ°è¡ã®ã«ã³ã(,)åºåãã®ãã¼ã¿ãããã¨ãã¾ãã
$ data='1,2,3 a,b,c höge,fuga,piyo' $ echo "$data" 1,2,3 a,b,c höge,fuga,piyo
ãã®ãã¼ã¿ãæ¹è¡ã§åå²ãããã
â f ãã©ã°ã使ãã¨æ¹è¡ã§åå²ã§ãã¾ãã
$ echo "${(f)data}" 1,2,3 a,b,c höge,fuga,piyo
ããã§æ¹è¡ã§åå²ã§ãã¾ãããåºæ¥ã¦ãã¯ãã§ãã
â¦ã§ãããããæ¹è¡ã¯æ¶ãã¦ããã©ãã©ãã§åå²ããã¦ãã®ãåãããªãã§ãããã
ã§ã¯ãqãã©ã°ã使ã£ã¦ã¿ã¾ãã
$ echo "${(qqqf)data}" "1,2,3" "a,b,c" "höge,fuga,piyo"
åå²ãããé¨åãããã«ã³ã¼ãã¼ã·ã§ã³ã§å²ããã¦åããããããªã£ã¦ãã¾ããã
ããã q ãã©ã°ã§ãã
ããã«ã«ã³ãã§ãåå²ãããã
â j ãã©ã°(join)ã使ãã¨ãj:,: ã®ããã«æ¸ãã¦ãè¦ç´ ãã«ã³ã(,)ã§çµåã§ãã¾ã (ä»»æã®æåã§ãå¯)
â s ãã©ã°(split)㯠s:,: ã®ããã«æ¸ãã¦ãè¦ç´ ãã«ã³ã(,)ã§åå²ã§ãã¾ã (ä»»æã®æåã§ãå¯)
$ echo "${(j:,:s:,:qqq)${(f)data}}" "1" "2" "3" "a" "b" "c" "höge" "fuga" "piyo"
ãããã§ãããã
é常ã«åãããããã§ãããã
æå¾ã«å¿ç¨ç·¨ã§ãã
foræã§1åãã¤å¦çããããå ´åã
$ for val in "${(j:,:s:,:)${(f)data}}"; do echo "Hello $val san."; done Hello 1 san. Hello 2 san. Hello 3 san. Hello a san. Hello b san. Hello c san. Hello höge san. Hello fuga san. Hello piyo san.
è¡ãã¨ã« & ã«ã©ã ãã¨ã«å¥ã®å¦çããããã
i=0 for row in "${(f)data}"; do (( i++ )) echo -n "$i: " uppers=() for val in "${(s:,:)row}"; do uppers+=("${(U)val}") done echo "${(j:, :)uppers}" done # çµæ (è¡çªå·ãå ¥ãã¤ã¤ã大æåã«å¤æãã¦ã¿ã¾ãã) # 1: 1, 2, 3 # 2: A, B, C # 3: HÃGE, FUGA, PIYO
â» ä¸è¨ã®ä¾ã§ã¯ qqq ã使ç¨ãã¾ããããq ã®æ°ã«ãã£ã¦ä½¿ç¨ãããã³ã¼ãã¼ã·ã§ã³ãå¤ããã¾ãã
q ã1ã¤ã®å ´åã¯ããã¯ã¯ã©ã¼ã(`)ã2ã¤ã®å ´åã¯ã·ã³ã°ã«ã³ã¼ãã¼ã·ã§ã³(')ã3ã¤ã®å ´åã¯ããã«ã³ã¼ãã¼ã·ã§ã³()"ã4ã¤ã®å ´å㯠$' ' ã§ã¯ã©ã¼ãããã¾ãã
ãã®ããã« zsh ã¯ã¨ã¦ãé«æ©è½ã§ãã
å¤é¨ã³ãã³ãã使ããã¨ããã·ã§ã«ã®æ©è½ã ãã§ããã ãã®ãã¨ãåºæ¥ã¦ãã¾ãã¾ãã
ä»åç´¹ä»ãããã®ããã»ãã®ä¸é¨ã«ããã¾ããã
ã¿ãªããã対話ã·ã§ã« (Interactive shell) ã¨ãã¦ã ãã§ãªããã·ã§ã«ã¹ã¯ãªããã§ã zsh ã使ã£ã¦ã¿ã¦ã¯ãããã§ããããã
zsh ã«ã¤ãã¦ãã£ã¨è©³ããç¥ãããæ¹ã¯ã以ä¸ã®æ¸ç± "zshã®æ¬" ãè¶
ããããã§ãã
zsh ã§ã·ã§ã«ã¹ã¯ãªãããæ¸ããªãæ¹ã§ããzsh ã¦ã¼ã¶ãªã絶対ã«æã£ã¦ãããã1åã§ãã
zsh ã®ä»£åè©ã§ããè£å®é¢æ°ã«ã¤ãã¦ã詳ããæ¸ããã¦ãã¾ãã
zshã®æ¬ (ã¨ãã»ã³ã·ã£ã«ã½ããã¦ã§ã¢ã¬ã¤ãããã¯) åºç¬ éäº æè¡è©è«ç¤¾ 2009-06-17 売ãä¸ãã©ã³ãã³ã° : 231694
|
Vim Advent Calendar 2012 ã«"ã¯ã¦ãæ°"ã表示ãããã°ãªã¢ã³ã¨ããã¯ãã¼ã¯ã¬ãããä½ã£ããï¼
Vim Advent Calendar 2012 ã®197æ¥ç®ã®è¨äºã§ãã
åå(196æ¥ç®)ã®è¨äºã¯ @supermomonga ããã® homebrewを使ってちょっと新しめのMacVim KaoriYaを使おう - かなりすごいブログ ã§ããã
ã¾ããã
ã¤ãã«中間発表ãçµããå¾åæ¦ã¸ã¨çªå ¥ããVim Advent Calendar 2012
åå è ã90人ãè¶ãã200æ¥ç®ãç®åã¨ãªã£ã¦åãã¾ããã
ãããï¼ï¼
ãã¾ãã«ãè¨äºãå¤ããã¦ããã©ãããèªãã°ãããã ï¼ãã¨ããããããè¦éãã¦ããããï¼ãã¨ãããã ãç§ã®Vimåä½ããâ¦ããªã©ã¨ä¸å®ã«ãªã£ã¦ããæ¹ãããã®ã§ã¯ãªãã§ããããã
ããã§ããããªä¸å®ãå¹ãé£ã°ãããã
Advent Calendar ã®ãã¼ã¸ã«ã¯ã¦ãªããã¯ãã¼ã¯æ°ã表示ãã Greasemonkey (ã°ãªã¼ã¹ã¢ã³ãã¼) 㨠ããã¯ãã¼ã¯ã¬ãã ãä½ã£ã¦ã¿ã¾ããã
Greasemonkeyçã¨ããã¯ãã¼ã¯ã¬ããçã®2種é¡ãããã¾ãããã©ã³ãã³ã°è¡¨ç¤ºãè¡ããã®ã¯Greasemonkeyçã®ã¿ã§ãã
Greasemonkeyçã®ã¤ã³ã¹ãã¼ã«æ¹æ³
ã¾ãã¹ã¯ãªããã以ä¸ãããã¦ã³ãã¼ããã¦ä¸ããã
(Chromeã®å ´åã¦ã¼ã¶ã¹ã¯ãªããããã¦ã³ãã¼ãããã¨è¦åãåºã¾ããæ°ã«ããªãã§ãã ãã)
ç¶ãã¦åãã©ã¦ã¶ã«ã¹ã¯ãªãããã¤ã³ã¹ãã¼ã«ãã¾ãã
Chromeã®å ´å
ãã¦ã³ãã¼ãããã¹ã¯ãªãããæ¡å¼µæ©è½ã®ç®¡çãã¼ã¸(chrome://extensions/)ã«ãã©ãã°&ãããããã¦ä¸ããã
(é¢ä¿ãªããã©ãæ¡å¼µæ©è½ã®ç®¡çãã¼ã¸ãããã¯ãã¼ã¯ãã¼ã«è¿½å ãã¦ããã¨ããã«ã¢ã¯ã»ã¹ã§ããã®ã§ããããã§ãã)
FireFoxã®å ´å
FireFoxã®å ´åã¯ãGreasemonkeyã使ç¨ããããã«ä»¥ä¸ã®Add-On ãå¿
è¦ã«ãªãã¾ãã
ã¤ã³ã¹ãã¼ã«ãã¦ããªãæ¹ã¯ã¾ããã¡ããã¤ã³ã¹ãã¼ã«ãã¦ãã ããã
ããããããã¦ã³ãã¼ãããã¹ã¯ãªãããFireFoxã¸ãã©ãã°&ããããããGreasemonkeyã®ç®¡çç»é¢ã§æå¹åãè¡ãã¾ãã
ããã¯ãã¼ã¯ã¬ããçã®ã¤ã³ã¹ãã¼ã«æ¹æ³
以ä¸ã®ãªã³ã¯ãããã¯ãã¼ã¯ã«è¿½å ãã¦ãã ããã
ãããã¯ãã³ã¼ããã³ãã¼ãã¦æåã§æ°ããããã¯ãã¼ã¯ãä½æãã¦ä¸ããã
javascript:(function(){var s=document.createElement("script");s.charset="UTF-8";s.src="https://github.com/yonchu/atnd-hatena-bookmarks/raw/master/atnd-hatebu-min.user.js";document.body.appendChild(s)})();
ã¹ã¯ãªããããµã¼ãããèªã¿è¾¼ã¾ãªããã¼ã¸ã§ã³ãç¨æãã¾ããã
javascript:(function(){var t,e,n,r,a,i,o,d,l,c,u,m,f,h,p,s,y;try{if(top!==self){throw 0}}catch(b){i=b;return}t=function(t){var e,n;if(typeof GM_addStyle!=="undefined"&&GM_addStyle!==null){GM_addStyle(t);return}n=document.createElement("style");n.setAttribute("type","text/css");n.setAttribute("media","screen");n.appendChild(document.createTextNode(t));e=document.getElementsByTagName("head")[0];return e.appendChild(n)};r=function(){var t,e;t="http://b.st-hatena.com/entry/image/";e=document.createElement("img");e.className="hatebu";return function(n){var r;r=e.cloneNode();r.setAttribute("src",t+n);return r}}();a=".hatebu{padding-bottom: 2px !important; margin-left: 5px !important;}";t(a);u=document.querySelectorAll("#post-body table tr");for(f=0,p=u.length;f<p;f++){c=u[f];e=null;y=c.children;for(h=0,s=y.length;h<s;h++){l=y[h];n=l.firstChild;if(!n){continue}d=n.tagName;if(!(d&&d==="a"||d==="A")){continue}e=n;break}if(!e){continue}m=e.href;if(!m){continue}o=r(m);l.appendChild(o)}})();
ã¤ã³ã¹ãã¼ã«ä½æ¥ã¯ããã ãã§ãã
ãã¨ã¯ Vim Advent Calendar 2012 ã®ãã¼ã¸ãéãã
Greasemonkeyçãªãä½ãããªã¦ãããããã¯ãã¼ã¯ã¬ããçãªãããã¯ãã¼ã¯ã¬ãããå®è¡ããã°ãããã¯ãã¼ã¯æ°ã表示ããã¾ãã
ã©ã³ãã³ã°è¡¨ç¤ºã¯è¥å¹²æéããããã¾ãã
(ã©ã³ãã³ã°ã®åä¸é ä½ãèæ
®ãã¦ãªãã®ã§ããã¯å¤ãã«è¦ã¦ã»ããã)
ã¡ãªã¿ã«ãATNDã®ä»ã®ã¤ãã³ããã¼ã¸ã§ã Vim Advent Calendar ã¨åããããªãã¼ãã«ã¬ã¤ã¢ã¦ãã使ç¨ãã¦ããå ´åã¯ããã¯ãã¼ã¯æ°ã表示ãããã¨ãã§ãã¾ãã
Vimmer以å¤ã®æ¹ãã¤ã³ã¹ãã¼ã«ãã¦ããã°å¹¸ãã«ãªããããããã¾ããã
â» åä½ç¢ºèªã¯ãChrome/FireFox/Safari ã«ã¦è¡ãã¾ãããIEã¯ç¥ãã¾ããã
注æ
ããã¯ãã¼ã¯ã¬ããçã§ã¯ãä¸é¨ã®è¨äºã§ãã¯ãæ°ãæ£å¸¸ã«è¡¨ç¤ºããã¾ããã
è¨äºå·çå¾ã« "ã¯ã¦ãªãã¤ã¤ãªã¼" ãã "ã¯ã¦ãªããã°" ã¸ç§»è¡ããããVACã®URLãã¯ã¦ãªãã¤ã¤ãªã¼ã®ã¾ã¾ã«ãªã£ã¦ããããã¨æããã¾ããã¯ã¦ãªããã¯ãã¼ã¯ã®APIã¯ãªãã¤ã¬ã¯ãã«å¯¾å¿ãã¦ããªãããã§ãã
Greasemonkeyçã§ã¯ãªãã¤ã¬ã¯ãã®è§£æ±ºãèªèº«ã§è¡ããã対å¿ãã¦ãã¾ãã
ã¤ã³ã¹ãã¼ã«ãé¢åã§ãªããã°Greasemonkeyçãã使ãä¸ããã
æè¡çãªè©±
ã½ã¼ã¹ã³ã¼ãã¯ä»¥ä¸ã«ã¦å
¬éãã¦ãã¾ãã
ä¸å
·åå ±åãªã©ããã¾ããããããããé¡ããã¾ãã
å¶ä½æéã¯ãããã¯ãã¼ã¯ã¬ããçã ç´15åã
Greasemonkeyçã¯3æéãããã(ãªãã¤ã¬ã¯ãé¢é£ã§çµæ§æ©ã¿ã¾ãã)
JavaScript 㯠CoffeeScript ã§æ¸ãã¦ãã¾ãã
Greasemonkeyã¯ã²ãªå½¢ãç¨æãã¦ãããã¨ã§ãæ¯è¼ççæéã§ä½æãããã¨ãã§ãã¾ãã
Chrome Extension ãªããããç°¡åã«ä½ããã®ã§ããããã§ãã
ããããæ¬ ç¹ã¨ãã¦Greasemonkeyã¯èªåæ´æ°ãè¡ãã¾ããããã®ç¸ãã¯çµæ§ã¤ããã§ãã
幸ãGreasemonkeyãChromeæ¡å¼µã«å¤æ´ããã®ã¯é常ã«ç°¡åãªã®ã§ãä»åã®Greasemonkeyããããéè¦ããããããªãChromeæ¡å¼µçãç¨æããããã¨æãã¾ãã
ããã¯ãã¼ã¯ã¬ããçã¯ããããããGreasmonkeyçãä½ããåä½ç¢ºèªãè¡ãªã£ã¦ãããã¨ã§ãã¹ã ã¼ãºã«ä½æãããã¨ãã§ãã¾ãã
ãµã¼ãèªã¿è¾¼ã¿ãã¼ã¸ã§ã³ã¯ããµã¼ãä¸ã®Greasemonkeyãèªã¿è¾¼ãã§ããã ãã§ãã
éãµã¼ãèªã¿è¾¼ã¿ãã¼ã¸ã§ã³ã¯ãGreasemonkeyãUglifyJSã使ã£ã¦Minify(å§ç¸®)ããã ãã§ãã
ç°¡åã§ããã
Vimã¯é¢ä¿ããã¾ããããæãã¤ããã¡ãã£ã¨ããã¢ã¤ãã£ã¢ãããã«å½¢ã«ã§ããããã
ã¿ãªããã Greasemonkey 㨠ããã¯ãã¼ã¯ã¬ãã ã®ã²ãªå½¢ãç¨æãã¦ã¯ãããã§ããããã
以ä¸ã
Vim Advent Calendar 2012 197æ¥ç®ã®è¨äºã§ããã
(Vim script ã1è¡ãåºã¦ããªãã¦ããããªããã)
ææ¥ 198æ¥ç®ã¯ã @deris0126 ããã§ãã
vimã® "set guifont" ã«è¨å®ãããã©ã³ãåã«ã¤ã㦠(Macéå®)
"set guifont" ã«è¨å®ãããã©ã³ãåã«ã¯ä½ãæå®ããã°ããã®ãã¨ãã話ã
ããå¿ããã®ã§ã¡ã¢ã£ã¨ãããã ãã¿ã¤ãã«ã®éãMacéå®ã§ãã
æé
ã¾ãã"Font Book" ã¨ããã¢ããªã±ã¼ã·ã§ã³ãèµ·åãã¾ãã
ç¶ãã¦ãã¡ãã¥ã¼ã® [ãã¬ãã¥ã¼] ãã [ãã©ã³ãæ
å ±ã表示] ãå®è¡ãã¾ãã
(è±èªè¡¨è¨ã 㨠[Show Font Info] )
ããã¦ã使ç¨ãããã©ã³ããé¸æããã¨ä»¥ä¸ã®ããã«è¡¨ç¤ºããã¾ãã
ãã®ä¸ã®å³ã¦ã£ã³ãã¦ã«è¡¨ç¤ºããã¦ãã "PostScript name" ã "set guifont" ã«æå®ããååã«ãªãã¾ãã
ãã£ã¦ãã®å ´åã¯ã以ä¸ã®ããã«è¨å®ãã¾ãã
set guifont=Ricty-RegularForPowerline:h14
"h14" ã¯ãã©ã³ããµã¤ãºã§ãã
ã¾ããååã«ã¹ãã¼ã¹ãå«ã¾ãã¦ããå ´åã¯ã"Â¥ " ã®ããã«ã¨ã¹ã±ã¼ããã¦ãããå¿ è¦ãããã¾ãã