> 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/nl/kennisbank/049-how-can-i-define-custom-vim-macros-in-a-vimrc-file-on-overleaf.md).

# Hoe kan ik aangepaste Vim-macro's definiëren in een vimrc-bestand op Overleaf?

## Inleiding

Overleaf biedt Vim- en Emacs-sneltoetsen die kunnen worden ingeschakeld in het [projectmenu](/latex/nl/kennisbank/148-using-the-overleaf-project-menu.md#keybindings). Omdat deze sneltoetsen echter door de editor worden nagebootst (d.w\.z. er draait geen echte Vim of Emacs), is het niet mogelijk om met Tampermonkey binnen Overleaf de standaardmethoden van Vim te gebruiken om nieuwe toe te voegen. Hier laten we manieren zien die moeten helpen deze beperking te omzeilen.

### Overleaf-beleid voor Tampermonkey en UserScripts

Houd er rekening mee dat UserScripts en Tampermonkey niet officieel worden ondersteund door Overleaf en dat aangepaste scripts de normale werking van Overleaf kunnen verstoren. Als u dergelijke scripts gebruikt en contact moet opnemen met Overleaf voor technische ondersteuning, vragen wij u vriendelijk om eventuele Tempermonkey-scripts uit te schakelen en te controleren of de situatie verbetert. Als het uitschakelen van de scripts uw probleem niet oplost, neem dan [contact met ons op](https://www.overleaf.com/contact) contact op voor hulp.

## Tampermonkey UserScript

Houd er rekening mee dat dit *niet* een officieel ondersteunde methode is en dat de interface in de toekomst kan veranderen, vandaar de “`UNSTABLE_editor`”-naamgeving.

```latex
// ==UserScript==
// @name         Overleaf-editor aangepaste VIM-sneltoetsen
// @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;

    // voeg aangepaste sneltoetsen toe - invoegmodus geldt bij invoegen
    CodeMirrorVim.Vim.map("jj", "<Esc>", "insert");
    // normale modus geldt terwijl je bent ontsnapt
    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/nl/kennisbank/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.
