• Packages
  • Themes
  • Documentation
  • Blog
  • Discuss
Sign in

vim-modeline

Enable Vim-style modeline in Atom.
  • #vim
  • #format
  • #code
  • #style
  • #code-style
fkfk
0.5.2 9,043
14
  • Repo
  • Bugs
  • Versions
  • License
Flag as spam or malicious

vim-modeline package

Enable Vim-style modeline in Atom.

Supported options

  • expandtab / noexpandtab
  • fileencoding
  • fileformat
  • filetype
  • spell / nospell
  • tabstop

Example

Valid Vim-style modeline

# vim:set expandtab tabstop=2 fenc=utf-8 ff=unix ft=coffee:

Atom-specific modeline

# atom:set useSoftTabs tabLength=2 encoding=utf-8 lineEnding=lf grammar=coffee:

Atom-specific modeline

  • useSoftTabs -> expandtab
  • encoding -> fileencoding
  • lineEnding -> fileformat
  • grammar -> filetype
  • tabLength -> tabstop

Configuring filetype

You can add more filetype for a given language scope. To do this, add the settings to the ~/.atom/config.cson in the format below.

'vim-modeline-filetypes':
  # append scopeName
  'as': [
    'source.actionscript.3'
  ]
  # override scopeName
  'markdown': 'text.md'

vim-modeline Event Handler

This package can use the event handler using "Service API".

  • onDidParse
  • onDidSetLineEnding
  • onDidSetFileType
  • onDidSetEncoding
  • onDidSetSoftTabs
  • onDidSetTabLength

eg: get parse result in init.coffee.

atom.packages.serviceHub.consume "vim-modeline-event-handler", "^1.0.0", (handler) ->
  handler.onDidParse ({editor, options}) ->
    console.log editor
    console.log options
    someFunction(options)

Conflict issue

If you use auto-encoding package, file encoding doesn't match the modeline. If you want use vim-modeline parse result, please invoke 'vim-modeline:detect' command after open TextEditor.

TODO

  • [ ] softtabstop support
  • [ ] shiftwidth support

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.

  • Terms of Use
  • Privacy
  • Code of Conduct
  • Releases
  • FAQ
  • Contact
with by