Sublime Forum

Plugin: Select Block After New Line

#1

Select Block After New Line

You find it here: GitHub, with example pics.

It works similarly to Sublime expand_selection_to_paragraph function, but with these differences:

  • it doesn’t include the line where you are in, when you launch the command. You don’t need to be at the end of the line for this to work.
    - Shift+Enter          : select the block below the current line.
  • it can be extended to the following paragraphs, and back.
    - ctrl+up/down          : extend or go back, respecting indentation limit
  • You can also insert a blank line after the starting line, and the initial selection will exclude this empty line. Default key is:
Ctrl+Shift+Enter            : also inserts a blank line after the starting line
  • it will detect the indentation of the starting line, and of the selected paragraph(s). When trying to extend to paragraphs with smaller indentation, it will stop, but you can force it to extend the selection further. Default keys:
    - ctrl+shift+up/down    : force extension beyond indentation limit
  • you can extend the selection up to the end of the unselected line (where you had the cursor when the command was launched), then you can put the region in brackets (or indent, or whatever). It will ignore empty lines.

  • For auto-bracketing, you need either Bracketeer or Indent and Braces, or both of them. Bracketeer is better at indenting when the first line is already underindented, Indent and Braces is maybe better in the opposite case. If you use both, you can set the plugin to choose automatically the best(for me) command, otherwise you can set it to use one of the two. In any case, IaB behaviour has been modified to be more similar to Bracketeer(but better in some circumstances).
    Default keys:

      - ctrl+left/right         : include/exclude the first end of line
      - ctrl+shift+left/right   : enclose the block in brackets

      - b  : cycle between curly/square/round brackets (before enclosing, not after)
      - c  : cycle between the packages that will handle brackets (auto, Bracketeer, Indent and Braces)
  • finally, you can use it to ‘mark’ paragraphs and deselecting them at once. Every time you ‘force’ over unindented (same keybinding), even if the paragraph isn’t really underindented, it will be marked as such. Then press:
    - d  : to deselect all marked paragraphs

Of all the keybindings, only Shift+Enter and Ctrl+Shift+Enter are not contextualized(of course you can change them). The others will only work after the command has been launched, and the selection is active.

1 Like