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

给变量起名的事情上,为你生命省 3s

  •  
  •   easternslope · 2018-04-28 14:38:54 +08:00 · 10725 次点击
    这是一个创建于 2183 天前的主题,其中的信息可能已经有所发展或是发生改变。

    cerebro-codelf

    There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton

    给变量起名的事情上,为你生命省 3s

    Cerebro 变量名搜索插件,项目灵感来源 codelf。通过 Cerebro 的搜索窗口快速查找变量名。

    特性

    • 快速启动、搜索
    • 中英文搜索
    • 自由定制

    安装

    • 插件依赖于 Cerebro
    • Ctrl-Space 打开 Cerebro
    • 输入 plugins codelf,点击安装

    使用

    • Cerebro 中,输入 codelf + [待搜索的变量名]
    • 上下选择变量名,敲回车 Enter 复制到剪切板;

    LICENSE

    MIT

    欢迎 fork :fork_and_knife: 和 star :star:

    项目地址 https://github.com/carlos-wong/cerebro-codelf

    58 条回复    2018-04-30 22:30:48 +08:00
    robinchina
        1
    robinchina  
       2018-04-28 14:53:18 +08:00
    emmmm,不错
    geew
        2
    geew  
       2018-04-28 15:02:52 +08:00
    好东西 只有 mac 版么
    easternslope
        3
    easternslope  
    OP
       2018-04-28 15:05:16 +08:00
    geew
        4
    geew  
       2018-04-28 15:06:09 +08:00
    @easternslope #3 哇 没注意到 我试试 谢谢
    easternslope
        5
    easternslope  
    OP
       2018-04-28 15:08:29 +08:00
    @geew 就喜欢给别人安利东西,哈哈
    Cerebro 免费开源很强大,而且可以自己写插件
    odirus
        6
    odirus  
       2018-04-28 15:09:55 +08:00
    嗯嗯,稀饭
    odirus
        7
    odirus  
       2018-04-28 15:13:28 +08:00
    @easternslope #5 不够 win 下如何走代理,Google 访问不了,如果走全局的话不合适
    geew
        8
    geew  
       2018-04-28 15:14:47 +08:00
    @easternslope #5
    装上了没法用?
    easternslope
        9
    easternslope  
    OP
       2018-04-28 15:15:15 +08:00
    @odirus 不会吧? Github 被墙了?
    easternslope
        10
    easternslope  
    OP
       2018-04-28 15:16:06 +08:00
    @geew codelf 后面空格,然后输入 “你好世界” ,稍等一下,网络会比较慢
    geew
        11
    geew  
       2018-04-28 15:20:22 +08:00
    @easternslope #10 等了好久 都没有东西出来 我还把代理开了全局都不行哦
    easternslope
        12
    easternslope  
    OP
       2018-04-28 15:24:10 +08:00
    JustinL
        13
    JustinL  
       2018-04-28 15:27:13 +08:00 via Android
    和 wox 好像,不知道有何不同…
    easternslope
        14
    easternslope  
    OP
       2018-04-28 15:29:52 +08:00
    @JustinL Wox 不是跨平台的,我看好像只能在 Windows 下面用
    wangchonglie
        15
    wangchonglie  
       2018-04-28 15:44:44 +08:00
    安装 Cerebro 的过程中就失败了。。
    easternslope
        16
    easternslope  
    OP
       2018-04-28 15:49:37 +08:00
    @wangchonglie 下载 release 直接安装
    wangchonglie
        17
    wangchonglie  
       2018-04-28 15:53:10 +08:00
    @easternslope 通过官网成功安装了,然后遇到和 @geew 朋友一样的问题。
    easternslope
        18
    easternslope  
    OP
       2018-04-28 16:06:26 +08:00
    别慌 @wangchonglie @geew 容我看看 Windows 上面的问题
    netlxl
        19
    netlxl  
       2018-04-28 16:15:04 +08:00
    你们上面那个还能出来“ Search Web for codelf ”,我的输入后啥都没有
    easternslope
        20
    easternslope  
    OP
       2018-04-28 16:21:12 +08:00   ❤️ 1
    @wangchonglie @geew 搞定了,重新安装一下插件就好了
    netlxl
        21
    netlxl  
       2018-04-28 16:22:32 +08:00
    重启了一次后好了,不过搜索有点慢,并且没有 Java 的小驼峰命名。
    carloswong
        22
    carloswong  
       2018-04-28 16:27:33 +08:00
    @netlxl 这个插件的方式并不是自动生成命名,是通过有道翻译,接入 https://searchcode.com/ 进行搜索,并统计对应的变量或者函数名出现的次数进行排序。 所以总的来说并不是生成变量名,是帮你找一下大家针对这个名字都怎么起名字。目前是搜索所有语言,后续会增加根据语言进行过滤。
    wangchonglie
        23
    wangchonglie  
       2018-04-28 16:29:31 +08:00
    @easternslope 可以了,不够等待的时间略微有点长,但确实还是很好的功能,感谢。
    mjikop1231
        24
    mjikop1231  
       2018-04-28 16:33:06 +08:00 via iPhone
    x,xx,xxx,xxxx
    y,yy,yyy,yyyy
    t1,t2,t3,t4
    妈耶~~
    easternslope
        25
    easternslope  
    OP
       2018-04-28 16:40:45 +08:00
    哈哈,不客气,好用的话点个 Star @wangchonglie
    easternslope
        26
    easternslope  
    OP
       2018-04-28 16:44:08 +08:00
    @mjikop1231 这种命名应该就地正法
    wangchonglie
        27
    wangchonglie  
       2018-04-28 16:51:58 +08:00
    @easternslope 已点~
    easternslope
        28
    easternslope  
    OP
       2018-04-28 16:57:41 +08:00
    @wangchonglie 开心,感兴趣的话欢迎来 PR
    mseasons
        29
    mseasons  
       2018-04-28 17:38:56 +08:00
    输入你好世界,会有 world! 这种命名……
    easternslope
        30
    easternslope  
    OP
       2018-04-28 18:13:24 +08:00 via Android
    @mseasons 这个是从代码库搜出来的,可能是注视
    CloudnuY
        31
    CloudnuY  
       2018-04-28 18:19:38 +08:00
    话说 中文名都不好起……
    easternslope
        32
    easternslope  
    OP
       2018-04-28 18:24:07 +08:00
    @CloudnuY 哈哈,你这么说,可以改进的空间跟大啊
    GjriFeu
        33
    GjriFeu  
       2018-04-28 19:00:20 +08:00
    有点慢的说,等半天才想出了起什么名字
    murmur
        34
    murmur  
       2018-04-28 19:02:12 +08:00
    省 2 秒就够了 加个 feature 送虵 1 秒好么
    ebony0319
        35
    ebony0319  
       2018-04-28 19:02:33 +08:00 via Android
    刚需。
    chroming
        36
    chroming  
       2018-04-28 19:02:40 +08:00 via Android
    感谢分享,回去试试 cerebro
    easternslope
        37
    easternslope  
    OP
       2018-04-28 19:43:53 +08:00
    @chroming 哈哈,试了就回不去了
    easternslope
        38
    easternslope  
    OP
       2018-04-28 19:44:21 +08:00
    @GjriFeu 是有点,搜索引擎在外网,所以加载比较慢
    easternslope
        39
    easternslope  
    OP
       2018-04-28 20:10:02 +08:00
    @murmur 你太暴力了
    Suclogger
        40
    Suclogger  
       2018-04-28 20:33:27 +08:00
    有 alfred 的 workflow 吗
    easternslope
        41
    easternslope  
    OP
       2018-04-28 20:34:51 +08:00
    @Suclogger 哈哈,没有,你要不试试 Cerebro,自己写插件,想啥干啥
    sunnygaofan
        42
    sunnygaofan  
       2018-04-29 02:19:05 +08:00 via iPhone
    其实挺实用
    easternslope
        43
    easternslope  
    OP
       2018-04-29 10:11:08 +08:00
    @sunnygaofan 看到 x1, temp, a, b 这些玩意就想打人
    fhefh
        44
    fhefh  
       2018-04-29 10:51:16 +08:00
    @easternslope 楼主能不能提供一个 Alfred 的 workflow 版本~~ 嘿嘿~~~
    easternslope
        45
    easternslope  
    OP
       2018-04-29 11:00:23 +08:00
    @fhefh 哈哈哈,作者更喜欢开源软件,可以随便改
    eurokingbai2
        46
    eurokingbai2  
       2018-04-29 11:01:35 +08:00
    省了 3 秒,给谁续?
    easternslope
        47
    easternslope  
    OP
       2018-04-29 11:04:03 +08:00
    @eurokingbai2 终于有人关注到重点了
    standin000
        48
    standin000  
       2018-04-29 11:23:38 +08:00
    @easternslope 请问 cerebro 是跟 everything,listary 或者 Alfred2 类似的软件吗,感觉网上介绍很少
    easternslope
        49
    easternslope  
    OP
       2018-04-29 11:35:30 +08:00
    @standin000 是的,是一个比较小众的对话式启动软件,优点是写插件很方便,开源免费。如果你用 JavaScript 的话可以考虑试试,个人觉得很好用,可以将平时的机械性重复工作用插件完成,极大地提高工作效率。
    carloswong
        50
    carloswong  
       2018-04-29 11:53:10 +08:00   ❤️ 1
    @standin000 这类对话式的操作软件还是有不少项目的,但是跨平台,插件开发简单来说。我认为 cerebro 是比较出色的。一个能让自己任意修改的软件才是好软件是吧? :)
    yuhuan66666
        51
    yuhuan66666  
       2018-04-29 16:49:23 +08:00 via Android
    记得 IDEA 里有个翻译插件自动把中文翻译成英文的变量命名功能
    Messiv2
        52
    Messiv2  
       2018-04-29 17:11:06 +08:00
    @murmur
    @easternslope
    @eurokingbai2
    @easternslope
    五一还没到,你们这么着急吗
    easternslope
        53
    easternslope  
    OP
       2018-04-29 18:39:56 +08:00 via Android
    @Messiv2 啥情况🤔
    F0nebula
        54
    F0nebula  
       2018-04-29 19:26:01 +08:00
    @easternslope #53 枪毙名单了解一下
    standin000
        55
    standin000  
       2018-04-29 21:37:00 +08:00
    @easternslope 你的意思是 cerebro 插件只能用 javascript 写? cerebro 是对程序员有用,还是个效率工具
    carloswong
        56
    carloswong  
       2018-04-30 11:40:04 +08:00
    @standin000 我认为这是一个通用的效率工具,不同于菜单,UI 交互的工作方式。更接自然对话的交互方式。这是一个输入窗口,只要有足够多的插件,就可以说出你想要做的任何事,问出你想要问的任何问题。
    carloswong
        57
    carloswong  
       2018-04-30 12:49:26 +08:00
    版本已经更新,增加了正在搜索的提示。欢迎大家多多使用,多多提 issue
    easternslope
        58
    easternslope  
    OP
       2018-04-30 22:30:48 +08:00
    看来给变量取名真的是个痛点
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2992 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 11:09 · PVG 19:09 · LAX 04:09 · JFK 07:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.