Wrap Plus
Enhanced "wrap lines" command for Sublime Text 2 or 3.
Details
Installs
- Total 23K
- Win 8K
- Mac 10K
- Linux 6K
Nov 21 | Nov 20 | Nov 19 | Nov 18 | 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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 0 | 0 | 1 | 1 | 1 | 2 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 2 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
Mac | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 2 | 1 | 0 | 2 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 2 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 5 | 0 | 1 | 0 | 0 | 0 | 0 | 2 | 0 | 1 | 4 |
Linux | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 2 | 2 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Sublime Wrap Plus
Enhanced “wrap lines” command for Sublime Text 2 or 3. This is for the manual hard line wrap command (AltQ in Windows and Linux, CommandAltQ in OS X). It does not affect the automatic soft line wrapping.
Downloading
The best way to download and install Sublime Wrap Plus is to use the Package Control plugin. If you do not already have it installed, it's really the best way to manage your packages.
For users new to the package manager:
- Go to https://packagecontrol.io/installation and install Package Control.
- Restart Sublime Text.
Install Sublime Wrap Plus:
- Bring up the Command Palette (CommandShiftP on OS X, CtrlShiftP on Linux/Windows).
- Select
Package Control: Install Package
and wait while Package Control fetches the latest package list. - Select Wrap Plus when the list appears.
Package Control will handle automatically updating your packages.
Alternatively, you can fetch from Github:
git clone git://github.com/ehuss/Sublime-Wrap-Plus.git
and place it in your Packages directory, which can be found by selecting Preferences → Browse Packages...
.
Configuring
No need to configure anything. By default it uses the default keystroke for wrap lines:
- Windows/Linux: AltQ
- OS X: CommandAltQ
If you want to use a different keystroke, go to Preferences → Key Bindings — User
, and add an entry like this:
{ "keys": ["alt+q"], "command": "wrap_lines_plus" }
If you want to, you can add keystrokes that use specific wrap sizes:
{ "keys": ["alt+q", "7"], "command": "wrap_lines_plus", "args": {"width": 70}}
There are a few settings you can tweak if you so desire. You can set them in Preferences → Settings — User
. They are:
Name | Default | Description |
---|---|---|
"wrap_width" |
0 | The maximum line width. If 0, defaults to the first ruler, or 78. Also set via View → Word Wrap Column . |
"WrapPlus.wrap_width" |
If set, this will override Sublime’s "wrap_width" setting. You might want to use this if you have automatic soft word wrapping enabled, but want hard wraps at a different width.
|
|
"word_wrap" |
"auto" |
This disables horizontal scrolling (*soft* or *automatic* word wrapping). May be true , false , or "auto" where it will be disabled for source code. Also toggled via View → Word Wrap . |
"WrapPlus.break_long_words" |
false |
A single word that is longer than your wrap column will be forced to be break at the wrap column. |
"WrapPlus.break_on_hyphens" |
false |
Whether or not to break lines on hyphens. |
"WrapPlus.include_line_endings" |
"auto" |
Determines whether or not line endings are included in the line size:
|
Advanced Configuration
Sublime supports placing configuration options in a variety of places. You can put any of these settings in one of the following files (last file wins):
- Packages/User/Preferences.sublime-settings
- Project Settings (The “settings” key inside your project file.)
- Packages/User/SyntaxName.sublime-settings
- Packages/User/Distraction Free.sublime-settings
Using
Whenever the cursor is anywhere within a paragraph, hitting the Wrap Plus keystroke will cause it to try to discover where the paragraph starts and where it ends. It will then wrap all of those lines according to the wrap width you currently have set (View → Word Wrap Column
).
Lists
It handles a variety of lists, like bulleted lists or numbered lists. They should line up nicely:
- Kielbasa beef andouille chuck short loin, filet mignon jerky
tail fatback ball tip meatloaf sausage spare ribs bresaola
rump.
* Shankle shoulder ham, strip steak pastrami ground round shank
sausage tail corned beef drumstick boudin bacon prosciutto
turkey.
1. Jerky prosciutto pork loin shankle, corned beef capicola
pork pastrami fatback short loin ground round.
a. Sirloin fatback pancetta pork belly ham hock strip
steak chuck, drumstick brisket chicken corned
beef speck pig kielbasa short loin.
Subsequent Indents
Lines with subsequent indents should maintain their indent:
:param cupcake: Cupcake ipsum dolor sit amet marzipan faworki.
Wafer I love croissant. Tart carrot cake pastry applicake
lollipop I love cotton brownie.
Comment Lines
In a source code file, it should transparently handle single-line comment characters, like:
# Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
# Aenean commodo ligula eget dolor. Aenean massa. Cum sociis
# natoque penatibus et magnis dis parturient montes, nascetur
If you use block-style comments in C or C++, it will restrict the wrapping to only the contents in the comment (it won't jump out and wrap nearby code lines). Also, if you use funny C block comments that start with an asterisk, that should be preserved:
/*
* This is a multiline C-style comment. The asterisk characters on the
* left should be preserved (when in C or C++ mode), if they are already
* there.
*/
In addition, JavaDoc or JsDoc style documentation should work, too:
/**
* Sample function description. Just in case the description is very long.
* Cupcake ipsum dolor sit amet marzipan faworki. Wafer I love croissant. Tart
* carrot cake pastry applicake lollipop I love cotton brownie.
* @param {string} paramname Multi-line parameter description (or any javadoc
* tag) should indent with 4 spaces. Cupcake ipsum dolor sit amet
* marzipan faworki. Wafer I love croissant. Tart carrot cake pastry
* applicake lollipop I love cotton brownie.
*/
Python Strings
When wrapping inside a Python triple quoted string, wrapping will be constrained to the inside of the string. That way, doc strings won't get wrapped with function definitions:
def foo():
"""Pressing the wrap lines character while inside this string should wrap it
nicely, without affecting the def foo line.
"""
Email Quotes
Lines with email-style quoting should be handled. Nested quotes should be treated as separate paragraphs.
> This is a quoted paragraph.
> > This is a nested quoted paragraph. Wrapping the first paragraph won't
> > touch this paragraph.
> And continuing with a third paragraph.
Selection Wrapping
If you select a range of characters, only the lines that are selected will be wrapped (the stock Sublime wrap lines extends the selection to what it thinks is a paragraph). I find this behavior preferable to give me more control.
Epilogue
Wrap Plus handles a lot of situations that the stock Sublime word wrapper doesn't handle, but it's likely there are many situations where it doesn't work quite right. If you come across a problem, the immediate solution is to manually select the lines you want to wrap (this will constrain wrapping to just those lines). If you'd like, feel free to post an issue on the Github page.