10

I use Kubuntu LTS as my OS. How to use ctags in Kate?

I selected ctags in the plugin manager window, so that now, by right clicking on any word of my code few ctags options appear. Namely: "go to declaration", "go to definition", "look up". But choosing one of these options nothing happens.

I think I did something wrong in the configuration: what should I write in the "ctags database" and in the "index targets" boxes?

2 Answers 2

6

Once you have CTags installed

sudo apt-get install exuberant-ctags

Activate the plugin by going to Settings -> Configure Kate...

Then when the window pops up, click Application -> Plugins and check "CTags"

screenshot of kate plugins

Next in Kate's Index Targets tab pane, click Add and enter the /path/to/project/root, then click Update Index

screenshot of "Index Targets" pane

Now you will be able to use the CTags.


Notice the Database tab pane is where you can set the CTags command. See the man pages for options. Generally, I like to exclude my dependency package folders by adding:

--exclude=vendor --exclude=node_modules

No need to put anything in the "CTags Database File" field because Kate will automatically generate this file when you click Update Index

screenshot database tab pane


Note that you can, but do not need to create a .kateproject file to use the CTags.

1
  • Instead of exuberant-ctags now use sudo apt install universal-ctags. Also don't overlook option --options. Command ctags --options=~/ctags.options.sh make things much easier when you try to pass 20+ options.
    – sumid
    Mar 10, 2021 at 18:37
4

First you need to make sure you have ctags installed:

sudo apt-get install exuberant-ctags 

Create a ".kateproject" project file in the folder where your code is (see http://forum.kde.org/viewtopic.php?f=25&t=93570 for more info):

e.g. This the contents of one I set up recently:

{
  "name": "Report Downloader"
, "files": [ { "directory": ".",
      "filters": [
    "*.php",
    "*.css", 
    "*.js", 
    "*.html"
    "*.py"
      ], 
    "recursive": 1 } 
  ]
}

Then open a file within the project (you don't open the project directly) and ctags should start working.

1
  • 1
    The .kateproject file is no longer needed with the current version of Kate in the trusted Ubuntu repo. Jun 19, 2016 at 2:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .