2017-07-17 45 views
2

我想爲C和C++創建標記文件,排除/usr/include/python2.7中的所有文件,而/usr/include/*中的所有文件都不是由/usr/include/python2.7創建的標記。爲什麼不能在ctags命令中排除帶有exclude參數的文件?

ctags -R -I __THROW -I __attribute_pure__ -I __nonnull -I __attribute__ \ 
    --file-scope=yes --langmap=c:+.h --languages=c,c++ --links=yes --c-kinds=+p \ 
    --c++-kinds=+p --fields=+iaS --extra=+q \ 
    -f .vim/tags/c.tag /usr/include/* --exclude="/usr/include/python2.7" 

這是沒有用的,把它寫成

ctags -R -I __THROW -I __attribute_pure__ -I __nonnull -I __attribute__ \ 
    --file-scope=yes --langmap=c:+.h --languages=c,c++ --links=yes --c-kinds=+p \ 
    --c++-kinds=+p --fields=+iaS --extra=+q \ 
    -f .vim/tags/c.tag /usr/include/* --exclude=/usr/include/python2.7/* 

爲什麼還是有很多內容來形式/usr/include/python2.7?

grep "python*" /home/debian8/.vim/tags/c.tag 
ysize /usr/include/python2.7/Imaging.h /^ int xsize, ysize, xoff, yoff;$/;" m struct:ImagingCodecStateInstance access:public 
ysize /usr/include/python2.7/Imaging.h /^ int ysize;$/;" m struct:ImagingMemoryInstance access:public 
ystep /usr/include/python2.7/Imaging.h /^ int ystep;$/;" m struct:ImagingCodecStateInstance access:public 

回答

3

您正試圖在目標目錄後添加更多選項。這是行不通的。

這應該工作:

ctags -R -I __THROW -I __attribute_pure__ -I __nonnull -I __attribute__ \ 
    --file-scope=yes --langmap=c:+.h --languages=c,c++ --links=yes --c-kinds=+p \ 
    --c++-kinds=+p --fields=+iaS --extra=+q \ 
    -f .vim/tags/c.tag --exclude=python2.7 /usr/include 

這是你有三個不同使用相同的命令:

  1. 指定--exclude選項之前目標目錄索引。

  2. 指定沒有通配符的目標目錄(/usr/include),因爲ctags已知道要查看裏面的所有內容。

  3. 只需排除python2.7,因爲只需要該目錄名稱。如果它看到該目錄名稱,則不會進入該目錄並對其進行索引。這裏不需要完整路徑。

相關問題