pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: https://zed.dev/docs/ai/./../languages/../languages/../development/../extensions/../modelines.html

e="description" content="Learn how to use and customize Zed, the fast, collaborative code editor. Official docs on features, configuration, AI tools, and workflows.">
Download

Modelines

Modelines are special comments at the beginning or end of a file that configure editor settings for that specific file. Zed supports both Vim and Emacs modeline formats, allowing you to specify settings like tab size, indentation style, and file type directly within your files.

Configuration

Use the modeline_lines setting to control how many lines Zed searches for modelines:

{
  "modeline_lines": 5
}

Set to 0 to disable modeline parsing entirely.

Emacs

Zed has some compatibility support for Emacs file variables.

Example:

# -*- mode: python; tab-width: 4; indent-tabs-mode: nil; -*-

Supported Emacs Variables

VariableDescriptionZed Setting
modeMajor mode/languageLanguage detection
tab-widthTab display widthtab_size
fill-columnLine wrap columnpreferred_line_length
indent-tabs-modenil for spaces, t for tabshard_tabs
electric-indent-modeAuto-indentationauto_indent
require-final-newlineEnsure final newlineensure_final_newline_on_save
show-trailing-whitespaceShow trailing whitespaceshow_whitespaces

Vim

Zed has some compatibility support for Vim modeline.

Example:

# vim: set ft=python ts=4 sw=4 et:

Supported Vim Options

OptionAliasesDescriptionZed Setting
filetypeftFile type/languageLanguage detection
tabstoptsNumber of spaces a tab counts fortab_size
textwidthtwMaximum line widthpreferred_line_length
expandtabetUse spaces instead of tabshard_tabs
noexpandtabnoetUse tabs instead of spaceshard_tabs
autoindentaiEnable auto-indentationauto_indent
noautoindentnoaiDisable auto-indentationauto_indent
endoflineeolEnsure final newlineensure_final_newline_on_save
noendoflinenoeolDisable final newlineensure_final_newline_on_save

Notes

  • The first kilobyte of a file is searched for modelines.
  • Emacs modelines take precedence over Vim modelines when both are present.
  • Modelines in the first few lines take precedence over those at the end of the file.
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy