Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vim 如何排除包含大量CTAG的多个目录?_Vim_Ctags_Exuberant Ctags - Fatal编程技术网

Vim 如何排除包含大量CTAG的多个目录?

Vim 如何排除包含大量CTAG的多个目录?,vim,ctags,exuberant-ctags,Vim,Ctags,Exuberant Ctags,我一直在寻找并尝试使用繁盛的CTAG,但我想做的事情却没有成功。我在Mac上尝试在一个项目中工作,我想排除.git、node_modules、test等目录。当我尝试类似ctags-R--exclude=[.git、node_modules、test]的内容时,我没有得到任何回报。我真的只需要让它运行在我的核心目录。关于如何实现这一点,您有什么想法吗?--exclude选项不需要文件列表。根据ctags的手册页,“可以根据需要多次指定此选项。”因此,如下所示: ctags-R--exclude=

我一直在寻找并尝试使用繁盛的CTAG,但我想做的事情却没有成功。我在Mac上尝试在一个项目中工作,我想排除.git、node_modules、test等目录。当我尝试类似
ctags-R--exclude=[.git、node_modules、test]
的内容时,我没有得到任何回报。我真的只需要让它运行在我的核心目录。关于如何实现这一点,您有什么想法吗?

--exclude
选项不需要文件列表。根据
ctags
的手册页,“可以根据需要多次指定此选项。”因此,如下所示:


ctags-R--exclude=.git--exclude=node_modules--exclude=test
ReadTheFantasticManualal应该始终是解决问题的第一步

$man ctags

--exclude=[pattern]
  Add  pattern to a list of excluded files and directories. This option may
  be specified as many times as desired. For each file name  considered  by
  both the complete path (e.g. some/path/base.ext) and the base name  (e.g.
  base.ext)  of  the  file, thus allowing patterns which match a given file
  name irrespective of its path, or match only a specific path.  If  appro-
  priate  support is available from the runtime library of your C compiler,
  then pattern may contain the usual shell wildcards (not  regular  expres-
  sions)  common  on Unix (be sure to quote the option parameter to protect
  the wildcards from being expanded by the shell  before  being  passed  to
  ctags;  also be aware that wildcards can match the slash character, '/').
  You can determine if shell wildcards are available on  your  platform  by
  examining  the output of the --version option, which will include "+wild-
  cards" in the  compiled  feature  list;  otherwise,  pattern  is  matched
  against file names using a simple textual comparison.

  If  pattern begins with the character '@', then the rest of the string is
  interpreted as a file name from which to read exclusion patterns, one per
  line.  If  pattern  is  empty,  the list of excluded patterns is cleared.
  Note that at program startup, the default exclude list contains "EIFGEN",
  "SCCS",  "RCS", and "CVS", which are names of directories for which it is
  generally not desirable to descend while processing the --recurse option.
从开头的两句话中,你可以得到:

$ ctags -R --exclude=dir1 --exclude=dir2 --exclude=dir3 .
这可能有点冗长,但这就是别名和映射等的用途。作为替代方案,您可以从第二段中得到:

$ ctags -R --exclude=@.ctagsignore .
.ctagsgignore
中使用以下命令:

dir1
dir2
dir3

这可以在不需要太多键入的情况下排除这3个目录。

您可以用大括号封装一个逗号分隔的列表,以便用一个
--exclude
选项处理多个目录:

ctags -R --exclude={folder1,folder2,folder3}

这似乎仅适用于发出命令的根目录中的文件夹。排除嵌套文件夹需要一个单独的
--exclude
选项。

其他答案直截了当,我想举个小例子可能会有所帮助:

您应该添加类似于unix的星号样式以排除整个目录

ctags -R --exclude={.git/*,.env/*,.idea/*} ./

我真的只需要让它运行在我的核心目录

ctags -R --exclude={.git/*,.env/*,.idea/*} ./


只需删除-R(递归)标志

好的,这部分起作用了。所以我不必再问另一个问题,也不必给你这个问题的答案——有没有一种方法可以只包含一个目录而不必进行排除?我只需要我的核心目录我想你可以简单地命名你想要的目录,不是吗?像
ctags-R你的目录
。或者我不明白你的意思。是的,当我尝试这个时,它不会标记核心目录中的任何内容:-(你也可以
cd
运行
ctags-R
@pertrai1首先列出你想要标记的文件,然后只在这个列表上运行ctags:
find-name-your files-o-path-your path>list.txt;ctags-L list.txt
Hmmm。这是一个简单的答案,但我猜这会让我变成一个坏人,因为我应该用RTFM'ed而不是com点击这里!我最喜欢的RTFM方式是用谷歌搜索,希望有人能为我解释一下TFM。谢谢!我意识到这是一个旧的线程和答案,但是
@
--exclude=@.ignorefiles
不起作用(实际上,它起作用了,请参见我的编辑)编辑:经典的橡皮鸭解决方案…确保忽略文件没有以
/
结尾的目录谢谢你的回答。我知道事情已经改变了,现在更有效的方法是在线快速搜索特定的解决方案,如果你没有找到,再进行RTFM。漂亮地使用shell brace扩展!可能重复假设核心目录没有子目录是什么意思?