Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Commit

Permalink
Updated surround.vim
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurzapparoli authored and arthurgeek committed Jan 17, 2012
1 parent 44fc5e6 commit 74b0492
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 120 deletions.
33 changes: 11 additions & 22 deletions doc/surround.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*surround.txt* Plugin for deleting, changing, and adding "surroundings"

Author: Tim Pope <vimNOSPAM@tpope.info> *surround-author*
Author: Tim Pope <http://tpo.pe/>
License: Same terms as Vim itself (see |license|)

This plugin is only available if 'compatible' is not set.
Expand All @@ -20,7 +20,7 @@ examples. An asterisk (*) is used to denote the cursor position.
[123+4*56]/2 cs]) (123+456)/2
"Look ma, I'm *HTML!" cs"<q> <q>Look ma, I'm HTML!</q>
if *x>3 { ysW( if ( x>3 ) {
my $str = *whee!; vlllls' my $str = 'whee!';
my $str = *whee!; vllllS' my $str = 'whee!';

While a few features of this plugin will work in older versions of Vim,
Vim 7 is recommended for full functionality.
Expand Down Expand Up @@ -50,8 +50,8 @@ below in |surround-replacements|. Once again, examples are in order.
<div>Yo!*</div> cst<p> <p>Yo!</p>

*ys* takes a valid Vim motion or text object as the first object, and wraps
it using the second argument as with |cs|. (Unfortunately there's no good
mnemonic for "ys".)
it using the second argument as with |cs|. (It's a stretch, but a good
mnemonic for "ys" is "you surround".)

Old text Command New text ~
Hello w*orld! ysiw) Hello (world)!
Expand All @@ -65,28 +65,19 @@ whitespace.
There is also *yS* and *ySS* which indent the surrounded text and place it
on a line of its own.

In visual mode, a simple "s" with an argument wraps the selection. This is
In visual mode, a simple "S" with an argument wraps the selection. This is
referred to as the *vS* mapping, although ordinarily there will be
additional keystrokes between the v and s. In linewise visual mode, the
additional keystrokes between the v and S. In linewise visual mode, the
surroundings are placed on separate lines and indented. In blockwise visual
mode, each line is surrounded.

A "gS" in visual mode, known as *vgS* , behaves similarly. In linewise visual
mode, the automatic indenting is surpressed. In blockwise visual mode, this
enables surrounding past the end of the like with 'virtualedit' set (there
mode, the automatic indenting is suppressed. In blockwise visual mode, this
enables surrounding past the end of the line with 'virtualedit' set (there
seems to be no way in Vim Script to differentiate between a jagged end of line
selection and a virtual block selected past the end of the line, so two maps
were needed).

Additionally, there is a legacy "s" or *vs* mapping which is basically the
same as |vS|. Due to popular demand of wanting to use "s" as Vim does to mean
replacing the selection (also available as "c"), this mapping is going away.
If you were one of these people and would like to disable "s" with the current
release, indicate this to surround.vim by assigning the "s" mapping to
something else.
>
xmap <Leader>s <Plug>Vsurround
<
*i_CTRL-G_s* *i_CTRL-G_S*
Finally, there is an experimental insert mode mapping on <C-G>s and <C-S>.
Beware that the latter won't work on terminals with flow control (if you
Expand All @@ -100,13 +91,11 @@ TARGETS *surround-targets*

The |ds| and |cs| commands both take a target as their first argument. The
possible targets are based closely on the |text-objects| provided by Vim.
In order for a target to work, the corresponding text object must be
supported in the version of Vim used (Vim 7 adds several text objects, and
thus is highly recommended). All targets are currently just one character.
All targets are currently just one character.

Eight punctuation marks, (, ), {, }, [, ], <, and >, represent themselves
and their counterparts. If the opening mark is used, contained whitespace is
also trimmed. The targets b, B, r, and a are aliases for ), }, ], and >
also trimmed. The targets b, B, r, and a are aliases for ), }, ], and >
(the first two mirror Vim; the second two are completely arbitrary and
subject to change).

Expand All @@ -128,7 +117,7 @@ however, newlines are sometimes added and/or removed.
REPLACEMENTS *surround-replacements*

A replacement argument is a single character, and is required by |cs|, |ys|,
and |vs|. Undefined replacement characters (with the exception of alphabetic
and |vS|. Undefined replacement characters (with the exception of alphabetic
characters) default to placing themselves at the beginning and end of the
destination, which can be useful for characters like / and |.

Expand Down
Loading

0 comments on commit 74b0492

Please sign in to comment.