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

# Overleaf의 vimrc 파일에서 사용자 정의 Vim 매크로를 어떻게 정의하나요?

## 소개

Overleaf는 Vim 및 Emacs 키 바인딩을 제공하며, 이는 [프로젝트 메뉴](/latex/ko/knowledge-base/148-using-the-overleaf-project-menu.md#keybindings). 그러나 이러한 키 바인딩은 편집기에서 에뮬레이션되므로(즉, 실제 Vim이나 Emacs가 실행되는 것은 아니므로), Tampermonkey를 사용해 Overleaf 안에서 Vim의 표준 방식으로 새 키 바인딩을 추가하는 것은 불가능합니다. 여기서는 이 제한을 극복하는 데 도움이 될 방법들을 보여드립니다.

### Tampermonkey와 UserScripts에 대한 Overleaf 정책

UserScripts와 Tampermonkey는 Overleaf에서 공식적으로 지원되지 않으며, 사용자 지정 스크립트는 Overleaf의 정상적인 작동을 방해할 수 있습니다. 이러한 스크립트를 사용 중이고 기술 지원을 위해 Overleaf에 문의해야 하는 경우, Tampermonkey 스크립트를 모두 비활성화한 뒤 상황이 개선되는지 확인해 주시기 바랍니다. 스크립트를 비활성화해도 문제가 해결되지 않으면, 문의해 주시기 바랍니다. [저희에게 연락해 주세요](https://www.overleaf.com/contact) 도움을 받기 위해.

## Tampermonkey 사용자 스크립트

참고하시기 바랍니다. 이것은 *작동하지* 공식적으로 지원되는 방법이며 인터페이스는 향후 변경될 수 있으므로 “`UNSTABLE_editor`”라는 명칭입니다.

```latex
// ==UserScript==
// @name         Overleaf 편집기 사용자 지정 VIM 키 바인딩
// @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;

    // 사용자 지정 키 바인딩 추가 - 삽입 모드에서 삽입 시 적용
    CodeMirrorVim.Vim.map("jj", "<Esc>", "insert");
    // 이스케이프된 동안에는 일반 모드가 적용됨
    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/ko/knowledge-base/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.
