V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
Vindroid
V2EX  ›  Linux

Linux 下有什么免费的代码搜索工具或轻量级 IDE?

  •  
  •   Vindroid · 2 天前 · 3507 次点击

    在做 Chromium 的二次开发,linux 上有能项目内全局搜索的关键词的软件吗?要类似这种在线搜索的 https://chromium.googlesource.com/

    46 条回复    2025-05-10 18:05:18 +08:00
    qping
        1
    qping  
       2 天前
    如果不是跨多个项目的话,是不是 IDE 应该有的功能?
    Immortal
        2
    Immortal  
       2 天前
    常用编辑器都是跨平台的
    zhanying
        3
    zhanying  
       2 天前
    vscode 不就挺好的。。。
    BG7ZAG
        4
    BG7ZAG  
       2 天前
    不装插件的 vscode
    everyx
        5
    everyx  
       2 天前
    Zed
    syam
        6
    syam  
       2 天前
    个人觉得安装一个命令 ack 效果还可以 找文件可以搭配 fzf
    不见得非要用 IDE 你的项目太大了 打算都放上去么
    Alias4ck
        7
    Alias4ck  
       2 天前
    代码搜索? 自带的 grep 就满足 搭配 fzf 模糊搜索

    这种 monorepo 用 fd+grep+fzf 基本都能搜到 grep 也可以换成 ripgrep
    Vindroid
        8
    Vindroid  
    OP
       2 天前
    @qping 大多数 IDE 都太占内存了,电脑配置原因没法用太吃内存的软件。我记得好多年前有用过一款很阳春的代码搜索,界面很古老,搜索很快,还不太占内存,可惜忘记名字了
    Vindroid
        9
    Vindroid  
    OP
       2 天前
    @syam 项目太大了,50G+的源码量,我还要全局搜索,想要个类似 FileLocator 的就够了
    CinHaiZio
        10
    CinHaiZio  
       2 天前
    问问天天 neovim 开发的老哥怎么折腾的, 说是直接配置好就行
    qping
        11
    qping  
       2 天前 via iPhone
    @Vindroid 老哥,换台电脑对自己好一点,电脑就是我们的生产工具,搞个 128g 也不是特别贵
    ETiV
        12
    ETiV  
       2 天前 via iPhone
    CLion 非商用免费了
    cs4forever
        13
    cs4forever  
       2 天前
    @ETiV JETBRAINS 公司怎么判断是否商用啊
    toy007
        14
    toy007  
       2 天前
    “全局搜索”“在线” => sourcegraph ?
    hwdq0012
        15
    hwdq0012  
       2 天前
    vim + vimgrep
    lancelock
        16
    lancelock  
       2 天前
    就命令行吧,不行试试 neovim zed 这些
    wfhtqp
        17
    wfhtqp  
       2 天前
    lazyvim
    weixiangzhe
        18
    weixiangzhe  
       2 天前
    ripgrep + fzf 完全够用了吧
    fsdrw08
        19
    fsdrw08  
       2 天前 via Android
    50g 的代码量本身就不适合放本地做搜索,老老实实放 git 服务器查吧
    yplam
        20
    yplam  
       2 天前
    Chromium 建议还是直接用 Google 的在线代码搜索,他们搭这个站就是因为这个用途
    lululau
        21
    lululau  
       2 天前
    grep, ack, ag, ripgrep, ast-grep, semigrep, gritql 哪个不够你使的
    GiantHard
        22
    GiantHard  
       2 天前   ❤️ 1
    astgrep 很不错,用来查找声明或者使用会比较方便 https://ast-grep.github.io/guide/quick-start.html
    janus77
        23
    janus77  
       2 天前
    50G 代码的项目都不愿意配个好点的开发机吗
    Jinnrry
        24
    Jinnrry  
       2 天前
    50G 的源码量,最少 256G 内存起步吧,构建索引存到内存后 256G 都不一定放得下
    Noicdi
        25
    Noicdi  
       2 天前 via iPhone
    vscode 的搜索使用 ripgrep ,不知道对你合不合适
    DaneWalters
        26
    DaneWalters  
       2 天前
    ETiV
        27
    ETiV  
       2 天前 via iPhone
    @cs4forever 盲猜是通过 IP 地址
    见到过那种查询 IP 地址是什么公司的 API 服务
    cs4forever
        28
    cs4forever  
       2 天前
    @ETiV 好的 感谢 这样不用自己破解了
    csfreshman
        29
    csfreshman  
       2 天前
    @Vindroid #8 souceinsight
    kite12580
        30
    kite12580  
       2 天前
    普通情况搜索代码可以试试 https://github.com/boyter/cs 。regex 那种一次性的搜索就用 ripgrep ,至于 vimgrep ,ack 这些就别试了,性能远不如 ripgrep 。ast grep 的话重构会比较好用

    但是! chromium 项目非常复杂,如果电脑配置不好建议不要全局本地搜索,这种东西一般得先索引的。

    话说配置不好你怎么编译 chromium 啊?
    passive
        31
    passive  
       2 天前 via Android
    我在用 ctags ,可能已经过时了。
    Vindroid
        32
    Vindroid  
    OP
       2 天前
    @csfreshman 对!就是这个,谢谢
    clino
        33
    clino  
       2 天前   ❤️ 1
    大型代码的代码搜索可以考虑 opengrok ,但是折腾这个有点麻烦
    clino
        34
    clino  
       2 天前
    还有一个可能和 opengrok 类似功能的: https://github.com/sourcebot-dev/sourcebot
    WispZhan
        35
    WispZhan  
       2 天前
    souceinsight 和 Understand code
    Vindroid
        36
    Vindroid  
    OP
       2 天前
    @kite12580 编译对于硬件配置要求不高,多花时间呗,i5-10600k+32g 完整编译一次 8 个小时左右,还是虚拟机环境,不过最近完整编译很容易中途爆内存
    luny
        37
    luny  
       2 天前
    grep -rn --include='*.c' --include='*.h' ''
    速度挺快的
    xiayun
        38
    xiayun  
       2 天前
    linux ?纯命令行? vim 吧
    nmap
        39
    nmap  
       2 天前
    rg 还不够你用吗?没有更快的了
    hwdq0012
        40
    hwdq0012  
       2 天前
    不过官方方推荐的方式是 clangd 吧, 我在 mac 上用 vs code + clangd , 官方那个脚本配置一下,符号跳转很快速啊,linux 不能安装 vs code 吗
    qxdo1234
        41
    qxdo1234  
       2 天前
    linux 不应该用 find 吗?我刚找了个工作,老板查代码,就用 find 。
    fuckfaker
        42
    fuckfaker  
       2 天前
    grep -iIrn --include="*.c" "xxxx"
    grep -iIrn --exclude="*.c" "xxxx"
    kirara2024
        43
    kirara2024  
       2 天前
    xlivesearch() {
    rg --line-number --no-heading --color=always --smart-case \
    -g '!go/' \
    -g '!.git/' \
    -g '!test{,-*}/**' \
    -g '!.*/*' \
    "$*" |
    fzf --ansi \
    --color "hl:-1:underline,hl+:-1:underline:reverse" \
    --delimiter : \
    --preview 'bat --color=always --highlight-line {2} {1}' \
    --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \
    --bind 'enter:execute(vim {1} +{2}),ctrl-v:execute(code -g {1}:{2})'
    beyondstars
        44
    beyondstars  
       1 天前
    我要搜什么一般都直接用 `egrep -e 'pattern' -r ./src` 类似这样
    yuancoder
        45
    yuancoder  
       1 天前
    如果用 vim , 可以试试 any-jump.vim 插件, 可以根据不同的语言搜索关键字
    yc8332
        46
    yc8332  
       1 天前
    The Silver Searcher
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1087 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 23:18 · PVG 07:18 · LAX 16:18 · JFK 19:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.