Nifty Rewrap
Alt+Q rewraps the comment, docstring or Markdown paragraph at the cursor to your ruler, keeping comment markers, JSDoc tags and list indents. Optional auto-wrap while typing.
Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.
Features




- Alt+Q rewraps the paragraph at the cursor: in a comment, a docstring or a Markdown or text file. Select several paragraphs (or the whole file) to rewrap them all; code in the selection is never touched. Each cursor rewraps its own paragraph, and one undo takes it all back. The cursor stays next to the word it was on.
- Wraps at your ruler: the first of
editor.rulers for the language, or 80. Press Alt+Q again to move on to the next ruler. Set nifty.rewrap.wrappingColumn to use another column, per language if you like.
- Comments in 60+ languages:
//, ///, //!, #, --, ;, ' and % line comments, and /* */, /** */ (with or without the leading *), <!-- -->, {- -}, (* *), <# #>, --[[ ]] and =begin/=end blocks. Markers, indentation and the * column are kept, and a comment on the same line as code is left alone.
- Doc comments stay readable: JSDoc, Javadoc, Doxygen (
\param) and PHPDoc tags start new lines and wrap with a hanging indent (an existing one is kept). @example, <pre>, \code blocks, <p> separators and XML doc tags stay as they are. A wrapped line never starts with an @tag.
- Python docstrings:
""" and ''' docstrings, including the line with the quotes. Google-style arguments (path (str): …) and Sphinx fields (:param path:) get hanging indents; section headers, NumPy underlines, doctests (>>>) and :: literal blocks stay put.
- Markdown: paragraphs, bullet and numbered lists (with hanging indents, nested lists and task checkboxes), and
> blockquotes. Headings, tables, code fences, indented code, front matter, HTML blocks and link definitions are never changed. A wrapped line never starts with -, 1. or #, which would turn text into a list or heading.
- Line breaks you meant stay: two trailing spaces or a trailing backslash.
- Chinese and Japanese: text breaks between characters without inserting spaces, lines joined back together get no space, and a line never starts with
。, 、 or a closing bracket. Wide characters count as two columns.
- Auto-wrap while typing (off by default): a comment or Markdown line that runs past the column breaks as you type, in the same style. Turn it on with Toggle Auto-Wrap While Typing, or per language in settings.
- Keeps CRLF line endings and tabs. Works in the browser on vscode.dev and github.dev.
Next to Nifty Docstrings: Docstrings writes new docstrings and doc comments for a function; Rewrap reflows the text in the ones you already have.
Commands
| Command |
Key |
What it does |
Nifty Rewrap: Rewrap Comment or Paragraph |
Alt+Q |
Rewrap the paragraphs at the cursors or in the selection. Press again for the next ruler. |
Nifty Rewrap: Unwrap Paragraph |
|
Join the paragraph's lines into one |
Nifty Rewrap: Rewrap at Column… |
|
Rewrap at a column you type (also takes the column as an argument for a keybinding) |
Nifty Rewrap: Toggle Auto-Wrap While Typing |
|
Turn auto-wrap on or off |
Settings
| Setting |
Default |
What it does |
nifty.rewrap.wrappingColumn |
0 |
Column to wrap at; 0 uses the first of editor.rulers, or 80. Can be set per language. |
nifty.rewrap.autoWrap.enabled |
false |
Wrap while typing when a line runs past the column. Can be set per language. |
For example, to wrap Markdown at 100 and have it wrap as you type:
"[markdown]": {
"nifty.rewrap.wrappingColumn": 100,
"nifty.rewrap.autoWrap.enabled": true
}
Install
- VS Code: search for "Nifty Rewrap" in the Extensions view, or install from the Visual Studio Marketplace.
- Cursor, Windsurf, VSCodium, Kiro, Antigravity: install from Open VSX.
Privacy
This extension collects no telemetry and needs no account.
- Nifty Markdown: TOC, Lists, Shortcuts & Paste: Markdown editing that keeps up: table of contents, section numbers, smart lists and task toggles, formatting keys, image paste, link checks and completions, and math in the preview. (Open VSX)
- Nifty Beautify: Format HTML in PHP, Blade & Twig: Format HTML inside PHP, Blade, Twig, Jinja, Handlebars, ERB and Liquid templates without breaking the template tags. (Open VSX)
- Nifty Docstrings: Doc Comments for Python, PHP, Rust and Go: Type three quotes under a Python function and get a Google, NumPy or Sphinx docstring with its arguments, types, returns and raises. PHPDoc, Rust and Go doc comments too. (Open VSX)
- Nifty Format on Save: Toggle, Exclude & Chains: Control format on save: a status bar toggle, folders and files that are never formatted, time limits, and save chains like organize imports, ESLint fix, then format. (Open VSX)
- Nifty JSON: Formatter, Validator & JSONPath: Format, minify, sort keys, query with JSONPath, copy paths, generate TypeScript types, and browse huge JSON files in a fast tree view. (Open VSX)
- Nifty Mermaid: Mermaid Diagram Preview & Export: Mermaid diagrams with no account: live preview beside .mmd files and Markdown, diagrams in the Markdown preview, syntax highlighting, and export to SVG or PNG. (Open VSX)
See all 100+ Nifty extensions and web tools at https://getnifty.dev
| |