kvs/STEmacsModelines

Example usage

rtalexander opened this issue · 3 comments

Hi,

Could someone please post a few examples of the various ways that mode lines can specifically be used with ST?

Thanks!

ST3/Lua. Set's syntax to "lua" and adds rulers at location 39, and 80
-- -*- mode: lua; sublime-rulers: [39, 80]; -*-

I use this for a system where Lua files must be saved with no extension (.lua) and prefers lines with only 39 characters.

rivy commented

Besides the built in coding, indent-tabs-mode, mode, and tab-width, any sublime text view setting can be set. You can find all of the possible settings in Prefences / Settings - Default. Prefix any of the sublime settings by st-, sublime-, sublime-text-, or sublimetext-.

NOTE: indent-tabs-mode: nil or indent-tabs-mode: 0 == st-translate_tabs_to_spaces: true.

Here are a couple of my current uses:

  1. For windows BAT files which must have DOS type line endings (CRLF):
    @:: (emacs/sublime) -*- mode: batch; coding: dos; -*-
  2. Similarly, for perl files wrapped into a windows BAT:
    @::#(emacs/sublime) -*- mode: perl; coding: dos; -*-
  3. For python files, I want all tabs to be actual spaces, no trailing whitespace, and I want to see whitespace at all times:
    #(emacs/sublime) -*- mode: python; tab-width: 4; indent-tabs-mode: nil; st-trim_trailing_white_space_on_save: true; st-draw_white_space: 'all'; -*-
  4. For particular TXT/MD files that I want to see in a more compressed markdown syntax, with spell check on:
    `
    [//]:<>( "(emacs/sublime) -- mode: markdown; tab-width: 2; sublime-spell_check: true; --" )
    ``

Hope that helps.

kvs commented

I've updated the README to include some of the stuff discussed here. Thanks everybody.