# \#format

**URL:** https://discuss.kakoune.com/tag/format/13.md

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

---

## [AI 'Prompt Stuffing' for the Kakoune.asciidoc documentation](https://discuss.kakoune.com/t/ai-prompt-stuffing-for-the-kakoune-asciidoc-documentation/2823)

<div class="topic-metadata">

**Author:** [@duncode](https://discuss.kakoune.com/u/duncode)\
**Replies:** 16\
**Last updated:** [February 8, 2026, 6:13am UTC](https://discuss.kakoune.com/t/ai-prompt-stuffing-for-the-kakoune-asciidoc-documentation/2823 "2026-02-08T06:13:24Z")

</div>

Does/Has anyone have any suggestions or improvements on a ‘Prompt’ or ‘Model’ for improving Kakounes’ documentation with the help of an AI? Similar topic 2019: @Screwtapello Rewriting/Reorganising Kakounes Documentatio…

---

## [C/C++ Comment Continuation](https://discuss.kakoune.com/t/c-c-comment-continuation/2642)

<div class="topic-metadata">

**Author:** [@Dark\_Arc](https://discuss.kakoune.com/u/Dark_Arc)\
**Replies:** 1\
**Last updated:** [January 29, 2025, 5:21pm UTC](https://discuss.kakoune.com/t/c-c-comment-continuation/2642 "2025-01-29T17:21:56Z")

</div>

When writing C or C++ code with the /\* \*/ comment style, when you start a new line kakoune automatically inserts spaces and a \*. Effectively, this comment style: /\* \* \<comment\> I work in a code base where the style i…

---

## [Pasting from clipboard includes unicode characters](https://discuss.kakoune.com/t/pasting-from-clipboard-includes-unicode-characters/2499)

<div class="topic-metadata">

**Author:** [@Aaron\_Zack](https://discuss.kakoune.com/u/Aaron_Zack)\
**Replies:** 7\
**Last updated:** [June 14, 2024, 2:43pm UTC](https://discuss.kakoune.com/t/pasting-from-clipboard-includes-unicode-characters/2499 "2024-06-14T14:43:02Z")

</div>

I’m trying to configure my kakrc copy/paste capabilities. Here’s a snippet of my kakrc: # System clipboard handling # ───────────────────────── evaluate-commands %sh{ if \[ -n "$SSH\_TTY" \]; then copy='print…

---

## [Indentation in snippets](https://discuss.kakoune.com/t/indentation-in-snippets/2405)

<div class="topic-metadata">

**Author:** [@joncol](https://discuss.kakoune.com/u/joncol)\
**Replies:** 4\
**Last updated:** [February 19, 2024, 3:47pm UTC](https://discuss.kakoune.com/t/indentation-in-snippets/2405 "2024-02-19T15:47:36Z")

</div>

Hi, Say I’ve got a snippet (GitHub - occivink/kakoune-snippets: Snippet support for kakoune) like the following: hook global BufCreate .\*\\.envrc$ %{ set -add buffer snippets 'envrc with flake support' '^envrc' %{ …

---

## [Getting the current file path to set \`formatcmd\`](https://discuss.kakoune.com/t/getting-the-current-file-path-to-set-formatcmd/2303)

<div class="topic-metadata">

**Author:** [@joncol](https://discuss.kakoune.com/u/joncol)\
**Replies:** 1\
**Last updated:** [October 4, 2023, 2:37pm UTC](https://discuss.kakoune.com/t/getting-the-current-file-path-to-set-formatcmd/2303 "2023-10-04T14:37:41Z")

</div>

Hi, beginner question: I’m trying to set formatcmd to be fourmolu -stdin-input-file \[name-of-current-file\]. \[name-of-current-file\] should be replaced by the full filename (including the path) of the currently edited fil…

---

## [Pasting bullet lists leads to ever-increasing indentation](https://discuss.kakoune.com/t/pasting-bullet-lists-leads-to-ever-increasing-indentation/2196)

<div class="topic-metadata">

**Author:** [@jbrains](https://discuss.kakoune.com/u/jbrains)\
**Replies:** 4\
**Last updated:** [March 9, 2023, 2:27pm UTC](https://discuss.kakoune.com/t/pasting-bullet-lists-leads-to-ever-increasing-indentation/2196 "2023-03-09T14:27:06Z")

</div>

I’m struggling with pasting content formatted as an HTML unordered list from a browser into a Kakoune buffer. Each list item line seems to be indented one more level than the previous list item. I’m running on Pop!\_OS an…

---

## [As default config I want word autocompletion OFF](https://discuss.kakoune.com/t/as-default-config-i-want-word-autocompletion-off/2135)

<div class="topic-metadata">

**Author:** [@LobaLuna](https://discuss.kakoune.com/u/LobaLuna)\
**Replies:** 5\
**Last updated:** [October 29, 2022, 5:43am UTC](https://discuss.kakoune.com/t/as-default-config-i-want-word-autocompletion-off/2135 "2022-10-29T05:43:30Z")

</div>

Hi, everybody. I work with text documents, MD and plain text regular everyday-language documents. I want to start Kakoune without word completions. According to this solution (Disable autocomplete - #2 by tototest99),…

---

## [Line flags before line numbers](https://discuss.kakoune.com/t/line-flags-before-line-numbers/1905)

<div class="topic-metadata">

**Author:** [@zach](https://discuss.kakoune.com/u/zach)\
**Replies:** 1\
**Last updated:** [October 16, 2021, 9:48pm UTC](https://discuss.kakoune.com/t/line-flags-before-line-numbers/1905 "2021-10-16T21:48:53Z")

</div>

I was wondering if there is a way to have the flag column precede the line number column in the buffer?

---

## [Apache Tika extracts metadata and text from over a thousand different file types](https://discuss.kakoune.com/t/apache-tika-extracts-metadata-and-text-from-over-a-thousand-different-file-types/1828)

<div class="topic-metadata">

**Author:** [@duncan](https://discuss.kakoune.com/u/duncan)\
**Replies:** 0\
**Last updated:** [August 10, 2021, 3:33pm UTC](https://discuss.kakoune.com/t/apache-tika-extracts-metadata-and-text-from-over-a-thousand-different-file-types/1828 "2021-08-10T15:33:49Z")

</div>

The Apache Tika™ toolkit detects and extracts metadata and text from over a thousand different file types… https://tika.apache.org/ # OPTIONAL WAY TO INSTALL # # list almost all your dependencies. $ jdeps --list-deps …

---

## [How do you wrap text (via a highlighter) without preceding spaces?](https://discuss.kakoune.com/t/how-do-you-wrap-text-via-a-highlighter-without-preceding-spaces/1745)

<div class="topic-metadata">

**Author:** [@pendingcircumference](https://discuss.kakoune.com/u/pendingcircumference)\
**Replies:** 3\
**Last updated:** [May 29, 2021, 2:27am UTC](https://discuss.kakoune.com/t/how-do-you-wrap-text-via-a-highlighter-without-preceding-spaces/1745 "2021-05-29T02:27:14Z")

</div>

When I’m working with plaintext files I frequently have long lines that I’d like to be visually wrapped. For this I do something like the following: add-highlighter buffer/ wrap -word -width 50 However, that frequently…

---

## [GNU coreutils: fmt - simple optimal text formatter](https://discuss.kakoune.com/t/gnu-coreutils-fmt-simple-optimal-text-formatter/1679)

<div class="topic-metadata">

**Author:** [@duncan](https://discuss.kakoune.com/u/duncan)\
**Replies:** 0\
**Last updated:** [April 11, 2021, 9:11am UTC](https://discuss.kakoune.com/t/gnu-coreutils-fmt-simple-optimal-text-formatter/1679 "2021-04-11T09:11:40Z")

</div>

declare-user-mode fmt map global user 'F' ': enter-user-mode\<space\>fmt\<ret\>' -docstring "fmt - simple optimal text formatter" map global fmt 'a' '| fmt --split-only --uniform-spacing --width=102\<ret\>' -d…

---

## [Rich’s sh (POSIX shell) tricks; the ‘\\n’ character, string in a shell-quoted form, and more](https://discuss.kakoune.com/t/rich-s-sh-posix-shell-tricks-the-n-character-string-in-a-shell-quoted-form-and-more/1636)

<div class="topic-metadata">

**Author:** [@duncan](https://discuss.kakoune.com/u/duncan)\
**Replies:** 0\
**Last updated:** [March 19, 2021, 7:48am UTC](https://discuss.kakoune.com/t/rich-s-sh-posix-shell-tricks-the-n-character-string-in-a-shell-quoted-form-and-more/1636 "2021-03-19T07:48:22Z")

</div>

While www link diving I found this great single page which mayn’t solve a community discussion problem on the shell removing the ‘\\n’ character. Rich’s sh (POSIX shell) tricks https://www.etalabs.net/sh\_tricks.html Sec…

---

## [What is the "right" way to do \`:format\` on write?](https://discuss.kakoune.com/t/what-is-the-right-way-to-do-format-on-write/922)

<div class="topic-metadata">

**Author:** [@brianhicks](https://discuss.kakoune.com/u/brianhicks)\
**Replies:** 4\
**Last updated:** [February 19, 2021, 9:11am UTC](https://discuss.kakoune.com/t/what-is-the-right-way-to-do-format-on-write/922 "2021-02-19T09:11:56Z")

</div>

currently I have something along the lines of hook buffer BufWritePre .\* { format } in my config. I’d like to extend this to only write format if formatcmd is set. How would I do this? Or, am I missing something that k…

---

## [Indentation of Kakoune code: add a clang-format](https://discuss.kakoune.com/t/indentation-of-kakoune-code-add-a-clang-format/1384)

<div class="topic-metadata">

**Author:** [@CharlesGueunet](https://discuss.kakoune.com/u/CharlesGueunet)\
**Replies:** 4\
**Last updated:** [November 26, 2020, 10:26am UTC](https://discuss.kakoune.com/t/indentation-of-kakoune-code-add-a-clang-format/1384 "2020-11-26T10:26:35Z")

</div>

Hello Kakoune devs, I was trying to change some little stuff in the kakoune code base to get acquainted with it and so I noticed there is no .clang-format file given in the repo. How do we handle the indentation of the…

---

## [Move lines below further downward when the completion menu is displayed?](https://discuss.kakoune.com/t/move-lines-below-further-downward-when-the-completion-menu-is-displayed/1159)

<div class="topic-metadata">

**Author:** [@ldld](https://discuss.kakoune.com/u/ldld)\
**Replies:** 1\
**Last updated:** [July 23, 2020, 5:37pm UTC](https://discuss.kakoune.com/t/move-lines-below-further-downward-when-the-completion-menu-is-displayed/1159 "2020-07-23T17:37:03Z")

</div>

When using the very nice auto-completion I realized why auto-completion can sometimes feel like a hindrance – it covers the lines below and often I want to stare at (rather than remember) the information in the context l…

---

## [Smarter replacement for coreutils' fmt](https://discuss.kakoune.com/t/smarter-replacement-for-coreutils-fmt/1152)

<div class="topic-metadata">

**Author:** [@dmerejkowsky](https://discuss.kakoune.com/u/dmerejkowsky)\
**Replies:** 2\
**Last updated:** [July 20, 2020, 6:33pm UTC](https://discuss.kakoune.com/t/smarter-replacement-for-coreutils-fmt/1152 "2020-07-20T18:33:27Z")

</div>

The wrapping section of the wiki recommends using fmt from coreutils to format paragraphs, which works fine but fails to properly indent text such as Doxygen comments unless you specify the correct --prefix option someho…

---

## [Some things a bit better (formatting, linting, completion)](https://discuss.kakoune.com/t/some-things-a-bit-better-formatting-linting-completion/1019)

<div class="topic-metadata">

**Author:** [@The-BigDaddy](https://discuss.kakoune.com/u/The-BigDaddy)\
**Replies:** 9\
**Last updated:** [May 27, 2020, 11:23am UTC](https://discuss.kakoune.com/t/some-things-a-bit-better-formatting-linting-completion/1019 "2020-05-27T11:23:40Z")

</div>

Hey all, So, to cut to the chase: Lint and Format only on save always I don’t really know how linting in Kakoune works, but my first assumption is that once linting is enabled in a buffer, it’s always on. I persona…

---

## [As part of a) kakoune or user implemented b) script.kak? Viewing code files without document string markup in a declared mode](https://discuss.kakoune.com/t/as-part-of-a-kakoune-or-user-implemented-b-script-kak-viewing-code-files-without-document-string-markup-in-a-declared-mode/975)

<div class="topic-metadata">

**Author:** [@duncan](https://discuss.kakoune.com/u/duncan)\
**Replies:** 2\
**Last updated:** [May 26, 2020, 4:03pm UTC](https://discuss.kakoune.com/t/as-part-of-a-kakoune-or-user-implemented-b-script-kak-viewing-code-files-without-document-string-markup-in-a-declared-mode/975 "2020-05-26T16:03:12Z")

</div>

Is this just a single person use-case (me) or have wider merit? As part of: a) kakoune or user implemented b) script.kak I thought I would ask you guys before going down the ‘Feature Request’ path, as I have never…

---

## [What are people using to format html and html template files?](https://discuss.kakoune.com/t/what-are-people-using-to-format-html-and-html-template-files/1009)

<div class="topic-metadata">

**Author:** [@ecallen](https://discuss.kakoune.com/u/ecallen)\
**Replies:** 0\
**Last updated:** [May 10, 2020, 3:16am UTC](https://discuss.kakoune.com/t/what-are-people-using-to-format-html-and-html-template-files/1009 "2020-05-10T03:16:26Z")

</div>

As far as I can tell lsp wont format golang html template files and tidy does not work for them. What are some alternatives?

---

## [Counterpart of Emacs indent-new-comment-line](https://discuss.kakoune.com/t/counterpart-of-emacs-indent-new-comment-line/613)

<div class="topic-metadata">

**Author:** [@nonumeros](https://discuss.kakoune.com/u/nonumeros)\
**Replies:** 0\
**Last updated:** [June 8, 2019, 4:14am UTC](https://discuss.kakoune.com/t/counterpart-of-emacs-indent-new-comment-line/613 "2019-06-08T04:14:41Z")

</div>

Hello. Is there such a feature as in Emacs. Meta-J Alt-J ? At one time I had it swapped because of a different keyboard. Is there such a feature as Alt-J though? edit I should have been more explicit. What I shoul…

---

## [Kak's formatcmd implementation for ktlint in kotlin.kak language support](https://discuss.kakoune.com/t/kaks-formatcmd-implementation-for-ktlint-in-kotlin-kak-language-support/471)

<div class="topic-metadata">

**Author:** [@duncan](https://discuss.kakoune.com/u/duncan)\
**Replies:** 0\
**Last updated:** [April 20, 2019, 3:55pm UTC](https://discuss.kakoune.com/t/kaks-formatcmd-implementation-for-ktlint-in-kotlin-kak-language-support/471 "2019-04-20T15:55:33Z")

</div>

Update: Currently I do not have the time to work on this issue will come back to it in a couple of months and restructure this help request with a little more information and accuracy. Hi all, I’m implementing ktlint f…

---

## [Dealing with 2 space codebase](https://discuss.kakoune.com/t/dealing-with-2-space-codebase/713)

<div class="topic-metadata">

**Author:** [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Replies:** 9\
**Last updated:** [September 30, 2019, 5:43am UTC](https://discuss.kakoune.com/t/dealing-with-2-space-codebase/713 "2019-09-30T05:43:03Z")

</div>

I like more pronounced indents, this codebase I am working in (typescript) is two space indents, and I am trying to find the best way to handle it. I have some hacky 2 space to real tab then back on save – but it is won…

---

## [LSP formatting for Rust](https://discuss.kakoune.com/t/lsp-formatting-for-rust/697)

<div class="topic-metadata">

**Author:** [@cmusser](https://discuss.kakoune.com/u/cmusser)\
**Replies:** 5\
**Last updated:** [September 8, 2019, 7:35pm UTC](https://discuss.kakoune.com/t/lsp-formatting-for-rust/697 "2019-09-08T19:35:41Z")

</div>

I am a new Kakoune user starting to use the kak-lsp plugin for working with Rust. The lsp-formatting command has an indent width of 8 spaces, but I’m more used to 4 (I’m coming from emacs, where the indentation engine ha…

---

## [Fix indentation of region](https://discuss.kakoune.com/t/fix-indentation-of-region/387)

<div class="topic-metadata">

**Author:** [@ericricky](https://discuss.kakoune.com/u/ericricky)\
**Replies:** 3\
**Last updated:** [March 22, 2019, 2:33pm UTC](https://discuss.kakoune.com/t/fix-indentation-of-region/387 "2019-03-22T14:33:22Z")

</div>

Is there a way to fix the indentation of multiline selections in Kakoune? In Emacs, hitting tab while a region is selected does this, and it looks like Vim has =. If this isn’t built into Kakoune, is there a command line…

---

## [Rewrap text (e.g. after writing and switching on autowrap after the fact, or if editing a paragraph)](https://discuss.kakoune.com/t/rewrap-text-e-g-after-writing-and-switching-on-autowrap-after-the-fact-or-if-editing-a-paragraph/289)

<div class="topic-metadata">

**Author:** [@EpocSquadron](https://discuss.kakoune.com/u/EpocSquadron)\
**Replies:** 15\
**Last updated:** [January 28, 2019, 8:45pm UTC](https://discuss.kakoune.com/t/rewrap-text-e-g-after-writing-and-switching-on-autowrap-after-the-fact-or-if-editing-a-paragraph/289 "2019-01-28T20:45:50Z")

</div>

Is there a simple command to rewrap a selection similar to how one does gq\<motion\> in vim? I find myself clumsily reflowing edited paragraphs by hand and I’m not sure I want to set autowrap-enable on certain filetypes.

---

## [Format specific selected lines](https://discuss.kakoune.com/t/format-specific-selected-lines/284)

<div class="topic-metadata">

**Author:** [@lauccode](https://discuss.kakoune.com/u/lauccode)\
**Replies:** 2\
**Last updated:** [January 24, 2019, 6:55pm UTC](https://discuss.kakoune.com/t/format-specific-selected-lines/284 "2019-01-24T18:55:06Z")

</div>

I added those lines in kakrc. And it is working, but it is formating all the file : hook global WinSetOption filetype=c %{ set window formatcmd ‘clang-format’ } map global normal = :format\<ret\> -docstring ‘format bu…

---

## [How can I set the indentwidth option for certain file types?](https://discuss.kakoune.com/t/how-can-i-set-the-indentwidth-option-for-certain-file-types/241)

<div class="topic-metadata">

**Author:** [@jbrains](https://discuss.kakoune.com/u/jbrains)\
**Replies:** 7\
**Last updated:** [December 20, 2018, 9:07pm UTC](https://discuss.kakoune.com/t/how-can-i-set-the-indentwidth-option-for-certain-file-types/241 "2018-12-20T21:07:10Z")

</div>

I like my default indentation width at 2, but sometimes I want 4, depending on the file type. Can I set the indentwidth option for all files of a given type?

---

## [How to use a tab of width 8?](https://discuss.kakoune.com/t/how-to-use-a-tab-of-width-8/201)

<div class="topic-metadata">

**Author:** [@SegFault](https://discuss.kakoune.com/u/SegFault)\
**Replies:** 5\
**Last updated:** [November 28, 2018, 8:07pm UTC](https://discuss.kakoune.com/t/how-to-use-a-tab-of-width-8/201 "2018-11-28T20:07:54Z")

</div>

New Kak user here. Please forgive if this question is very trivial but I cannot seem to get my tabs to be of width 8. And also how can I get autoindenting?
