• Stars
    star
    179
  • Rank 214,039 (Top 5 %)
  • Language
    Python
  • Created about 12 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Sublime Text plugin to move through and reform things

Reform

Join the chat at https://gitter.im/Suor/sublime-reform

This thing enables you to move through and reform your code like magic. At least it aims to do it :)

Here is a list of supported commands:

Command Key* Description
find_word_up ctrl+up Jump to previous occurrence of a word at cursor
find_word_down ctrl+down Jump to next occurrence of a word at cursor
def_up alt+up Jump to previous function or class declaration
def_down alt+down Jump to next function or class declaration
smart_up alt+[ Jump to previous declaration or block2
smart_down alt+] Jump to next declaration or block2
move_word_right ctrl+alt+/ Swap word at cursor with a next one
move_word_left ctrl+alt+. Swap word at cursor with a previous one
move_block_up ctrl+alt+; Swap block with a previous one
move_block_down ctrl+alt+' Swap block with a next one
expand_next_word alt+d Expand selection to next word matching one at cursor1
select_scope_words alt+shift+d Select words in function scope matching word at cursor1,3
select_scope_up ctrl+shift+; Select block2/function/class at cursor, select enclosing one on next hit3
select_scope_down ctrl+shift+' Undo last select_scope_up
delete_block ctrl+alt+d Delete block at cursor with appropriate adjusting empty lines
extract_expr alt+enter Extract selected expression into an assignment4
inline_expr alt+= Inline variable defined on line at cursor

* Current key bindings are very experimental, especially on OS X.
1 Matches only whole words, case-sensitive, comments and strings are skipped.
2 Block is a adjacent commented lines or a blob of text surrounded with empty lines.
3 Works for python, js, plain text. Tries to work for other languages.
4 Works for python, js, ruby, php (and any languages with no keyword to define var).

Installation

  • Install Package Control.
  • Bring up the Command Palette with Ctrl+Shift+p (Cmd+Shift+p on OS X).
  • Select "Package Control: Install Package" (it'll take a few seconds).
  • Select or type in "Reform" when the list appears.

TODO

I have plans. Here is a list if you want to help and looking where to start:

  • Move functions up and down.
  • Better select words in scope: expand to next scope on subsequent hit, autodetect name scope.
  • Break long lines.
  • Break long strings, several variants including switching to multiline separators.
  • Reform dicts (object literals) from one-line to multi-line and back.
  • Same for calls, calls with keyword arguments, array literals.
  • Reform multiline list, set, dict comprehensions and generator expressions.
  • Align =, =>, :, \ and other punctuation
  • Switch brackets, parentheses, whatever.
  • Move blocks respecting functions.

Also, support for more programming languages for language-dependent commands will help.

More Repositories

1

funcy

A fancy and practical functional tools
Python
3,248
star
2

django-cacheops

A slick ORM cache with automatic granular event-driven invalidation.
Python
2,015
star
3

patterns

Pattern matching for python
Python
217
star
4

whatever

Easy anonymous functions by partial application of operators
Python
99
star
5

handy

Handy django tools
Python
84
star
6

django-pickling

Efficient pickling for django models
Python
73
star
7

pg-bricks

Higher level PostgreSQL client for Node.js
JavaScript
50
star
8

flaws

Finds flaws in your python code
Python
39
star
9

sql-bricks-postgres

Transparent, Schemaless SQL Generation for the PostgreSQL
JavaScript
26
star
10

sublime-hippie-autocomplete

Sublime Text 2/3 style auto completion for ST4
Python
21
star
11

django-easymoney

Easy MoneyField for Django
Python
16
star
12

django-counters

Redis based counters for Django models
Python
15
star
13

CommentsAwareEnter

Smart Enter in line comments in Sublime Text 2/3
Python
15
star
14

djapi

The library of simple helpers to build API with Django.
Python
12
star
15

overload

Overload python 2 functions
Python
10
star
16

aioscrape

Async scraping library
Python
10
star
17

parsechain

Making parsing concise
Python
8
star
18

point-free

Point free async combinators
JavaScript
7
star
19

nesh-history-search

Ctrl-R search for nesh Node.js shell
JavaScript
6
star
20

gzip-reader

Streaming gzip decoder
Python
5
star
21

serverless-docker-artifacts

A Serverless plugin to build your artifacts within docker container
JavaScript
5
star
22

serverless-tesseract

A serverless plugin to add tesseract OCR engine to your artifact
JavaScript
5
star
23

battle-brothers-mods

Mods for Battle Brothers
Squirrel
4
star
24

autolink

Convert URL-like and email-like strings into links
Python
4
star
25

django-dirty

Track dirty fields on django model
Python
4
star
26

postgresql-json

Extract data from PostgreSQL JSON fields.
C
4
star
27

linux-app-logger

An active app/window logger for quantified self purporses
Python
3
star
28

swgoh-tickets-ocr

Recognize SWGOH tickets screenshots
Python
2
star
29

kate-syntax

Modified kate syntax files I used to use
2
star
30

django-union

Unite several querysets into one.
Python
2
star
31

rebind

Rebind hard-coded constants on the fly
Python
2
star
32

sky

A javascript based morph
JavaScript
2
star
33

debug-cache

Cache to speed up debugging
Python
2
star
34

battle-brothers-stdlib

A thing to take the place of lacking/incomplete Squirrel/Battle Brothers standard library
Squirrel
2
star
35

sublime-keylay-replay

A Sublime Text plugin to recover text typed with wrong keyboard layout
Python
1
star
36

aiofilecache

File backend for aiocache
Python
1
star
37

callback-ops

No more "if (err) return callback(err)"
JavaScript
1
star
38

eloquent

Eloquent selection/filter interface
Python
1
star
39

grabber

Web grabber in clojure
Clojure
1
star
40

asynx

Async utility extensions
JavaScript
1
star
41

pytest-matcher

Simplify asserts containing objects and nested data structures
Python
1
star