V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
cloud0001
V2EX  ›  程序员

分享一个小工具 tmax ,命令行重度用户的福音

  •  
  •   cloud0001 · 2021-04-19 14:24:10 +08:00 · 1798 次点击
    这是一个创建于 1074 天前的主题,其中的信息可能已经有所发展或是发生改变。
    tmax is a tool to help you call your cmd quickly, especially long cmd. If you frequently deal with the terminal daily, tmax will greatly improve your work efficiency.

    Project link: https://github.com/hantmac/tmax

    In addition,I am new to opensource and I really need advices and feedbacks from you guys! Feel free to post a question or PM me if you get in trouble when trying the project. Criticism is always welcome, too.
    11 条回复    2021-04-20 17:17:27 +08:00
    leavic
        1
    leavic  
       2021-04-19 14:28:14 +08:00   ❤️ 1
    请问一下啊,这 tm(讲文明划掉)和 alias 有什么区别?
    AoEiuV020
        2
    AoEiuV020  
       2021-04-19 14:29:59 +08:00
    长命令确实记不住的话还是习惯复制粘贴,工具一般不够智能,怕跑错命令,alias 类的又不够灵活,
    knightdf
        3
    knightdf  
       2021-04-19 14:34:14 +08:00
    fish/zsh 的 autosuggestions 了解一下
    cloud0001
        4
    cloud0001  
    OP
       2021-04-19 14:54:09 +08:00
    @leavic 😂,tmax 有几个有点:
    1. 用的时候能快速呼出,呼出的速度和体验比单纯的 alias 要好;
    2. 配置移动方便;
    3. tmax 配置文件可读性比较好,管理方便;
    4. 能扩展命令,支持位置参数
    cloud0001
        5
    cloud0001  
    OP
       2021-04-19 14:55:36 +08:00
    @AoEiuV020 其实这个工具还可以帮你快速查询,查完后再手动输入,或者拷贝什么的
    css3
        6
    css3  
       2021-04-20 09:20:16 +08:00
    ctrl +r 就行了,原生的东西不用安装
    lanlanye
        7
    lanlanye  
       2021-04-20 09:31:24 +08:00
    标准的 Ctrl+R,好用的加一个 fzf,经常打错命令的装一个 thefuck
    bung
        8
    bung  
       2021-04-20 13:20:42 +08:00
    cloud0001
        9
    cloud0001  
    OP
       2021-04-20 13:35:54 +08:00
    @bung Thanks,这个看起来好棒
    ruidoBlanco
        10
    ruidoBlanco  
       2021-04-20 17:06:49 +08:00
    解决这问题的成熟方法实在是太多了。

    1. alias
    2. shell history completion, 比如 .inputrc 里把 history-search-backward 帮到 ctrl-p 就可以打几个字母然后按 ctrl-p 从历史记录里补全
    3. zsh 的 autosuggestion 插件
    4. fzf 的 zsh plugin,ctrl-r 直接模糊查找

    相信类似的还有好多。上面的 navi,其实我都觉得不如 fzf 。

    不是要故意打击人,但是如果不调查下其他的方案,很多时候忙活了半天最后也是白干。

    Those who don't understand Unix are condemned to reinvent it, poorly.
    Henry Spencer, in Introducing Regular Expressions (2012) by Michael Fitzgerald
    cloud0001
        11
    cloud0001  
    OP
       2021-04-20 17:17:27 +08:00
    @ruidoBlanco 学到了很多,感谢。
    当初只是觉得很多长命令记不住,那时候正好又在做容器迁移的项目,天天用一些 kubectl 的长命令,就想到了这个需求,也没调研很多,直接自己开干了😹
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   948 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:57 · PVG 04:57 · LAX 13:57 · JFK 16:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.