Linux-Mint

用 exuberant-ctags 替換 ctags

  • September 24, 2020

我正在嘗試exuberant-ctags在 Linux Mint 上安裝該軟體包。為此,我跑了:

$ sudo apt-get install exuberant-ctags

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
 exuberant-ctags
0 upgraded, 1 newly installed, 0 to remove and 81 not upgraded.
Need to get 0 B/120 kB of archives.
After this operation, 334 kB of additional disk space will be used.
Selecting previously unselected package exuberant-ctags.
(Reading database ... 339129 files and directories currently installed.)
Preparing to unpack .../exuberant-ctags_1%3a5.9~svn20110310-7ubuntu0.1_amd64.deb ...
Unpacking exuberant-ctags (1:5.9~svn20110310-7ubuntu0.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up exuberant-ctags (1:5.9~svn20110310-7ubuntu0.1) ...
update-alternatives: using /usr/bin/ctags-exuberant to provide /usr/bin/ctags (ctags) in auto mode

最後一行建議ctags-exuberant使用 代替ctags

但是,當我重新啟動 bash 並執行時ctags -e,出現錯誤:

ctags: invalid option -- 'e'

雖然該-e選項在exuberant-ctags.

怎麼還沒exuberant-ctagsctags

$ command -v ctags

/usr/local/bin/ctags

這不是我想要的

$ ls -l /usr/bin/ctags

lrwxrwxrwx 1 root root 23 Dec 28  2015 /usr/bin/ctags -> /etc/alternatives/ctags
$ ls -l /etc/alternatives/ctags

lrwxrwxrwx 1 root root 24 Aug  9 21:22 /etc/alternatives/ctags -> /usr/bin/ctags-exuberant
$ ctags --version

ctags (GNU Emacs 24.5)
Copyright (C) 2015 Free Software Foundation, Inc.
This program is distributed under the terms in ETAGS.README

您的安裝可能只是exuberant-ctags作為替代選項添加。

/usr/bin/update-alternatives --display ctags

如果它指向錯誤的版本,您可以手動設置替代

sudo /usr/bin/update-alternatives --set ctags /usr/bin/ctags-exuberant

但是,在您的情況下(根據您的問題更新),在打包和版本之前ctags,您的 PATH ( /usr/local/bin/ctags)中有一個未打包的版本,因此首先呼叫它。ctags-exuberant``alternatives

您要麼需要刪除該版本,修改您的$PATH或添加符號連結到/usr/bin/ctags路徑中的較早版本(可能$HOME/bin),以便您執行您想要執行的版本。

引用自:https://unix.stackexchange.com/questions/302378