[sublime] The best Packages to speed up you workflow and make life awesome!

Written by  Sunday, 15 October 2017 20:22

Serious, You gotta get these!

Emmet

Sublime ->  Command + Shift + P -> Install Paskages -> Emmet

Emmet Documentation

Child: >

You can use > operator to nest elements inside each other:

div>ul>li

..will produce

<div>
    <ul>
        <li></li>
    </ul>
</div>

Sibling: +

Use + operator to place elements near each other, on the same level:

div+p+bq

...will output

<div></div>
<p></p>
<blockquote></blockquote>

Climb-up: ^

With > operator you’re descending down the generated tree and positions of all sibling elements will be resolved against the most deepest element:

div+div>p>span+em 

...will be expanded to

<div></div>
<div>
    <p><span></span><em></em></p>
</div>

 With ^ operator, you can climb one level up the tree and change context where following elements should appear:

div+div>p>span+em^bq

 ...outputs to

<div></div>
<div>
    <p><span></span><em></em></p>
    <blockquote></blockquote>
</div>

 You can use as many ^ operators as you like, each operator will move one level up:

div+div>p>span+em^^^bq

 ...will output to

<div></div>
<div>
    <p><span></span><em></em></p>
</div>
<blockquote></blockquote>

Multiplication: *

With * operator you can define how many times element should be outputted:

ul>li*5

...outputs to

<ul>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>

Grouping: ()

Parenthesises are used by Emmets’ power users for grouping subtrees in complex abbreviations:

div>(header>ul>li*2>a)+footer>p

...expands to

<div>
    <header>
        <ul>
            <li><a href="/"></a></li>
            <li><a href="/"></a></li>
        </ul>
    </header>
    <footer>
        <p></p>
    </footer>
</div>

If you’re working with browser’s DOM, you may think of groups as Document Fragments: each group contains abbreviation subtree and all the following elements are inserted at the same level as the first element of group.

You can nest groups inside each other and combine them with multiplication * operator:

(div>dl>(dt+dd)*3)+footer>p

...produces

<div>
    <dl>
        <dt></dt>
        <dd></dd>
        <dt></dt>
        <dd></dd>
        <dt></dt>
        <dd></dd>
    </dl>
</div>
<footer>
    <p></p>
</footer>

With groups, you can literally write full page mark-up with a single abbreviation, but please don’t do that.

Attribute operators

Attribute operators are used to modify attributes of outputted elements. For example, in HTML and XML you can quickly add class attribute to generated element.

ID and CLASS

In CSS, you use elem#id and elem.class notation to reach the elements with specified id or class attributes. In Emmet, you can use the very same syntax to add these attributes to specified element:

div#header+div.page+div#footer.class1.class2.class3

...will output

<div id="header"></div>
<div class="page"></div>
<div id="footer" class="class1 class2 class3"></div>

Custom attributes

You can use [attr] notation (as in CSS) to add custom attributes to your element:

td[title="Hello world!" colspan=3]

...outputs

<td title="Hello world!" colspan="3"></td>
  • You can place as many attributes as you like inside square brackets.
  • You don’t have to specify attribute values: td[colspan title] will produce <td colspan="" title=""> with tabstops inside each empty attribute (if your editor supports them).
  • You can use single or double quotes for quoting attribute values.
  • You don’t need to quote values if they don’t contain spaces: td[title=hello colspan=3] will work.

Item numbering: $

With multiplication * operator you can repeat elements, but with $ you can number them. Place $ operator inside element’s name, attribute’s name or attribute’s value to output current number of repeated element:

ul>li.item$*5

...outputs to

<ul>
    <li class="item1"></li>
    <li class="item2"></li>
    <li class="item3"></li>
    <li class="item4"></li>
    <li class="item5"></li>
</ul>

You can use multiple $ in a row to pad number with zeroes:

ul>li.item$$$*5

...outputs to

<ul>
    <li class="item001"></li>
    <li class="item002"></li>
    <li class="item003"></li>
    <li class="item004"></li>
    <li class="item005"></li>
</ul>

Changing numbering base and direction

With @ modifier, you can change numbering direction (ascending or descending) and base (e.g. start value).

For example, to change direction, add @- after $:

ul>li.item$@-*5

…outputs to

<ul>
    <li class="item5"></li>
    <li class="item4"></li>
    <li class="item3"></li>
    <li class="item2"></li>
    <li class="item1"></li>
</ul>

To change counter base value, add @N modifier to $:

ul>li.item$@3*5

…transforms to

<ul>
    <li class="item3"></li>
    <li class="item4"></li>
    <li class="item5"></li>
    <li class="item6"></li>
    <li class="item7"></li>
</ul>

You can use these modifiers together:

ul>li.item$@-3*5

…is transformed to

<ul>
    <li class="item7"></li>
    <li class="item6"></li>
    <li class="item5"></li>
    <li class="item4"></li>
    <li class="item3"></li>
</ul>

Text: {}

You can use curly braces to add text to element:

a{Click me}

...will produce

<a href="/">Click me</a>

Note that {text} is used and parsed as a separate element (like, div, p etc.) but has a special meaning when written right after element. For example, a{click} and a>{click} will produce the same output, but a{click}+b{here} and a>{click}+b{here} won’t:

<!-- a{click}+b{here} -->
<a href="/">click</a><b>here</b>

<!-- a>{click}+b{here} -->
<a href="/">click<b>here</b></a>

In second example the <b> element is placed inside <a> element. And that’s the difference: when {text} is written right after element, it doesn’t change parent context. Here’s more complex example showing why it is important:

p>{Click }+a{here}+{ to continue}

...produces

<p>Click <a href="/">here</a> to continue</p>

 In this example, to write Click here to continue inside <p> element we have explicitly move down the tree with > operator after p, but in case of a element we don’t have to, since we need <a> element with here word only, without changing parent context.

For comparison, here’s the same abbreviation written without child > operator:

p{Click }+a{here}+{ to continue}

...produces

<p>Click </p> <a href="/">here</a> to continue

Notes on abbreviation formatting

When you get familiar with Emmet’s abbreviations syntax, you may want to use some formatting to make your abbreviations more readable. For example, use spaces between elements and operators, like this:

(header > ul.nav > li*5) + footer

 But it won’t work, because space is a stop symbol where Emmet stops abbreviation parsing.

Many users mistakenly think that each abbreviation should be written in a new line, but they are wrong: you can type and expand abbreviation anywhere in the text:

 

Origami

screen shot 2017 10 15 at 22.22.46 a260d

Origami is an awesome Sublime Text plugin that lets you conveniently configure your panel layout using shortcut keys. Origami is a new way of thinking about panes in Sublime Text 2 and 3: you tell Sublime Text where you want a new pane, and it makes one for you. It works seamlessly alongside the built-in layout commands.

Ordinarily one uses the commands under View>Layout, or if one is quite intrepid a custom keyboard shortcut can be made to give a specific layout, but both of these solutions were unsatisfactory to me. Perhaps they were to you too! That's what this plugin is for.

Try it out! I think you'll like it.

Keyboard shortcuts Origami

Origami is driven by keyboard shortcuts. By default, these keyboard shortcuts are all two-stage, and are hidden behind command+k. First press command+k, then press the arrow keys with modifiers:

  • no modifiers: travel to an adjacent pane
  • shift: carry the current file to the destination
  • alt (option): clone the current file to the destination
  • command: create an adjacent pane
  • command+shift: destroy an adjacent pane

These keyboard shortcuts are designed to make it really easy to modify the layout of your editor.

Additionally, Origami allows one to zoom the current pane, making it take up a large portion of the window. As above, first press command+k, then press:

  • command+z: Zoom the current pane so it takes up 90% of the screen (the fraction is changeable in the keybindings)
  • shift+command+z: Unzoom: equally space all panes

It is also possible to edit the pane sizes. After command+k press:

  • command+r: Adjust the top and bottom separator
  • command+c: Adjust the left and right separator

In the keybindings you can change a mode which specifies which separation lines you want to edit.

  • ALL means all horizontal (or vertical) separators
  • RELEVANT means all horizontal (or vertical) separators which intersect the column (row) of the selected row.
  • NEAREST means top and bottom (or left and right) separators. This is the default mode.
  • BEFORE means top (or left) separator
  • AFTER means bottom (or right) separator

(Note: Windows and Linux use ctrl instead of command.)

 

AutoFileName: Autocomplete Filenames in Sublime Text

Do you ever find yourself sifting through folders in the sidebar trying to remember what you named that file? Can't remember if it was a jpg or a png? Maybe you just wish you could type filenames faster. No more.

Whether your making a img tag in html, setting a background image in css, or linking a .js file to your html (or whatever else people use filename paths for these days...), you can now autocomplete the filename. Plus, it uses the built-in autocomplete, so no need to learn another pesky shortcut.

 

Color Highlighter

ColorHighlighter is a plugin for the Sublime Text 2 and 3, which unobtrusively previews color values by underlaying the selected hex codes in different styles, coloring text or gutter icons. Also, plugin adds color picker, color format converter to easily modify colors.

Description

For more info about the plugin visit https://github.com/Monnoroch/ColorHighlighter

 

215 Read Last modified on Monday, 16 October 2017

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.

Related items

  • Launch Sublime Text 3 from the command line & simlink to Subl
    in Mac

    These instructions assume you’re using the Terminal app out of the box, without ZSH or any fancy prompts like that. I trust you will be able to adapt these instructions yourself if you do.

    Step 1 : Create a symlink called sublime

    sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime

    Step 2 : Check that your system profile can find the symlink you just created.

    open ~/.bash_profile

    Step 3 : Add both these lines & then save the file :

    alias subl="open -a /Applications/Sublime\ Text.app"
    
    export PATH=/usr/local/bin:$PATH

    Step 4 : Reload your bash_profile :

    source ~/.bash_profile

    Done ! You can now navigate to any of your code/script folders in Terminal and open them in Sublime with the following commands :

    subl .
    subl .zshrc
  • [solved] How to configurate aliases in Sublime Text

    Use Terminal and run commands

    subl ~/.zshrc

    then we can add commands:

    # In line 88 change aliases text:
    # Example aliases 
    # alias zshconfig="mate ~/.zshrc"
    # alias ohmyzsh="mate ~/.oh-my-zsh"
    alias db="cd ~/Dropbox/"
    alias doc="cd ~/Documents/"
    alias zs="subl ~/.zshrc"
    alias gum="git pull upstream master"

     Profit!

  • [solved] How To Open Sublime Text from Terminal in macOS

    Solution : At first , run following script on Terminal app to create specific symlink.

    ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

    Then,

    subl .

     Hit return, it should instantly pop-up Sublime app.

  • Setting up Sublime Text for Angular Development
    in JS

    The first you need root on your Mac → Terminal sudo su and confirm password. Then you need setup iTerm2 and Homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" and any plugins for angular.

    -- commands sh#
    brew install git
    gitk
    npm install -g jshint
    npm install -g gulp

    -- setup snippets and plugins

    https://github.com/johnpapa/angular-styleguide#file-templates-and-snippets 
    https://github.com/angular-ui/AngularJS-sublime-package
    https://github.com/NicoSantangelo/sublime-gulp