![]() | 1 SErHo 2012-10-14 20:44:05 +08:00 在 zsh 里直接使用 hash -d xxx=xxx 就行了,没有这么麻烦。如果真要写一个,可以考虑使用 Python 或者 perl,Linux 发行版里面基本上自带这俩。 |
![]() | 2 cabbala 2012-10-14 20:45:22 +08:00 这个写个bash脚本就好了,而且有现成的。 我在zsh下用https://github.com/sjl/z-zsh,不用自己去累死累活的手动添加bookmark,会自动计算目录的频率,然后跳转过去 # USE: # * z foo # goes to most frecent dir matching foo # * z foo bar # goes to most frecent dir matching foo and bar # * z -r foo # goes to highest ranked dir matching foo # * z -t foo # goes to most recently accessed dir matching foo # * z -l foo # list all dirs matching foo (by frecency) |
![]() | 4 loading 2012-10-14 20:49:30 +08:00 alias cdn="cd /bla/bla" 当然,zsh就不说了。 |
![]() | 5 jiyinyiyong OP @cabbala autojump 我在用.. 真心感慨这都是 cd 命令缺失的功能啊 |
![]() | 6 jiyinyiyong OP @SErHo 本来的考虑 Python, 但是最初卡在 Bash 上, 我 py 不熟, 就先用 Node 尝试可行性了. 毕竟 Bash 和 Python 脚本还是分开的, 服务器上不熟也不会很方便... 不会写 C 的菜鸟也只能到这种程度了.. |
![]() | 7 jiyinyiyong OP "服务器上不熟也不会很方便" -> "服务器部署不方便" |
![]() | 8 reus 2012-10-14 21:11:16 +08:00 |
![]() | 9 duhastmich 2012-10-14 21:40:23 +08:00 补充个bashmark,其实用了tmuxinator之后,就抛弃了这类东西 |
![]() | 10 yetone 2012-10-14 22:38:20 +08:00 alias 难道满足不了楼主吗? |
![]() | 11 cabbala 2012-10-14 22:40:35 +08:00 @jiyinyiyong 你这个用shell脚本改写也是很容易的,没必要用Python Node.js之类。。 |
![]() | 12 jiyinyiyong OP @duhastmich 赞 bashmark, 如果早知道的话我就不用手写了, 反而习惯冲突了 话说 tmuxinator 看了下是管理 Ruby 项目的.. 也有这方面功能? |
![]() | 13 jiyinyiyong OP @yetone 写 alias 就想写网站手写 html. |
![]() | 14 jiyinyiyong OP @cabbala bashmark? 对的.. 不过我实力差好多.. 呵呵 |
![]() | 15 lyxint 2012-10-15 02:00:09 +08:00 bash有dirs pushd popd |
![]() | 16 chone 2012-10-15 06:10:42 +08:00 使用频率很高的用ln弄个链接不就行了吗。。使用频率还要更高的估计早就已经写好脚本来跑了。不过这些都是个人喜好,自己觉得爽就好了。 另外我确实是手写html的,css,js也是手写的。 |
![]() | 18 jiyinyiyong OP |
![]() | 19 sectic 2012-10-15 08:28:03 +08:00 cd - |
![]() | 20 sectic 2012-10-15 08:30:56 +08:00 cd - ,就是简化的push和pop,要是还不顺手ls就去装 , Oh-My-Zsh,那里的123456789绑定你会喜欢的 |
![]() | 21 humiaozuzu 2012-10-15 10:12:07 +08:00 同用z brew install z 然后解决所有问题了! |
![]() | 22 jiyinyiyong OP @humiaozuzu z 不就 autojump 一样么.. |
23 coderoar 2012-10-15 14:39:25 +08:00 在inputrc添加一行: # history search "\C-o": history-search-backward "\C-j": history-search-forward 这样输入“cd xxx”后就能按快捷键搜索命令历史。 |
![]() | 25 jiyinyiyong OP |
![]() | 26 ekayxu 2012-10-15 15:25:49 +08:00 ![]() bashmarks https://github.com/huyng/bashmarks |
27 zhanglistar 2012-10-19 15:18:10 +08:00 bash里alias搞定直接进入目录的需要。 function cd1() { if [ -n $1 ]; then cd $1 && ls else cd && ls fi } alias cd='cd1' 进入目录自动显示。也是ok的。 |
![]() | 28 jiyinyiyong OP 现在回头看有了 Bashmarks 真的轻松多了, 感谢诸位 https://github.com/coffee-js/languages/issues/53 |