Search and Replace

T.C. Hollingsworth

Introduction

Kate's Search in Files plugin allows you to search for text or regular expressions in many different files at once. You can search all open files, or all the files in one directory, and optionally its subdirectories. You can even filter by filename, for instance searching only files that end with a particular file extension.

Interface

Search Query

The following options are always displayed at the top of the Search in Files tool view:

New Tab

You can have as many searches as you want open at the same time. Simply click the New Tab button at the top-left corner of the Search tool view and a new results tab will open permitting you to perform another search.

Query

The long text box at the top is where you type in what you want to find. You may enter standard text, or a regular expression if enabled.

Search

When you've finished configuring everything, just press the Search button to perform your search. You may also press Enter in the Query text box to do the same.

Location

This has two options. Select in Open Files to search all files currently open in Kate. Select in Folder to search inside a folder and optionally its subfolders.

Options

There are two available options. If enabled, Match case will restrict search results to only those that have the exact same combination of upper and lower-case letters as your search query. Regular expressions permits you to use regular expressions instead of simple text as your search query.

Toggle Results

The down arrow in the top right-corner of the Search in Files tool view will toggle the bottom half of the tool view between displaying additional options for the Search in Folder mode and the results of your search.

Search in Folder Options

These options are displayed below the aforementioned query options. If search results are being displayed instead, press the Toggle Results button to display them. These options apply only when Search in Folder mode is enabled. If Search in Open Files is selected, they will be disabled.

Folder

You may enter the path of the folder you wish to search. For instance, you might enter ~/development/kde/kate/ if you wished to search the Kate source code.

Open file dialog

Press this button to locate for the folder in your desktop's folder browser.

Up

Press this button to change Folder to the parent of the currently selected folder.

Restore Current Folder

This button will set the Folder entry to the folder in which the currently open document is located.

Filter

This permits you to only search filenames that match a particular pattern. For instance, to only search files written in C++, change it to *.cpp. To search only files beginning with kate, change it to kate*. You can enter multiple filters separated with a comma (,). To use this to exclude files from the search, append a minus sign (-) to the list.

Recursive

If this option is enabled, Kate will also search in all subfolders of the selected folder.

Include hidden

If this option is enabled, Kate will also search in files or folders that are typically hidden by your operating system.

Follow symbolic links

The Search in Files plugin typically doesn't follow symbolic links. When this option is enabled, the plugin will follow them instead and search inside the files or folders they reference.

Warning

It's possible for symbolic links to reference a folder that is the parent of the folder currently being searched, or other folders that contain symbolic links to their parent. If there is such a link in the folder being searched and this option is enabled, Kate will repeatedly follow the link and search the folder, and the search will never complete.

Search Results

The results of your search are displayed below the query options. If options for Search in Folder mode are displayed, simply press the Toggle Results button to display them. They will also automatically be displayed as soon as a search is performed.

The search results displays three columns providing information about each result of your search query. The File column shows the name of the file. The Line column displays the line number the contents of your query were found in. The Text column displays the full text of that line.

To open the file your result was found in, simply double-click it. Kate will open the file if needed, and place the cursor at the beginning of the text entered as your query as found in the file.

Menu Structure

ViewTool ViewsShow Search in Files

Toggle the display of Kate's Search in Files tool.