Lev Goncharov

Infrastructure simplifying engineer

View My GitHub Profile

How to prepare sublime

Date: 2018-09-21

It’s better configure VS Code because sublime plugins for ansible is out of date.

Download sublime text 3

Package Control

please visit packagecontrol.io:

import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

plugin install

plugin remove

sublime linter

sublime Jinja2

sublime rubocop

style guide

for mac os or linux

sudo gem install rubocop

for windows

gem install rubocop --http-proxy=http://some.proxy.example.com:3128

sublime shellcheck

https://github.com/koalaman/shellcheck

sublime yaml lint

gem install yaml-lint

sublime applysyntax

it is needed for ansible lint

Sublime Text -> Preferences -> Package Settings -> ApplySyntax -> Settings - User
    "syntaxes": [{
        "name": "Ansible/Ansible",
        "rules": [
          {"file_name": ".*/tasks/.*.yml$"},
          {"file_name": ".*/handler/.*.yml$"},
          {"file_name": ".*/*_vars/.*.yml$"},
          {"file_name": ".*/roles/.*.yml$"},
          {"file_name": ".*/playbooks/.*.yml$"},
          {"file_name": ".*/.*ansible.*/.*.yml$"},
          {"file_name": ".*/.*explotation.*/.*.yml$"},
          {"file_name": ".*/.*provision.*/.*.yml$"}
        ]
      }]

sublime yaml

install yaml lint

pip install yamllint --proxy http://some.proxy.example.com:3128

sublime ansible

https://github.com/mliljedahl/SublimeLinter-contrib-ansible-lint

pip install ansible-lint --proxy http://some.proxy.example.com:3128

sublime pylint

install pylint

pip install pylint --proxy http://some.proxy.example.com:3128

Spell checking

By default Sublime text has only EN dictionary. For other languages you need dictionaries. You can download it here

Press F6 for enable/disable spell checking

Markdown в Sublime

Sublime text 3 has it by default. however I advise to improve it.

MarkdownEditing

MarkdownEditing

{
    "word_wrap": true,
    "wrap_width": 120,
    "color_scheme": "Packages/MarkdownEditing/MarkdownEditor.tmTheme"
}

sublime settings

{
  "color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
  "default_encoding": "UTF-8",
  "default_line_ending": "unix",
  "dictionary": "Packages/Russian-English Bilingual.dic",
  "ensure_newline_at_eof_on_save": true,
  "font_size": 11,
  "ignored_packages":
  [
    "Markdown",
    "SublimeLinter-pyyaml",
    "Vintage"
  ],
  "rulers":
  [
    80
  ],
  "spell_check": true,
  "tab_size": 2,
  "translate_tabs_to_spaces": true,
  "trim_trailing_white_space_on_save": true,
  "word_wrap": "true"
}

Hints

Table Editor

Table Editor

Markdown preview

Markdown Preview

SublimeLinter-annotations

WSL Integration

  1. Enable WSL Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux .
  2. Checkout repo .
  3. Add the helpers dir from the repo to the PATH variable.
  4. Run sudo install_me.sh from the repo inside WSL.