# Rename

> **TL;DR**
> Shortcut: `Shift+F6` (Windows), `⇧ F6` (macOS), `⇧ F6` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ R` (macOS System Shortcuts), `Shift+F6` (XWin), `Shift+F6` (GNOME), `Shift+F6` (KDE), `Shift+F6` (Emacs), `Shift+F6` (Sublime Text), `⇧ F6` (Sublime Text (macOS)), `⌘ ⌃ E` (Xcode), `Ctrl+R, R` (Visual Studio), `⌘ R, R` (Visual Studio (macOS)), `F2` (ReSharper), `F2` (ReSharper (macOS)), `Ctrl+Shift+R` (QtCreator), `⌘ ⌃ R` (QtCreator (macOS)), `Ctrl+R` (NetBeans), `Alt+Shift+R` (Eclipse), `⇧ F6` (Eclipse (macOS))
>
>
>
> Main menu: `Refactor | Rename`
>
>
>
> Context menu: `Rename`
>
>
>
> [General refactoring settings](code-editing.html): `Settings | Editor | Code Editing`

Rename refactoring allows you to rename symbols, files, and directories globally with all the references to them in the code corrected automatically.

Procedure: Rename a symbol

1. Select an item to be renamed.

2. Select `Rename` from the context menu or press `Shift+F6` (Windows), `⇧ F6` (macOS), `⇧ F6` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ R` (macOS System Shortcuts), `Shift+F6` (XWin), `Shift+F6` (GNOME), `Shift+F6` (KDE), `Shift+F6` (Emacs), `Shift+F6` (Sublime Text), `⇧ F6` (Sublime Text (macOS)), `⌘ ⌃ E` (Xcode), `Ctrl+R, R` (Visual Studio), `⌘ R, R` (Visual Studio (macOS)), `F2` (ReSharper), `F2` (ReSharper (macOS)), `Ctrl+Shift+R` (QtCreator), `⌘ ⌃ R` (QtCreator (macOS)), `Ctrl+R` (NetBeans), `Alt+Shift+R` (Eclipse), `⇧ F6` (Eclipse (macOS)). The selected symbol gets highlighted, and you can type a new name in the highlighted area.

3. CLion displays ![the Rename in comments and strings icon](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.codeInsight.inlayRenameInComments.svg) and  ![the Rename in text occurrences icon](https://resources.jetbrains.com/help/img/idea/2026.2/app-client.expui.codeInsight.inlayRenameInNoCodeFiles.svg) next to the highlighted element.

![The in-place rename refactoring](https://resources.jetbrains.com/help/img/idea/2026.2/cl_rename_inplace.png)

You can click these icons or press `Tab` (Windows), `Tab` (macOS), `Tab` (IntelliJ IDEA Classic (macOS)), `Tab` (macOS System Shortcuts), `Tab` (XWin), `Tab` (GNOME), `Tab` (KDE), `Tab` (Emacs), `Tab` (Sublime Text), `Tab` (Sublime Text (macOS)), `Tab` (Xcode), `Tab` (Visual Studio), `Tab` (Visual Studio (macOS)), `Tab` (ReSharper), `Tab` (ReSharper (macOS)), `Tab` (QtCreator), `Tab` (QtCreator (macOS)), `Tab` (NetBeans), `Tab` (Eclipse), `Tab` (Eclipse (macOS)) to open the context menu and select the additional rename options.

![The inplace rename refactoring dialog](https://resources.jetbrains.com/help/img/idea/2026.2/cl_inplace_rename_popup.png)

* Comments and strings: the occurrences of the symbol will be also renamed in comments and string literals.

* Text occurrences : the occurrences of the symbol will be also renamed in files that don't contain any source code (documentation, text files, HTML files, and so on).

4. If you want to change other refactoring options or preview the refactoring results, click the More options link or press `Shift+F6` (Windows), `⇧ F6` (macOS), `⇧ F6` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ R` (macOS System Shortcuts), `Shift+F6` (XWin), `Shift+F6` (GNOME), `Shift+F6` (KDE), `Shift+F6` (Emacs), `Shift+F6` (Sublime Text), `⇧ F6` (Sublime Text (macOS)), `⌘ ⌃ E` (Xcode), `Ctrl+R, R` (Visual Studio), `⌘ R, R` (Visual Studio (macOS)), `F2` (ReSharper), `F2` (ReSharper (macOS)), `Ctrl+Shift+R` (QtCreator), `⌘ ⌃ R` (QtCreator (macOS)), `Ctrl+R` (NetBeans), `Alt+Shift+R` (Eclipse), `⇧ F6` (Eclipse (macOS)). In the dialog that opens, you can select the refactoring scope and click Preview to [preview the changes](refactoring-source-code.html#changes_preview) in a separate tool window before applying them.

![The Rename dialog](https://resources.jetbrains.com/help/img/idea/2026.2/cl_rename_dialog.png)

Procedure: Rename a file or directory

1. Select the file or directory in the [Project tool window.](project-tool-window.html)

2. Press `Shift+F6` (Windows), `⇧ F6` (macOS), `⇧ F6` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ R` (macOS System Shortcuts), `Shift+F6` (XWin), `Shift+F6` (GNOME), `Shift+F6` (KDE), `Shift+F6` (Emacs), `Shift+F6` (Sublime Text), `⇧ F6` (Sublime Text (macOS)), `⌘ ⌃ E` (Xcode), `Ctrl+R, R` (Visual Studio), `⌘ R, R` (Visual Studio (macOS)), `F2` (ReSharper), `F2` (ReSharper (macOS)), `Ctrl+Shift+R` (QtCreator), `⌘ ⌃ R` (QtCreator (macOS)), `Ctrl+R` (NetBeans), `Alt+Shift+R` (Eclipse), `⇧ F6` (Eclipse (macOS)) or select `Rename` from the context menu.

3. In the Rename dialog that opens, specify the new name.

![Rename a directory](https://resources.jetbrains.com/help/img/idea/2026.2/cl_rename_dir.png)

* Select the Search in comments and strings checkbox to let CLion apply changes to comments and strings.

* Clear the Rename associated file checkbox if don't want CLion to rename the associated files with the same name.

* Change the refactoring scope in the corresponding field if needed.

4. Click Preview to observe possible changes in [Find](find-tool-window.html) Tool Window. Click Refactor to proceed.

CLion finds all the occurrences of the filename and changes them respectively.

## Example

This example represents CMakelists.txt before and after applying Rename file to `Calendar.cpp`:

| Before | After |
| --- | --- |
|     ```CMAKE cmake_minimum_required(VERSION 3.2) project(Calendar_master)  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")  set(SOURCE_FILES calendars/Calendar.cpp calendars/Calendar.h main.cpp) add_executable(Calendar_master ${SOURCE_FILES} ```    |     ```CMAKE cmake_minimum_required(VERSION 3.2) project(Calendar_master)  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")  set(SOURCE_FILES calendars/CalendarRen.cpp calendars/CalendarRen.h main.cpp) add_executable(Calendar_master ${SOURCE_FILES}) ```    |

## See also

### Reference

[Find tool window](find-tool-window.html)

### External Links

[JetBrains CLion Blog](http://blog.jetbrains.com/clion/2014/12/refactorings-in-clion-be-safe-and-quick/)

