# Recipes & Guides

**URL:** https://discuss.kakoune.com/c/recipes-and-guides/8.md

[Latest](https://discuss.kakoune.com/latest.md) · [Categories](https://discuss.kakoune.com/categories.md) · [Tags](https://discuss.kakoune.com/tags.md)

---

## [Useful user-modes](https://discuss.kakoune.com/t/useful-user-modes/730)

<div class="topic-metadata">

**Author:** [@jssee](https://discuss.kakoune.com/u/jssee)\
**Replies:** 11\
**Last updated:** [May 28, 2026, 2:33pm UTC](https://discuss.kakoune.com/t/useful-user-modes/730 "2026-05-28T14:33:25Z")

</div>

Hey all, I’m starting to get more comfortable with using Kakoune, and with that comes more configuration! I wanted to use this thread as a place to share some useful user-modes. feel free to post yours.

---

## [About the Recipes & Guides category](https://discuss.kakoune.com/t/about-the-recipes-guides-category/36)

<div class="topic-metadata">

**Author:** [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Replies:** 2\
**Last updated:** [September 15, 2018, 7:13pm UTC](https://discuss.kakoune.com/t/about-the-recipes-guides-category/36 "2018-09-15T19:13:13Z")

</div>

Sometimes you just want to know exactly how to do something, and want to know what to put in your kakrc.

---

## [Geospatial Keymap](https://discuss.kakoune.com/t/geospatial-keymap/2782)

<div class="topic-metadata">

**Author:** [@mutt](https://discuss.kakoune.com/u/mutt)\
**Replies:** 5\
**Last updated:** [August 16, 2026, 7:35pm UTC](https://discuss.kakoune.com/t/geospatial-keymap/2782 "2026-08-16T19:35:17Z")

</div>

A decade of modal editing has brought me to the following approach which groups conceptual editing concepts into distinct geospatial keyboard locations. In short, you learn how to edit by directly learning muscle memory,…

---

## [Key sequence to emulate terminal command prompt](https://discuss.kakoune.com/t/key-sequence-to-emulate-terminal-command-prompt/2963)

<div class="topic-metadata">

**Author:** [@gregk](https://discuss.kakoune.com/u/gregk)\
**Replies:** 0\
**Last updated:** [August 11, 2026, 8:29pm UTC](https://discuss.kakoune.com/t/key-sequence-to-emulate-terminal-command-prompt/2963 "2026-08-11T20:29:48Z")

</div>

map global user s %{x\<a-!\>. /dev/stdin 2\>&1\<ret\>} -docstring 'execute line(s) as shell command(s) delimited by ;' supports (sequential) execution of multiple command lines via kakoune multi selection supports multiple …

---

## [Changing the cursor colour in Insert mode](https://discuss.kakoune.com/t/changing-the-cursor-colour-in-insert-mode/394)

<div class="topic-metadata">

**Author:** [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Replies:** 4\
**Last updated:** [May 21, 2026, 5:23pm UTC](https://discuss.kakoune.com/t/changing-the-cursor-colour-in-insert-mode/394 "2026-05-21T17:23:29Z")

</div>

Inspired by a recent GitHub issue, I figured I’d try changing the cursor colour scheme between insert and normal mode. It was trickier than I expected, because I prefer to stick to the basic 16 terminal colours. It’s dif…

---

## [Move selection content instead of rotating (like \<a-)\>)](https://discuss.kakoune.com/t/move-selection-content-instead-of-rotating-like-a/2846)

<div class="topic-metadata">

**Author:** [@atiedebee](https://discuss.kakoune.com/u/atiedebee)\
**Replies:** 0\
**Last updated:** [March 7, 2026, 8:48pm UTC](https://discuss.kakoune.com/t/move-selection-content-instead-of-rotating-like-a/2846 "2026-03-07T20:48:49Z")

</div>

I have found \<a-)\> and \<a-(\> really useful and fun key mappings to use. However, there have been situations where they aren’t sufficient for swapping certain selections. For example, transforming the following: int foo(…

---

## [Clipboard integration using OSC 52](https://discuss.kakoune.com/t/clipboard-integration-using-osc-52/1002)

<div class="topic-metadata">

**Author:** [@bravekarma](https://discuss.kakoune.com/u/bravekarma)\
**Replies:** 11\
**Last updated:** [March 4, 2026, 5:44pm UTC](https://discuss.kakoune.com/t/clipboard-integration-using-osc-52/1002 "2026-03-04T17:44:19Z")

</div>

I use Kakoune in WSL and usually inside tmux, which made setting up hooks for copying to system clipboard and/or tmux buffers, and keeping track of both a bit cumbersome. I recently learned about and set up copying to s…

---

## [Move anchor and cursor together](https://discuss.kakoune.com/t/move-anchor-and-cursor-together/2386)

<div class="topic-metadata">

**Author:** [@Maxxus](https://discuss.kakoune.com/u/Maxxus)\
**Replies:** 10\
**Last updated:** [February 25, 2026, 8:21pm UTC](https://discuss.kakoune.com/t/move-anchor-and-cursor-together/2386 "2026-02-25T20:21:01Z")

</div>

Is there a map I can do that will move the anchor with the cursor so the selection stays the same size? The problem I’m trying to solve in case there are alternate solutions. I do a bit of diagramming and sometimes I n…

---

## [Copy github permalink for selected file and line](https://discuss.kakoune.com/t/copy-github-permalink-for-selected-file-and-line/2843)

<div class="topic-metadata">

**Author:** [@erock](https://discuss.kakoune.com/u/erock)\
**Replies:** 0\
**Last updated:** [February 22, 2026, 12:32pm UTC](https://discuss.kakoune.com/t/copy-github-permalink-for-selected-file-and-line/2843 "2026-02-22T12:32:30Z")

</div>

Hey all. In neovim there was a very useful plugin called gitlinker which would grab a github permalink for the file and line you currently had selected. GitHub - linrongbin16/gitlinker.nvim: Maintained fork of ruifm's g…

---

## [Lookup dictionary definitions with the dict protocol](https://discuss.kakoune.com/t/lookup-dictionary-definitions-with-the-dict-protocol/2769)

<div class="topic-metadata">

**Author:** [@marcc](https://discuss.kakoune.com/u/marcc)\
**Replies:** 2\
**Last updated:** [October 7, 2025, 9:54pm UTC](https://discuss.kakoune.com/t/lookup-dictionary-definitions-with-the-dict-protocol/2769 "2025-10-07T21:54:51Z")

</div>

Heya, I just wanted to share this small snippet for looking up definitions of words from dict.org. It uses the dict protocol and requires curl. define-command -override lookup\_word -docstring "Lookup word under selecti…

---

## [Saving & restoring scroll position/window view](https://discuss.kakoune.com/t/saving-restoring-scroll-position-window-view/2766)

<div class="topic-metadata">

**Author:** [@ficd](https://discuss.kakoune.com/u/ficd)\
**Replies:** 0\
**Last updated:** [October 3, 2025, 7:34pm UTC](https://discuss.kakoune.com/t/saving-restoring-scroll-position-window-view/2766 "2025-10-03T19:34:39Z")

</div>

Imagine you have a command that uses Z to save and restore some selections. What if you want everything to restore exactly how it looked before, including the window scroll position? Turns out, we can easily write comma…

---

## [Small patch of autowrap.kak to preserve indentation](https://discuss.kakoune.com/t/small-patch-of-autowrap-kak-to-preserve-indentation/2711)

<div class="topic-metadata">

**Author:** [@ficd](https://discuss.kakoune.com/u/ficd)\
**Replies:** 0\
**Last updated:** [June 23, 2025, 6:45pm UTC](https://discuss.kakoune.com/t/small-patch-of-autowrap-kak-to-preserve-indentation/2711 "2025-06-23T18:45:11Z")

</div>

Exactly what it says on the tin. By changing one line in autowrap.kak, the autowrapped lines will have the same indentation as the line above. I’ve included the patch below if you want to apply it. --- /usr/share/kak/rc…

---

## [Warn when lines are over a certain length](https://discuss.kakoune.com/t/warn-when-lines-are-over-a-certain-length/2680)

<div class="topic-metadata">

**Author:** [@srazkvt](https://discuss.kakoune.com/u/srazkvt)\
**Replies:** 5\
**Last updated:** [May 3, 2025, 3:28pm UTC](https://discuss.kakoune.com/t/warn-when-lines-are-over-a-certain-length/2680 "2025-05-03T15:28:43Z")

</div>

Hey, is there a way to have visual feedback (for example, coloured background) if a line goes over a certain length (for example, 72 characters) ? Right now, i just force kakoune in tmux to be at a certain width, but tha…

---

## [Improved and consistent line selection with X and \<a-X\>](https://discuss.kakoune.com/t/improved-and-consistent-line-selection-with-x-and-a-x/2243)

<div class="topic-metadata">

**Author:** [@arrufat](https://discuss.kakoune.com/u/arrufat)\
**Replies:** 8\
**Last updated:** [February 10, 2025, 5:24pm UTC](https://discuss.kakoune.com/t/improved-and-consistent-line-selection-with-x-and-a-x/2243 "2025-02-10T17:24:20Z")

</div>

Ever since Kakoune made the x key more predictable, I missed the easier way it provided to select new lines. However, I still prefer the new x behavior. The solution was to either xJJJJ or JJJJx. This was good because i…

---

## [Open tmux split, run interactive program, and use result in kakoune](https://discuss.kakoune.com/t/open-tmux-split-run-interactive-program-and-use-result-in-kakoune/2639)

<div class="topic-metadata">

**Author:** [@robem](https://discuss.kakoune.com/u/robem)\
**Replies:** 0\
**Last updated:** [January 26, 2025, 6:40pm UTC](https://discuss.kakoune.com/t/open-tmux-split-run-interactive-program-and-use-result-in-kakoune/2639 "2025-01-26T18:40:48Z")

</div>

Here is a one-liner that can serve as a starting point for integrating applications with kakoune. It took me a couple of hours of experimenting, and reading docs & plugins to come up with a one-liner that demonstrates a …

---

## [Creating an outline for Python files](https://discuss.kakoune.com/t/creating-an-outline-for-python-files/2624)

<div class="topic-metadata">

**Author:** [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Replies:** 0\
**Last updated:** [January 16, 2025, 1:15am UTC](https://discuss.kakoune.com/t/creating-an-outline-for-python-files/2624 "2025-01-16T01:15:09Z")

</div>

A while ago I wrote a little script that generated an outline of the Python file I was working on. I’ve been using it for a while and quite like it, so I figured I’d share it. define-command python-outline \\ -docstring …

---

## [Add another cursor at next match](https://discuss.kakoune.com/t/add-another-cursor-at-next-match/2608)

<div class="topic-metadata">

**Author:** [@tom-huntington](https://discuss.kakoune.com/u/tom-huntington)\
**Replies:** 1\
**Last updated:** [December 24, 2024, 12:37am UTC](https://discuss.kakoune.com/t/add-another-cursor-at-next-match/2608 "2024-12-24T00:37:57Z")

</div>

You can add another cursor at the next matching location by using Alt+Shift+. in visual studio, and Ctrl+D in vscode. In Kakoune, you can use \* to add the current selection to the search register, and then use n to move…

---

## [Kakoune quoting in POSIX shell](https://discuss.kakoune.com/t/kakoune-quoting-in-posix-shell/2594)

<div class="topic-metadata">

**Author:** [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Replies:** 9\
**Last updated:** [December 6, 2024, 1:08pm UTC](https://discuss.kakoune.com/t/kakoune-quoting-in-posix-shell/2594 "2024-12-06T13:08:13Z")

</div>

Kakoune is pretty flexible about integrating with other tools; as long as it can read from stdin and write to stdout, you can probably use it to write a Kakoune plugin. Because a lot of plugins need to send commands to K…

---

## [Escaping from insert mode with jk](https://discuss.kakoune.com/t/escaping-from-insert-mode-with-jk/2557)

<div class="topic-metadata">

**Author:** [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Replies:** 0\
**Last updated:** [October 23, 2024, 3:15pm UTC](https://discuss.kakoune.com/t/escaping-from-insert-mode-with-jk/2557 "2024-10-23T15:15:57Z")

</div>

A traditional “power user” configuration for vi is to map an unlikely insert-mode sequence like jj or jk to Escape, to make it easy to switch back to normal mode without leaving the home row. Kakoune doesn’t support this…

---

## [Multiple, optional linters for a single filetype](https://discuss.kakoune.com/t/multiple-optional-linters-for-a-single-filetype/2541)

<div class="topic-metadata">

**Author:** [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Replies:** 0\
**Last updated:** [September 11, 2024, 3:31pm UTC](https://discuss.kakoune.com/t/multiple-optional-linters-for-a-single-filetype/2541 "2024-09-11T15:31:05Z")

</div>

Python has a number of linters and static analysis tools available, some of them are meta-tools that run multiple different kinds of checks over your code at once. Unfortunately the check that the meta-tools always seem …

---

## [Replace tmux copy/scrollback mode with Kakoune](https://discuss.kakoune.com/t/replace-tmux-copy-scrollback-mode-with-kakoune/110)

<div class="topic-metadata">

**Author:** [@eraserhd](https://discuss.kakoune.com/u/eraserhd)\
**Replies:** 5\
**Last updated:** [September 8, 2024, 4:51pm UTC](https://discuss.kakoune.com/t/replace-tmux-copy-scrollback-mode-with-kakoune/110 "2024-09-08T16:51:52Z")

</div>

\# Make our own copy-mode with Kakoune! bind -Tpane-menu N capture-pane -S- -E- -J -b copy-mode \\; \\ new-window -n copy-mode -d '\\ file=$(mktemp) ; \\ tmux save-buffer -b copy-mode "$file" ; \\ tmux de…

---

## [Filter lsp-document-symbol with prompt menu](https://discuss.kakoune.com/t/filter-lsp-document-symbol-with-prompt-menu/2539)

<div class="topic-metadata">

**Author:** [@vbauerster](https://discuss.kakoune.com/u/vbauerster)\
**Replies:** 2\
**Last updated:** [September 8, 2024, 7:38pm UTC](https://discuss.kakoune.com/t/filter-lsp-document-symbol-with-prompt-menu/2539 "2024-09-08T19:38:26Z")

</div>

There is lsp-document-symbol command available as part of kakoune-lsp plugin. It lists a structure of code in \*goto\* buffer. Sometimes I need to find specific type but the list can be quite long. So I came up with a qui…

---

## [Simplifying snippets (if possible)?](https://discuss.kakoune.com/t/simplifying-snippets-if-possible/2526)

<div class="topic-metadata">

**Author:** [@The-BigDaddy](https://discuss.kakoune.com/u/The-BigDaddy)\
**Replies:** 1\
**Last updated:** [August 15, 2024, 3:53pm UTC](https://discuss.kakoune.com/t/simplifying-snippets-if-possible/2526 "2024-08-15T15:53:05Z")

</div>

Hey gang, So I know kakoune-snippets has been the go-to snippet plugin for awhile, but I was wondering if there’s another way of doing snippets. Let’s me go through my thought process: We have a folder called snippets …

---

## [Long Time No See: Need help updating configuration](https://discuss.kakoune.com/t/long-time-no-see-need-help-updating-configuration/2518)

<div class="topic-metadata">

**Author:** [@The-BigDaddy](https://discuss.kakoune.com/u/The-BigDaddy)\
**Replies:** 6\
**Last updated:** [August 8, 2024, 3:24am UTC](https://discuss.kakoune.com/t/long-time-no-see-need-help-updating-configuration/2518 "2024-08-08T03:24:15Z")

</div>

Hey gang, Been awhile! I find myself curious about editors again, although it’s more so of an attempt to create a sane (at least to me) configuration for a lot of them, Kakoune being one. My main editor is Emacs, as I’v…

---

## [Creating undo groups in Normal mode](https://discuss.kakoune.com/t/creating-undo-groups-in-normal-mode/2474)

<div class="topic-metadata">

**Author:** [@ftonneau](https://discuss.kakoune.com/u/ftonneau)\
**Replies:** 1\
**Last updated:** [April 24, 2024, 2:53am UTC](https://discuss.kakoune.com/t/creating-undo-groups-in-normal-mode/2474 "2024-04-24T02:53:14Z")

</div>

The ability to group actions so that they can be undone as a unit is an important one for some plugins that change text “behind the scenes.” This can be done in Insert mode with \<c-u\>, but I did not know how to accomplis…

---

## [Highlight TODO but only in comments](https://discuss.kakoune.com/t/highlight-todo-but-only-in-comments/2330)

<div class="topic-metadata">

**Author:** [@Nasmekva](https://discuss.kakoune.com/u/Nasmekva)\
**Replies:** 6\
**Last updated:** [March 18, 2024, 10:41pm UTC](https://discuss.kakoune.com/t/highlight-todo-but-only-in-comments/2330 "2024-03-18T22:41:38Z")

</div>

The wiki solution didn’t cut it for me, so I went with this small snippet. hook -group todohighlight global BufCreate .\* %{ add-highlighter buffer/ dynregex "%opt{comment\_line}\[ \\t\]\*\\b(TODO|FIXME|MAYBE)\\b" 1:default+bu…

---

## [The Kakoune way](https://discuss.kakoune.com/t/the-kakoune-way/2316)

<div class="topic-metadata">

**Author:** [@lauccode](https://discuss.kakoune.com/u/lauccode)\
**Replies:** 11\
**Last updated:** [March 6, 2024, 4:59pm UTC](https://discuss.kakoune.com/t/the-kakoune-way/2316 "2024-03-06T16:59:02Z")

</div>

I come back to kakoune from some days ago after around 4 years. I discovered lot of plug-in are now public archive (kak-tree, tagbar ...and even fzf.kak that I’m trying to make my own with color(with bat) now to find fil…

---

## [Useful binding to format comments](https://discuss.kakoune.com/t/useful-binding-to-format-comments/2382)

<div class="topic-metadata">

**Author:** [@joncol](https://discuss.kakoune.com/u/joncol)\
**Replies:** 3\
**Last updated:** [January 26, 2024, 6:26pm UTC](https://discuss.kakoune.com/t/useful-binding-to-format-comments/2382 "2024-01-26T18:26:22Z")

</div>

Hi, I started this as a question, but I figured out a solution before posting. This is a small utility command that wraps long lines of comments in different languages (using different comment prefixes). Maybe someone e…

---

## [Command to preview line in buffer just like the numb.nvim plugin in neovim](https://discuss.kakoune.com/t/command-to-preview-line-in-buffer-just-like-the-numb-nvim-plugin-in-neovim/2294)

<div class="topic-metadata">

**Author:** [@Nasmekva](https://discuss.kakoune.com/u/Nasmekva)\
**Replies:** 8\
**Last updated:** [November 22, 2023, 8:59pm UTC](https://discuss.kakoune.com/t/command-to-preview-line-in-buffer-just-like-the-numb-nvim-plugin-in-neovim/2294 "2023-11-22T20:59:17Z")

</div>

Before making the switch from neovim, I had a very sparse configuration, with only a few plugins, trying to delete as many plugins as possible. Though, GitHub - nacro90/numb.nvim: Peek lines just when you intend was nev…

---

## [Commands to auto-size window width to fit content](https://discuss.kakoune.com/t/commands-to-auto-size-window-width-to-fit-content/2272)

<div class="topic-metadata">

**Author:** [@jordan-yee](https://discuss.kakoune.com/u/jordan-yee)\
**Replies:** 0\
**Last updated:** [August 11, 2023, 9:14pm UTC](https://discuss.kakoune.com/t/commands-to-auto-size-window-width-to-fit-content/2272 "2023-08-11T21:14:33Z")

</div>

I typically have 2 side-by-side windows open while coding, and try to maintain an 80 character line limit that allows the lines in either split to be rendered without wrapping. However, when working on a large codebase w…

[Next page](https://discuss.kakoune.com/c/recipes-and-guides/8.md?page=1)
