Search & Replace

T.C. Hollingsworth

Introduction

Kate's Search & Replace plugin allows you to search for text or regular expressions in many different files at once. You can search all open files, all the files in one directory and optionally its subdirectories, or in the active file. 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:

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.

The button 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.

Find

This is where you type in what you want to find. You may enter standard text, or a regular expression if enabled.

Replace (text box)

Replacement text that will be added to file(s) in place of the text in the Find text box.

Search

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

Replace

When you've finished configuring everything, just press the Replace button to replace the text entered in the Find text box with that of the Replace text box. You may also press Enter in the Replace text box to do the same.

Next

Go to the next match of your search query, switching files if necessary.

Replace checked

The same as Replace, but will only perform replacements in files that are checked in the pane below.

Search in Folder Options

These options are displayed below the aforementioned query options. If search results are being displayed instead, press the button to display them.

Search in

This has three options. Select Open Files to search all files currently open in Kate. Select Folder to search inside a folder and optionally its subfolders. Select Current File to search only in the active file.

If the Projects plugin is loaded, you can also search in the Current Project or in All Open Projects.

Match case

Restricts 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.

Expand results

Display all the results found in each file, instead of just a list of files that contain the search query.

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. This option is only available when using in Folder mode.

Open file dialog

Press this button to locate the folder in your desktop's folder browser. This button only works when using Folder mode.

Press this button to change Folder to the parent of the currently selected folder. This button only works when using Folder mode.

This button will set the Folder entry to the folder in which the currently open document is located. This button only works when using Folder mode.

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 (,). This option is not available when using Open files mode.

Exclude

The opposite of Filter, this prevents Kate from searching files that match the specified patterns. As with Filter, you can enter multiple patterns separated with a comma (,). This option is not available when using Open files mode.

Recursive

If this option is enabled, Kate will also search in all subfolders of the selected folder. This option is only available when using Folder mode.

Include hidden

If this option is enabled, Kate will also search in files or folders that are typically hidden by your operating system. This option is only available when using Folder mode.

Follow symbolic links

The Search in Files plugin typically does not follow symbolic links. When this option is enabled, the plugin will follow them instead and search inside the files or folders they reference. This option is only available when using Folder mode.

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.

Include binary files

If enabled, Kate will also search in files that do not appear to be text files.

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 button to display them. They will also automatically be displayed as soon as a search is performed.

The search results display a list of files that contains text that matches your search query, followed by the number of matches found in that file.

To see a list of matches in that file, simply click the expansion arrow to the left of the file name. (If you selected the Expand results option, this will already be done for you.) The line number each match is found on will be displayed, followed by the contents of that line, with your search query indicated in bold text.

To open the file your result was found in, simply double-click it. Kate will open the file if needed. You can also move the cursor to the location of a particular match by double-clicking on its listing instead of the file name.

Menu Structure

EditSearch in Files

Launches the Search and Replace tool view.

EditGo to Next Match

Go to the next match in a search performed by the Search and Replace plugin.

EditGo to Previous Match

Go to the previous match in a search performed by the Search and Replace plugin.

ViewTool ViewsShow Search and Replace

Toggle the display of Kate's Search and Replace tool.