> For AI agents: the complete documentation index is available at https://nhanbe.id.vn/llms.txt, the full documentation bundle is available at https://nhanbe.id.vn/llms-full.txt.

# Notepad++

Core features in Notepad++ that are essential for handling AEM log files, XML configurations, and automation scripts.

***

## 1. Column Mode Selection

Press `Alt+Shift+↑/↓/←/→` or hold `Alt` while dragging the mouse to select text rectangularly (Column Mode).

**AEM Use Case:** Remove redundant log prefixes across multiple lines simultaneously, or extract specific data columns from log files.

```text
[ERROR] 2024-01-15 10:00:01 com.mysite.core...
[ERROR] 2024-01-15 10:00:02 com.mysite.core...
[ERROR] 2024-01-15 10:00:03 com.mysite.core...
```

Select the prefix block `[ERROR] ` via `Alt+Drag` → Press Delete to strip prefixes in a single action.

***

## 2. Regular Expression Search & Replace

Press `Ctrl+H` → Enable **Regular expression** mode.

**AEM Use Case — Remove Blank Lines:**

Find:

```regex
^\r?\n
```

Replace: _(Leave empty)_

**AEM Use Case — Update Java Package Names in XML:**

Find:

```regex
com\.oldsite\.core
```

Replace:

```text
com.newsite.core
```

**AEM Use Case — Extract Class Names from Stack Traces:**

Find:

```regex
\tat ([\w\.]+)\(.*\)
```

Replace:

```text
$1
```

***

## 3. Mark and Highlight Text

Press `Ctrl+M` → Highlight selected text with custom colors. Up to **5 distinct style colors** can be applied concurrently.

Navigate to **Search → Mark All** → Enter keyword → Highlight all instances across document.

**AEM Use Case:** Color-code different log levels and keywords while analyzing `error.log`:

- Style 1: `ERROR`
- Style 2: `WARN`
- Style 3: `NullPointerException`
- Style 4: Target component name under active investigation

***

## 4. Line Bookmarks

| Shortcut        | Description                     |
| --------------- | ------------------------------- |
| `Ctrl+F2`       | Toggle bookmark on current line |
| `F2`            | Jump to next bookmark           |
| `Shift+F2`      | Jump to previous bookmark       |
| `Ctrl+Shift+F2` | Clear all bookmarks             |

**AEM Use Case:** Bookmark key log entries within multi-thousand-line `error.log` files to navigate quickly between relevant trace points.

***

## 5. Folding and Unfolding Code Blocks

| Shortcut      | Description                        |
| ------------- | ---------------------------------- |
| `Alt+0`       | Fold all levels                    |
| `Alt+Shift+0` | Unfold all levels                  |
| `Alt+1..8`    | Fold to specific indentation level |
| `Ctrl+Alt+F`  | Fold current block                 |

**AEM Use Case:** Collapse individual `<node>` blocks in large `.content.xml` files to inspect overall node hierarchy cleanly.

***

## 6. Compare Plugin

Install via **Plugins → Plugins Admin → Compare**.

Navigate to **Plugins → Compare → Compare** to inspect two open files side-by-side with highlighted differences.

**AEM Use Case:**

- Compare `dispatcher.any` configurations between production and staging environments.
- Diff `_rep_policy.xml` ACL definitions before and after editing.
- Compare package manifest versions (`.content.xml`) prior to package deployment.

***

## 7. XML Tools Plugin

Install via **Plugins Admin → XML Tools**.

| Action           | Shortcut           |
| ---------------- | ------------------ |
| Pretty Print XML | `Ctrl+Alt+Shift+B` |
| Check XML Syntax | `Ctrl+Alt+Shift+S` |
| Evaluate XPath   | `Ctrl+Alt+Shift+X` |

**AEM Use Case:** Copy raw XML from CRXDE → Paste into Notepad++ → Execute `Pretty Print` to format node structure.

***

## 8. Macro Recording and Execution

1. Navigate to `Macro → Start Recording`.
2. Perform repetitive text transformation steps.
3. Select `Macro → Stop Recording`.
4. Press `Ctrl+Shift+P` to replay once, or select `Macro → Run a Macro Multiple Times`.

**AEM Use Case:** Format raw stack traces line-by-line and execute the macro repeatedly to process large log files.

***

## 9. Column Editor

Press `Alt+C` while in column selection mode to launch the Column Editor.

Insert sequential numbers or static text into the active column across selected lines.

**AEM Use Case:** Prepend ` -` to multiple lines to convert plain lists into formatted YAML/Markdown syntax.

***

## 10. Converting Line Endings

Navigate to `Edit → EOL Conversion`:

- **Windows (CRLF)**: `\r\n`
- **Unix (LF)**: `\n`
- **Macintosh (CR)**: `\r`

**AEM Use Case:** Bash scripts or Dispatcher configuration files created on Windows failing on Linux due to `\r` carriage returns → Convert to Unix (LF) before uploading.

***

## 11. Character Encoding Conversion

Navigate to `Encoding` menu to switch between UTF-8, UTF-8-BOM, ANSI, and UTF-16.

**AEM Use Case:** Ensure i18n `.properties` files use standard UTF-8 (avoid UTF-8-BOM as AEM property readers fail to parse BOM markers properly).

***

## 12. Workspace Sessions

Navigate to `File → Save Session` to save currently open files as a `.nps` session file.
Select `File → Load Session` to restore the designated group of files.

**AEM Task Session Examples:**

- `debug-dispatcher.nps`: `dispatcher.any`, `httpd.conf`, `access_log`.
- `aem-logs.nps`: `error.log`, `request.log`, `stdout.log`.
- `package-review.nps`: Active `.content.xml` vault files under review.

***

## 13. Function List Panel

Navigate to `View → Function List` to display a sidebar listing functions, methods, and definitions.

**AEM Use Case:** Navigate complex deployment shell scripts or Python automation scripts easily.

***

## 14. Document Map

Navigate to `View → Document Map` to view a high-level mini-map of the file on the right margin.

**AEM Use Case:** Navigate large log files spanning multiple megabytes quickly without manual scrolling.

***

## 15. Find in Files

Press `Ctrl+Shift+F` to search across directories.

Configuration parameters:

- **Find what**: Search term or regex.
- **Filters**: `*.log`, `*.xml`, `*.any`, `*.conf`.
- **Directory**: Target root directory.

**AEM Use Case:**

- Search log directories for `OutOfMemoryError` occurrences.
- Search XML files across vault packages for specific `sling:resourceType` definitions.
- Locate `Include` directives across Dispatcher configuration files.

***

## 16. User Defined Language (UDL)

Navigate to `Language → User Defined Language → Define your language` to construct custom syntax highlighting rules.

**AEM Use Case:** Import custom UDL rules for Sling log formats (highlight timestamps, log levels, and class names in distinct colors).

***

## 17. Smart Highlighting

Double-click any word to highlight all matching occurrences throughout the document.

**AEM Use Case:** Double-click a class name within a stack trace to highlight every reference to that class in the active log.

***

## 18. Auto-Completion

Navigate to `Settings → Preferences → Auto-Completion`:

- Enable word completion per document.
- Enable parameter hints.

**AEM Use Case:** Autocomplete JCR property names in `.content.xml` files based on existing document contents.

***

## 19. Word Wrap

Press `Alt+H` (or navigate to `View → Word Wrap`) to toggle line wrapping.

**AEM Use Case:** Long stack trace lines in log files wrap cleanly without horizontal scrolling.

***

## 20. Executing External Commands

Press `F5` (`Run → Run...`) to execute external CLI tools using variables:

| Variable               | Resolves To                           |
| ---------------------- | ------------------------------------- |
| `$(FULL_CURRENT_PATH)` | Absolute file path of active document |
| `$(CURRENT_WORD)`      | Currently highlighted word            |
| `$(CURRENT_LINE)`      | Active line number                    |
| `$(NPP_DIRECTORY)`     | Notepad++ installation directory      |

**AEM Use Case:** Create a shortcut to deploy the active XML file directly to CRXDE via `curl`:

```bash
cmd /c curl -u admin:admin -X POST "http://localhost:4502/crx/de/index.jsp" -F "file=@$(FULL_CURRENT_PATH)"
```

***

## 21. Tail Monitoring Mode

Navigate to `View → Monitoring (tail -f)` to auto-refresh the file as new data is written to disk.

**AEM Use Case:** Monitor `crx-quickstart/logs/error.log` in real time within Notepad++ without installing third-party tail utilities on Windows.

***

## 22. Multi-View Split Editor

Navigate to `View → Move/Clone Current Document → Move to Other View` to split the editor into dual panes.

**AEM Use Case:** Display `error.log` on the left pane and `.content.xml` on the right pane during debugging.
