我有一个单一的git仓库,其目录结构如下:
root ---------- src
|
|
|------ 3rd
root
是我的工作目录,3rd
包含多个第三方 Git 子模块。
projectile-find-file
只能在 src
中查找文件,它不能用于子模块。
我有一个单一的git仓库,其目录结构如下:
root ---------- src
|
|
|------ 3rd
root
是我的工作目录,3rd
包含多个第三方 Git 子模块。
projectile-find-file
只能在 src
中查找文件,它不能用于子模块。
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
.projectile
文件来解决它,这告诉 projectile 那个目录是真正的项目根目录,并且在查找文件时搜索它的子目录中的所有文件。.projectile
文件,这样这个子模块就会成为Emacs中的一个新项目。