This plugin implements the basic functionality of surround.vim as a Sublime Text plugin.
This plugin is based on the work of mgnandt/sublime-text-surround.
Place surround.py in the User packages directory of Sublime Text. Merge any desired keyboard shortcuts in surround.sublime-keymap with your Sublime Text user key bindings.
When any of the surround commands are executed, Sublime Text will request a character (or two characters, for the replace_surround command) from the user via the input panel. Entering any half of a commonly used surrounding pair (parenthesis, brackets, braces, or angle brackets) will correctly add, remove, or replace the proper pair.
- The add_surround command surrounds a selection or the word around the cursor with the user's desired character.
- The add_surround command requires a single character as input from the user - the character that will surround the text.
Given the cursor position: This is a test of the emerg|ency broadcasting system.
Given the input character: "
The resulting text is: This is a test of the "emerg|ency" broadcasting system.
Given the cursor position: This is a test of the emerg|ency broadcasting system.
Given the input character: )
The resulting text is: This is a test of the (emerg|ency) broadcasting system.
Given the text selection: This is a test of the eme|rge|ncy broadcasting system.
Given the input character: [
The resulting text is: This is a test of the eme[|rge|]ncy broadcasting system.
- The delete_surround command removes the surrounding character desired by the user from around a selection or the word around the cursor.
- The delete_surround command requires a single character as input from the user - the surrounding character to remove from the text.
Given the cursor position: This is a test of the "emerg|ency" broadcasting system.
Given the input character: "
The resulting text is: This is a test of the emerg|ency broadcasting system.
Given the cursor position: This is a test of (the (emerg|ency) broadcasting) system.
Given the input character: )
The resulting text is: This is a test of (the emerg|ency broadcasting) system.
- The replace_surround command replaces one set of surrounding characters with another.
- The replace_surround command requires two characters as input from the user - the first is the existing surround character, the second is the character to exchange.
Given the cursor position: This is a test of the "emerg|ency" broadcasting system.
Given the input characters: ")
The resulting text is: This is a test of the (emerg|ency) broadcasting system.
- [ctrl+shift+a] executes the add_surround command
- [ctrl+shift+d] executes the delete_surround command
- [ctrl+shift+r] executes the replace_surround command