ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

VAlign

by jarod2d ST2/ST3

Vertical alignment plugin for Sublime Text 2 and 3.

Details

  • 2018.03.06.20.07.55
  • github.​com
  • github.​com
  • 9 months ago
  • 20 minutes ago
  • 6 years ago

Installs

  • Total 22K
  • Win 10K
  • OS X 9K
  • Linux 4K
Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3
Windows 0 3 3 2 3 1 1 2 1 4 4 0 0 3 0 1 3 3 3 1 1 0 3 1 4 2 1 1 2 2 2 2 1 2 3 2 0 3 2 4 3 2 3 0 4 2
OS X 0 2 2 3 0 4 0 0 0 1 0 1 0 2 0 0 1 1 1 0 0 1 0 2 3 2 1 3 0 3 3 1 0 2 0 0 1 5 2 1 1 0 2 5 1 1
Linux 0 0 0 1 1 1 1 0 2 1 0 1 2 0 1 1 0 1 0 0 0 3 0 2 0 1 0 0 0 0 0 1 0 0 0 0 0 4 1 2 0 1 1 0 1 1

Readme

Source
raw.​githubusercontent.​com

Sublime VAlign

A plugin for Sublime Text 2 and 3 that adds a shortcut to easily vertically-align the text around the cursor. Just press Cmd+\ (Mac) or Ctrl+\ (Windows/Linux) and the code around you will align itself.

This plugin is originally based on wbond's Alignment plugin.

The primary feature that this plugin offers over Alignment is intelligent alignment based on context. With other plugins, you need to explicitly highlight the lines of code that you want to align. That's not necessary with VAlign – it will investigate the code surrounding the cursor and figure out which lines to align for you. This makes alignment very quick and simple.

Examples

From:

x = 10.0
y = 20.0
width = 100.0
height = 100.0

To:

x      = 10.0
y      = 20.0
width  = 100.0
height = 100.0

From:

rectangle =
    x: 10.0
    y: 20.0
    width: 100.0
    height: 100.0

To:

rectangle =
    x:      10.0
    y:      20.0
    width:  100.0
    height: 100.0

From:

.my-stylus-class
    width 100px
    height 100px
    margin-left 10px
    margin-right 10px
    padding 5px

To:

.my-stylus-class
    width        100px
    height       100px
    margin-left  10px
    margin-right 10px
    padding      5px

Installation

Installation is simple with the Sublime Package Control plugin. Just open the command palette, choose “Install Package” and search for “Valign”.

Usage

Press Cmd+\ (Mac) or Ctrl+\ (Windows/Linux) to align the code surrounding the cursor. The keyboard shortcut can be changed by adding the following to your user keybindings file, changing "ctrl+\\" to your shortcut of choice:

{ "keys": ["ctrl+\\"], "command": "valign" }

Changelog

v1.1.6

  • Added support for aligning by arbitrary strings and added a built-in rule to align by the word “from” (thanks GerritSommer!)
  • Fixed an issue with alignment involving the first line of the file (thanks davejamesmiller!)

v1.1.5

  • “var” prefixes are now only treated as an indent if the new setting “treat_var_as_indent” is true.

v1.1.4

  • Added support for aligning double equals, triple equals, and CoffeeScript ?=

v1.1.3

  • Added support for Sublime Text 3 by changing the way default preference values are loaded.

v1.1.2

  • Improved alignment support in JavaScript with “var” prefixes.

v1.1.1

  • Fixed a crash that happened when aligning lines at the end of a file.
  • Namespaced settings to avoid conflicts with other plugins.

v1.1.0

  • Alignment characters are now configurable.
  • Added support for prefixes.

v1.0.0

  • Initial release.

License

Copyright © 2012 Jarod Long

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.