Emacs弹丸在一个项目中有多个repos(git / svn等)

时间:2014-04-22 05:32:45

标签: git emacs projectile

我有一个git repo,其目录结构如下所示:

root ---------- src
        |
        |
        |------ 3rd

root是我的工作目录,3rd由多个第三方git子模块组成。
projectile-find-file只能找到src中的文件,但它不适用于子模块。

3 个答案:

答案 0 :(得分:6)

projectile-git-command使用git ls-files列出属于该项目的文件,
所以我用以下代码解决了这个问题:

(setq projectile-git-command "git-ls-all-files")

git-ls-all-files是一个shell脚本:

\#!/bin/zsh
files=`git ls-files -co --exclude-standard`
sb_files=`git --no-pager submodule --quiet foreach 'git ls-files --full-name -co --exclude-standard | sed s!^!$path/!'`
all_files=$files$sb_files

echo $all_files

答案 1 :(得分:5)

我遇到了一个同样的问题,我通过在我的.projectile目录中添加一个空的root文件来修复它,这告诉了这个目录是真正的项目根目录并搜索所有文件当你想要找到某些东西时,它的子目录。

有关详细信息,请参阅here

答案 2 :(得分:0)

除了Mike的解决方案之外,我还向每个子模块添加了一个.projectile文件,该子模块将成为Emacs中的新项目。

相关问题