Skip to content

BlackWidowMaker/sublime-reform

 
 

Repository files navigation

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 binding* 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
smart_down alt+down Jump to next function or class declaration
smart_up alt+up Jump to previous function or class declaration
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
select_block -- Select block1 at cursor
move_block_up ctrl+alt+; Swap block with a previous one
move_block_down ctrl+alt+' Swap block with a next one
delete_block ctrl+alt+d Delete block at cursor with appropriate empty lines
select_func -- Select function at cursor2
extract_expr alt+enter Extract selected expression into an assignment3

* Current key bindings are very experimental, especially on OS X.
1 Block is a blob of text surrounded with empty lines.
2 Works for python, js.
3 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.
  • Select scopes, functions and classes.
  • Like Ctrl+D/Alt-F3 but respect word boundaries, case, scopes.
  • Select all words withing scope, all references to same name.
  • 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.

About

A Sublime Text plugin to move through and reform things

Resources

Stars

Watchers

Forks

Packages

No packages published