Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>ModelinesNew to Visual Studio Code? Get it now.

Modelines

Chris Lajoie

|
9,637 installs
| (5) | Free
Set editor options for individual files. Supports Vim and Emacs modelines plus a Code-specific modeline syntax.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Modelines

This extension adds the ability to set certain editor settings from "modelines". Modelines let you set certain editor settings on a per-file basis by adding a specially formatted comment near the top or bottom of the file. The settings only affect the file where the modeline appears. This extension supports Vim and Emacs modelines as well as a Code-specific syntax demonstrated below. The modeline(s) must appear somewhere in the first or last 5 lines of the file.

Here are a few examples demonstrating the different types of modelines supported. All of the examples below are equivelent.

# vim: set ft=js ts=4 sw=4 et:
# vim: ts=4:sw=4:et:ft=js
// -*- mode: js; indent-tabs-mode: nil; tab-width: 4 -*-
// code: language=javascript insertSpaces=true tabSize=4
  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft