> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/de/wissensdatenbank/049-how-can-i-define-custom-vim-macros-in-a-vimrc-file-on-overleaf.md).

# Wie kann ich benutzerdefinierte Vim-Makros in einer vimrc-Datei auf Overleaf definieren?

## Einleitung

Overleaf bietet Vim- und Emacs-Tastenkombinationen, die im [Projektmenü](/latex/de/wissensdatenbank/148-using-the-overleaf-project-menu.md#keybindings). Allerdings ist es, da diese Tastenkombinationen vom Editor emuliert werden (d. h. es läuft kein echtes Vim oder Emacs), nicht möglich, in Overleaf mit Tampermonkey die Standardmethoden von Vim zum Hinzufügen neuer solcher Tastenkombinationen zu verwenden. Hier zeigen wir Wege, die helfen sollten, diese Einschränkung zu überwinden.

### Overleaf-Richtlinie zu Tampermonkey und UserScripts

Bitte beachten Sie, dass UserScripts und Tampermonkey von Overleaf nicht offiziell unterstützt werden und dass benutzerdefinierte Skripte den normalen Betrieb von Overleaf beeinträchtigen können. Wenn Sie solche Skripte verwenden und Overleaf wegen technischer Unterstützung kontaktieren müssen, bitten wir Sie freundlich, alle Tempermonkey-Skripte zu deaktivieren und zu prüfen, ob sich die Situation verbessert. Wenn das Deaktivieren der Skripte Ihr Problem nicht löst, bitte [an uns wenden](https://www.overleaf.com/contact) für Unterstützung.

## Tampermonkey UserScript

Bitte beachten Sie, dass dies *nicht* eine offiziell unterstützte Methode ist und die Oberfläche sich in Zukunft ändern kann, daher die „`UNSTABLE_editor`“-Benennung.

```latex
// ==UserScript==
// @name         Overleaf Editor Benutzerdefinierte Vim-Tastenkombinationen
// @namespace    http://tampermonkey.net/
// @version      0.1
// @match        https://www.overleaf.com/project/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    window.addEventListener("UNSTABLE_editor:extensions", (event) => {
    const { CodeMirror, CodeMirrorVim, extensions } = event.detail;

    // benutzerdefinierte Tastenkombinationen hinzufügen - Einfügemodus gilt beim Einfügen
    CodeMirrorVim.Vim.map("jj", "<Esc>", "insert");
    // Normalmodus gilt, während man entkommen ist
    CodeMirrorVim.Vim.map("h", "j", "normal");
    });
})();
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/de/wissensdatenbank/049-how-can-i-define-custom-vim-macros-in-a-vimrc-file-on-overleaf.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
