Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>KV FormatterNew to Visual Studio Code? Get it now.
KV Formatter

KV Formatter

Hanspeter Flütsch

|
385 installs
| (0) | Free
Professional formatter for Kivy .kv files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

KV Formatter

IMPORTANT NOTICE
Canvas blocks (canvas.before, canvas.after) may cause formatting issues.
Place them at the end of widget definitions for best results.
Help via pull request is welcome!
Professional formatter for Kivy .kv files

Features

  • Automatic widget hierarchy detection
  • 4-space indentation
  • Idempotent formatting
  • Preserves comments and empty lines

Installation

From VSIX

  1. Download the latest release from Releases
  2. In VS Code: Ctrl+Shift+P → "Extensions: Install from VSIX..."
  3. Select the downloaded .vsix file

From Marketplace

  1. Open Extensions view (Ctrl+Shift+X)
  2. Search for "KV Formatter"
  3. Click Install

Usage

  1. Open a .kv file
  2. Position widgets at desired indentation levels
  3. Use Ctrl+Shift+Alt+K (Windows/Linux) or Cmd+Shift+Alt+K (Mac) to format, instead of the standard format command. there were configuration problems, but with the new shortcut it works just as well. You don't need to do anything else
  4. Formatting preserves manual widget positions while auto-indenting properties

Example

#before formatting:

BoxLayout:                  # ← Position set
    Label:                  # → Position set
text: "Hello"               # → will be indented
#after formatting:
BoxLayout:                  # ← Position set
    Label:                  # → Position set
        text: "Hello"       # → indented

Golden Rules

  • Widgets define hierarchy: Place them where you want
  • Properties follow widgets: Automatic 4-space indentation
  • Comments stay intact: No unwanted changes

Troubleshooting

  • Problem: Incorrect indentation

  • Solution: Manually reposition the widget line

  • Problem: Formatting not applied

  • Solution: Ensure file has .kv extension

Contributing

Pull requests are welcome! For major changes, please open an issue first.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft