Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I shift a block of text to the left or right with Sublime Text 2?

share|improve this question
up vote 20 down vote accepted

You can use ctrl+ ] to indent a line (or highlighted block), and ctrl + [ to unindent.

On OSX this is cmd + ]/[.

You can also use tab/shift+tab, but these will start from wherever the cursor is currently, while ctrl+[/] will move the whole line/block

share|improve this answer
1  
at least on the mac version tab & shift-tab work on whole lines and the position of the cursor has no influence on it. – yamm May 8 '15 at 8:12

Check out colinta's SublimeMoveText. Install as a normal plugin (It's called "MoveText" by the Package Manager), but keybindings have to be set up manually. Here is what I did:

// MoveText
// move_text_left: Moves the selected text one character to the left
// move_text_right: Moves the selected text one character to the right
// move_text_up: Moves the selected text one line up
// move_text_down: Moves the selected text one line down
{ "keys": ["ctrl+shift+n"], "command": "move_text_left" },
{ "keys": ["ctrl+shift+m"], "command": "move_text_right" },

Highlight what you want to move. If it is more than one line, use column selection as @Jivings suggested (shift+right-click on Win/Linux, option+mouse on OSX). Then use the keybinding to move text left/right. You can also set up keybindings to move the selected up/down a line.

share|improve this answer
    
Some people use this package with super+ctrl+left/right key bindings instead. Also, MoveText moves text by character position, not by word, which would have been handier for general text editing purposes. – Serge Stroobandt Aug 26 '14 at 12:11

Use column selection and then insert or delete spaces or tabs.

Or highlight a selection of text and press tab to move it right or shift+tab to move it left.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .