为特定目录中除其子目录之外的所有C ++文件生成一个标签文件 [英] Generate a tags file for all C++ files in specific directory except on its subdirectories
问题描述
当您在 Windows 上的 \Downloads 文件夹中提取了Exuberant Ctags的ctags58.zip归档文件,此命令到您的 vimrc 文件:
When you've extracted the "ctags58.zip" archive of Exuberant Ctags in your \Downloads folder on Windows and then add this command to your vimrc file:
let $ PATH。='; C:\Users\USR \Downloads\ctags58'
使用命令 :!创建文件夹后:mkdir C:\Users Vim (文本编辑器)中的\USR\vimfiles\tags
,为什么以下命令无法正常工作: / p>
And after creating folder using the command :!mkdir C:\Users\USR\vimfiles\tags
in Vim (text editor), why does the following commands below didn't work properly:
:!ctags --recurse=no --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ -f C:\Users\USR\vimfiles\tags\cpp C:\Users\USR\Projects\PROJ\include
和:
:!ctags --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ -f C:\Users\USR\vimfiles\tags\cpp C:\Users\USR\Projects\PROJ\include
这些命令只是生成一个标签文件,而不标记 \include 目录中的任何文件。这是他们的完整来源:
Those commands are just generating a tags file without tagging any files in the \include directory. This is their full source:
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.8 //
我想要的是为 \include 目录中的所有C ++文件生成一个标签文件,除了 \
What I want is to generate a tags file for all C++ files in the \include directory except on \include subdirectories. The command below is working but it's processing on all subdirectories:
:!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ -f C:\Users\USR\vimfiles\tags\cpp C:\Users\USR\Projects\PROJ\include
请注意,路径 C:\Users\USR\Projects\PROJ\include
已存在。
推荐答案
ctags的 - exclude
选项可用于排除名称与模式匹配或在文件中列出的文件。
The --exclude
option to ctags can be used to exclude files whose names match a pattern or which are listed in a file.
如果你不想看任何子目录,不要使用 -R
( --recurse
)选项。然后你必须列出要处理的文件(而不是包含它们的目录)。这很容易用通配符来完成:例如,处理当前目录中的所有文件, ctags *
。如果只想包含具有特定文件扩展名的文件,则应使用适当的通配符模式;例如,C ++文件的 *。cc
或 *。cxx
看起来你不是这样做,只是命名包含文件的目录。
If you do not want to look at any subdirectories at all, do not use the -R
(--recurse
) option. Then you have to list the files to be processed (not the directories containing them). This is easily done with wildcards: for example, to process all files in the current directory, ctags *
. If you only want to include files with a particular file extension, you should use an appropriate wildcard pattern; for example, *.cc
or *.cxx
for C++ files. It looks like you are not doing this and just naming the directory that contains the files.
这篇关于为特定目录中除其子目录之外的所有C ++文件生成一个标签文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!