Giter Site home page Giter Site logo

autowrap's Introduction

Auto (Hard) Wrap for Sublime Text 2/3

test codecov

Automatic hard wrap beyond wrap width. It could be useful for text documents. Sublime-Wrap-Plus could be used together with AutoWrap for the best experience.

Installation

Package Control

Usage

To toggle Auto Wrap

Type Auto Wrap in command palette or Go to menu Edit -> Auto Wrap.

Control wrap width

Wrap width is detected in the following order

  1. auto_wrap_width
  2. wrap_width
  3. rulers
  4. default 80

Settings

To activate Auto Wrap for a specific syntax at start up

Put the following in your syntax specific preference.
Menu -> Preference -> Settings - More -> Syntax Specific - User

{
    "auto_wrap" : true
}

You can also change auto_wrap_width by

{
    "auto_wrap_width" : 100
}

Long words

In default, long word will break into a new line. To disable this behavior, consider

{
    "auto_wrap_break_long_word" : false
}

Break beyond wrap width only

If true, long sentence will break only if the cursor is beyond wrap width.

{
    "auto_wrap_beyond_only" : true
}

Break patterns

Upon typing, AutoWrap searches for these characters (in regex, to be concatenate by |) and a line would break at (right before) a matched location. Note that Backslash has to be double escaped.

{
    # it is the default
    "auto_wrap_break_patterns" :  ["\\[", "\\(", "\\{", " ", "\\n"]
}

autowrap's People

Contributors

marcantonio avatar randy3k avatar randybot avatar shafinkhadem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

autowrap's Issues

Request: Support auto-commenting for wraps in comments

When using the manual Alt + Command + Q method, Sublime Text automatically detects if the line is in a comment, and inserts the appropriate comment prefix at the start of any wrapped lines. Is this possible to from a plugin as well?

The new line isn't indented properly

When typing a comment like this:

    # Make sure the HTTP response code is always 200. Codes should be sent by

And typing outside the wrap column, the result is this:

    # Make sure the HTTP response code is always 200. Codes should be sent by
# the JSON response.

One would expect the result to be this:

    # Make sure the HTTP response code is always 200. Codes should be sent by
    # the JSON response.

And indeed, if one uses Alt+q to do the indentation rather than this plugin, the latter is the case.

Wrapping pasted content

Is it possible to auto-wrap pasted content? I can't see how to do it. I was thinking this plugin wasn't working because I was trying to paste in a long sentence and see if it wrapped.

[Bug] Python PEP8 Autoformat conflict

1. Summary

AutoWrap don't work for me, if I enable Python PEP8 Autoformat package.

2. Expected behavior

AutoWrap

3. Actual behavior

Words don't wrap to new line if Python PEP8 Autoformat enable.

4. Settings

I use PythonImproved syntax for Python files. My User\PythonImproved.sublime-settings file:

{
    "auto_wrap": true,
    "auto_wrap_width" : 80,
    "auto_wrap_break_long_word" : true,
    "extensions":
    [
        "py"
    ],
    "translate_tabs_to_spaces": true
}

5. Steps to reproduce

I reproduce the problem in a version of Sublime Text without plugins and user settings.

I want to wrap docstrings in py files. I open any py file → I write long docstring → I get actual behavior. I disable Python PEP8 Autoformat → I restart Sublime Text → I reopen Python file → I get expected behavior.

6. Environment

Operating system and version:
Windows 10 Enterprise LTSB 64-bit EN
Sublime Text:
Build 3126

Thanks.

Wrap selected text

If I toggle auto wrap to true while I have some text selected, it should auto wrap.

Enable AutoWrap for certain file types

Hello,

first of all: Thanks for the Great Plugin. It' s exactly what i was looking for writing Markdown documents with Sublime Text. A feature proposal of mine would be if AutoWrap gets enabled automaticly for certain file types (e.g. Markdown, Text, rst).

Greetings

Add an option for automatic line hard wrap when editing a line in the middle

Currently when editing a long line in the middle for example like so:

wooooooooooord added stuff woooooooooooooord

the line will not auto hard wrap. This is different for example from auto hard wrap in eclipse, or auto soft wrap behavior ST. In other words currently auto hard wrap does not behave like physically fixing text width (like for instance in this window).

Inline markdown links are broken (in both senses)

If I have an inline markdown link such as [link text](https://github.com), and it's near the end of a line, I can end up with:

[link text]
(https://github.com)

This won't render as a link in most markdown renderers. I don't want to simply drop ( from the list of breaking characters, but I don't really know how you'd solve this without having per-syntax exceptions.

(This could be a bug in Wrap Plus too, which I'm also using. See their issue #57.)

Long word doesn't break to the next line

If a single word crosses the ruler boundaries and then Space is pressed and text continues, the long word doesn't switch to the new line, it stays in place divided by the ruler and only the next word breaks into a new line. Shouldn't it follow the manual Wrap Paragraph at Ruler, here?

Better readability for markdown

Great tool!

Sorry, I'm not a dev, but I would suggest better readability for markdown on the future releases, if possible...

For example, emphasis break with broken line.

This will break italic:
Repete (Number of repeats allowed for quiz): *se resposta à dúvida for sim 2, se não 1. Dúvida: tem como [breakline here] mostrar a resposta apenas após a última tentativa?*

But if the tool would close the empahsis in the line break (like it does with comments) it would work great to maintain readability:
Repete (Number of repeats allowed for quiz): *se resposta à dúvida for sim 2, se não 1. Dúvida: tem como* [breakline here] *mostrar a resposta apenas após a última tentativa?*

Thanks!

[Bug] Wrap words to SublimeREPL input lines

1. Summary

If AutoWrap enable for me, symbols wrap to new Python SublimeREPL lines. I need manually delete symbols. It would be nice, if AutoWrap will not wrap words in SublimeREPL.

2. Settings

I use PythonImproved syntax for Python files and SublimeREPL. Yes, I can set another syntax for SublimeREPL, but I want use PythonImproved. My User\PythonImproved.sublime-settings file:

{
    "auto_wrap": true,
    "auto_wrap_width" : 79,
    "auto_wrap_break_long_word" : true,
    "extensions":
    [
        "py"
    ],
    "translate_tabs_to_spaces": true
}

3. Steps to reproduce

I reproduce the problem in a version of Sublime Text without plugins and user settings.

I install SublimeREPL and AutoWrap → I restart Sublime Text → Ctrl+Shift+P (⌘⇧p for Mac) → SublimeREPL: Python.

4. Expected behavior

If AutoWrap disable:

Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 

5. Actual behavior

If AutoWrap enable:

Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit 
(AMD64) on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ]

] symbol wrap to new line, I need delete it manually.

6. Environment

Operating system and version:
Windows 10 Enterprise LTSB 64-bit EN
Sublime Text:
Build 3126
Package:
I use the latest stable version of this package for Sublime Text 3
SublimeREPL:
Latest developer version

Thanks.

Boost.Python.ArgumentError in autowrap.py (line 54)

Traceback (most recent call last):
  File "./sublime_plugin.py", line 356, in run_
  File "./autowrap.py", line 54, in run
Boost.Python.ArgumentError: Python argument types in
    Region.__init__(Region, float, float)
did not match C++ signature:
    __init__(_object*, long long)
    __init__(_object*, long long, long long, double)
    __init__(_object*, long long, long long)

I see this trace back in the console. Sublime Text 2.0.2 build 2221

Copy-Pasting

Pasting in a long string of text does not automatically wrap it to the next line. Is it possible to support this?

C/C++ comment issue

When writing C/C++ block comments AutoWrap causes the comment block to lose its initial and final delimiters. For example (C++), with rulers set at 80:

/*
 * This code is run on application start and should perform all
 * initialization for SDL.
 */

Upon typing the two words "relevant procedures" after the word all, the code chunk becomes:

 * This code is run on application start and should perform all relevant
procedures
 * initialization for SDL.

As you can see, the start and end of the comment block are lost. I'm using AutoWrap in conjunction with these packages:

{
    "installed_packages":
    [
        "AutoWrap",
        "DocBlockr",
        "ExportHtml",
        "Jedi - Python autocompletion",
        "NASM x86 Assembly",
        "Package Syncing",
        "SideBarEnhancements",
        "SublimeREPL",
        "Surround",
        "Tomorrow Color Schemes",
        "Vintage Surround",
        "WordCount",
        "Wrap Plus"
    ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.