tomkersten-vixploder 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +105 -0
  3. data/PostInstall.txt +21 -0
  4. data/README.rdoc +131 -0
  5. data/Rakefile +21 -0
  6. data/bin/256colors2.pl +63 -0
  7. data/bin/colortest +365 -0
  8. data/bin/vixplode +10 -0
  9. data/lib/dotfiles/aliases +30 -0
  10. data/lib/dotfiles/gvimrc +20 -0
  11. data/lib/dotfiles/vim/.VimballRecord +2 -0
  12. data/lib/dotfiles/vim/after/ftplugin/actionscript_snippets.vim +9 -0
  13. data/lib/dotfiles/vim/after/ftplugin/aspvbs_snippets.vim +17 -0
  14. data/lib/dotfiles/vim/after/ftplugin/c_snippets.vim +58 -0
  15. data/lib/dotfiles/vim/after/ftplugin/css_snippets.vim +30 -0
  16. data/lib/dotfiles/vim/after/ftplugin/django_model_snippets.vim +61 -0
  17. data/lib/dotfiles/vim/after/ftplugin/django_template_snippets.vim +32 -0
  18. data/lib/dotfiles/vim/after/ftplugin/f-script_snippets.vim +14 -0
  19. data/lib/dotfiles/vim/after/ftplugin/haskell_snippets.vim +9 -0
  20. data/lib/dotfiles/vim/after/ftplugin/html_snippets.vim +57 -0
  21. data/lib/dotfiles/vim/after/ftplugin/java_snippets.vim +52 -0
  22. data/lib/dotfiles/vim/after/ftplugin/javascript_snippets.vim +10 -0
  23. data/lib/dotfiles/vim/after/ftplugin/latex_snippets.vim +13 -0
  24. data/lib/dotfiles/vim/after/ftplugin/logo_snippets.vim +9 -0
  25. data/lib/dotfiles/vim/after/ftplugin/markdown_snippets.vim +10 -0
  26. data/lib/dotfiles/vim/after/ftplugin/movable_type_snippets.vim +14 -0
  27. data/lib/dotfiles/vim/after/ftplugin/objc_snippets.vim +53 -0
  28. data/lib/dotfiles/vim/after/ftplugin/ocaml_snippets.vim +26 -0
  29. data/lib/dotfiles/vim/after/ftplugin/perl_snippets.vim +23 -0
  30. data/lib/dotfiles/vim/after/ftplugin/php_snippets.vim +30 -0
  31. data/lib/dotfiles/vim/after/ftplugin/phpdoc_snippets.vim +19 -0
  32. data/lib/dotfiles/vim/after/ftplugin/propel_snippets.vim +14 -0
  33. data/lib/dotfiles/vim/after/ftplugin/python_snippets.vim +202 -0
  34. data/lib/dotfiles/vim/after/ftplugin/rails_snippets.vim +54 -0
  35. data/lib/dotfiles/vim/after/ftplugin/ruby_snippets.vim +32 -0
  36. data/lib/dotfiles/vim/after/ftplugin/sh_snippets.vim +12 -0
  37. data/lib/dotfiles/vim/after/ftplugin/slate_snippets.vim +19 -0
  38. data/lib/dotfiles/vim/after/ftplugin/smarty_snippets.vim +35 -0
  39. data/lib/dotfiles/vim/after/ftplugin/symfony_snippets.vim +21 -0
  40. data/lib/dotfiles/vim/after/ftplugin/tcl_snippets.vim +14 -0
  41. data/lib/dotfiles/vim/after/ftplugin/template_toolkit_snippets.vim +13 -0
  42. data/lib/dotfiles/vim/after/ftplugin/tex_snippets.vim +13 -0
  43. data/lib/dotfiles/vim/after/ftplugin/xhtml_snippets.vim +48 -0
  44. data/lib/dotfiles/vim/autoload/fakeclip.vim +253 -0
  45. data/lib/dotfiles/vim/autoload/rails.vim +4377 -0
  46. data/lib/dotfiles/vim/autoload/rubycomplete.vim +802 -0
  47. data/lib/dotfiles/vim/colors/inkpot.vim +212 -0
  48. data/lib/dotfiles/vim/colors/ir_black.vim +212 -0
  49. data/lib/dotfiles/vim/colors/ir_black_mod.vim +213 -0
  50. data/lib/dotfiles/vim/colors/railscasts.vim +100 -0
  51. data/lib/dotfiles/vim/colors/rubyblue.vim +74 -0
  52. data/lib/dotfiles/vim/colors/twilight.vim +75 -0
  53. data/lib/dotfiles/vim/colors/twilight2.vim +74 -0
  54. data/lib/dotfiles/vim/colors/wombat256.vim +302 -0
  55. data/lib/dotfiles/vim/compiler/eruby.vim +41 -0
  56. data/lib/dotfiles/vim/compiler/ruby.vim +68 -0
  57. data/lib/dotfiles/vim/compiler/rubyunit.vim +35 -0
  58. data/lib/dotfiles/vim/doc/NERD_tree.txt +1235 -0
  59. data/lib/dotfiles/vim/doc/fakeclip.txt +190 -0
  60. data/lib/dotfiles/vim/doc/matchit.txt +406 -0
  61. data/lib/dotfiles/vim/doc/project.txt +710 -0
  62. data/lib/dotfiles/vim/doc/rails.txt +1123 -0
  63. data/lib/dotfiles/vim/doc/snippets_emu.txt +354 -0
  64. data/lib/dotfiles/vim/doc/surround.txt +218 -0
  65. data/lib/dotfiles/vim/doc/tags +433 -0
  66. data/lib/dotfiles/vim/filetype.vim +13 -0
  67. data/lib/dotfiles/vim/ftdetect/gist.vim +3 -0
  68. data/lib/dotfiles/vim/ftdetect/ruby.vim +14 -0
  69. data/lib/dotfiles/vim/ftplugin/eruby.vim +101 -0
  70. data/lib/dotfiles/vim/ftplugin/ruby.vim +230 -0
  71. data/lib/dotfiles/vim/indent/eruby.vim +73 -0
  72. data/lib/dotfiles/vim/indent/ruby.vim +373 -0
  73. data/lib/dotfiles/vim/plugin/NERD_tree.vim +3536 -0
  74. data/lib/dotfiles/vim/plugin/comments.vim +321 -0
  75. data/lib/dotfiles/vim/plugin/fakeclip.vim +174 -0
  76. data/lib/dotfiles/vim/plugin/fuzzyfinder.vim +1676 -0
  77. data/lib/dotfiles/vim/plugin/fuzzyfinder_textmate.vim +150 -0
  78. data/lib/dotfiles/vim/plugin/gist.vim +241 -0
  79. data/lib/dotfiles/vim/plugin/gitdiff.vim +141 -0
  80. data/lib/dotfiles/vim/plugin/matchit.vim +812 -0
  81. data/lib/dotfiles/vim/plugin/mru.vim +787 -0
  82. data/lib/dotfiles/vim/plugin/rails.vim +310 -0
  83. data/lib/dotfiles/vim/plugin/rspec.vim +12 -0
  84. data/lib/dotfiles/vim/plugin/snippets.vim +17 -0
  85. data/lib/dotfiles/vim/plugin/snippetsEmu.vim +973 -0
  86. data/lib/dotfiles/vim/plugin/supertab.vim +531 -0
  87. data/lib/dotfiles/vim/plugin/surround.vim +632 -0
  88. data/lib/dotfiles/vim/ref_vimrc +80 -0
  89. data/lib/dotfiles/vim/ruby/fuzzy_file_finder.rb +353 -0
  90. data/lib/dotfiles/vim/syntax/eruby.vim +85 -0
  91. data/lib/dotfiles/vim/syntax/haml.vim +113 -0
  92. data/lib/dotfiles/vim/syntax/mkd.vim +86 -0
  93. data/lib/dotfiles/vim/syntax/ruby.vim +324 -0
  94. data/lib/dotfiles/vim/syntax/sass.vim +93 -0
  95. data/lib/dotfiles/vimrc +269 -0
  96. data/lib/vixplode/cli.rb +73 -0
  97. data/lib/vixploder.rb +6 -0
  98. data/script/console +10 -0
  99. data/script/destroy +14 -0
  100. data/script/generate +14 -0
  101. data/spec/spec.opts +1 -0
  102. data/spec/spec_helper.rb +10 -0
  103. data/spec/vixplode_cli_spec.rb +15 -0
  104. data/spec/vixploder_spec.rb +7 -0
  105. data/tasks/rspec.rake +21 -0
  106. metadata +202 -8
@@ -0,0 +1,354 @@
1
+ *snippets_emu.txt* For Vim version 7.0. Last change: 2006 Dec 26
2
+
3
+
4
+ VIM REFERENCE MANUAL by Panos Laganakos and Felix Ingram
5
+
6
+
7
+ 1. SnippetsEmu Features |snippets_emu-features|
8
+ Basic Snippets |basic-snippet|
9
+ Named Tags |named-tags|
10
+ Tag Commands |snippet-commands|
11
+ Buffer Specific Snippets |snip-buffer-specific|
12
+ Filetype Specific Snippets |snip-ftplugin|
13
+ Snippets menu |snip-menu|
14
+ 2. SnippetsEmu Options |snippets_emu-options|
15
+ Start and End Tags |snip-start-end-tags|
16
+ Element Delimiter |snip-start-end-tags|
17
+ Remapping the default jump key |snip-remap-key|
18
+ 3. Detailed Explanations |snip-detailed-explanations|
19
+ Valid Tag Names |snip-tag-name-syntax|
20
+ Advanced Tag Command Examples |snip-advanced-tag-commands|
21
+ 4. SnippetsEmu Contact Details |snip-contact-details|
22
+ 5. Contributors |snip-contributors|
23
+ 6. SnippetsEmu Known Bugs |snippets_emu-bugs|
24
+ 7. Troubleshooting |snippets_emu-troubleshooting|
25
+
26
+ {Vi does not have any of these features}
27
+
28
+ ==============================================================================
29
+ SNIPPETSEMU FEATURES *snippets_emu-features*
30
+
31
+ SnippetsEmu attempts to emulate several of the snippets features of the OS X
32
+ editor TextMate, in particular the variable bouncing and replacement behaviour.
33
+ Simple usage is built up around the following functionality:
34
+
35
+ Basic Snippet |basic-snippet|
36
+ Named Tags |named-tags|
37
+ Executable Snippet |snippet-commands|
38
+ Buffer Specific Snippets |snip-buffer-specific|
39
+
40
+ *basic-snippet*
41
+ *:Snippet*
42
+ Basic Snippet ~
43
+
44
+ A basic snippet can save you a lot of typing. Define a word trigger and on
45
+ insertion it will be expanded to the full snippet. SnippetsEmu allows the
46
+ user to define markers within the larger piece of text which will be used
47
+ to place the cursor upon expansion.
48
+
49
+ The command used to define a snippet is 'Snippet'.
50
+
51
+ Basic Syntax: >
52
+
53
+ :Snippet trigger_name The cursor will be placed here: <{}> Trailing text
54
+
55
+ In insert mode typing 'trigger_name<Tab>' will remove 'trigger_name' and
56
+ replace it with the text: 'The cursor will be placed here: Trailing text'.
57
+ The cursor will be placed between the two spaces before the word 'Trailing'
58
+
59
+ NOTE: All text should be entered on the same command line. The formatting of
60
+ this document may mean that examples are wrapped but they should all be
61
+ entered on a single line.
62
+
63
+ *named-tags*
64
+ Named tags ~
65
+
66
+ Instead of the simple '<{}>' tags used for cursor placement a user can define
67
+ named tags. When the value of a named tag is changed then all other tags with
68
+ that name will be changed to the same value.
69
+
70
+ E.g. >
71
+
72
+ :Snippet trigger My name is <{forename}> <{surname}>. Call me <{forename}>.
73
+
74
+ In insert mode typing 'trigger<Tab>' will place the cursor inside the
75
+ '<{forename}>' tag. Whatever is entered inside the tag will replace the other
76
+ similarly named tag at the end of the line after the user presses 'Tab'.
77
+
78
+ If no value is entered for a named tag then the tag's name will be used
79
+ instead. This is one way of defining default values.
80
+
81
+ Using the above example, entering 'trigger<Tab>' and pressing 'Tab' twice
82
+ will result in the following text: >
83
+
84
+ My name is forename surname. Please call me forename.
85
+
86
+ The rules for what constitutes a valid tag name are explained below. See
87
+ |snip-tag-name-syntax|.
88
+ *snippet-commands*
89
+ Tag commands ~
90
+
91
+ Tags can contain commands. Commands can be any Vim function, including user
92
+ defined functions.
93
+
94
+ A common example is performing substitutions.
95
+
96
+ E.g. >
97
+
98
+ :Snippet trigger My name is <{name}>. I SAID: MY NAME IS
99
+ <{name:substitute(@z,'.','\u&','g')}>!
100
+
101
+ The value entered in the <{name}> tag will be passed to the command in the
102
+ second <{name}> tag in the @z register (any value already in @z will be
103
+ preserved and restored). The substitute command will change the entered value
104
+ to be in upper case. I.e. Entering 'trigger<Tab>' and typing 'Tycho<Tab>'
105
+ will result in the following text: >
106
+
107
+ My name is Tycho. I SAID: MY NAME IS TYCHO!
108
+ ~
109
+ *snip-special-vars*
110
+ There is a set of special variables which can be included in snippets. These
111
+ will be replaced before the snippet's text is inserted into the buffer. The
112
+ list of available variables is detailed below:
113
+
114
+ * SNIP_FILE_NAME - The current file name (from 'expand("%")')
115
+ * SNIP_ISO_DATE - The current date in YYYY-MM-DD format.
116
+
117
+ *snip-snippet-commands*
118
+ In addition to tag commands it is also possible to define commands which will
119
+ be executed before the snippet is inserted into the buffer. These are defined
120
+ within double backticks.
121
+
122
+ E.g.
123
+ >
124
+ :Snippet date The current date is ``strftime("%c")``
125
+
126
+ Commands are standard Vim commands and will be 'exec'uted and the command
127
+ output substituted into the text.
128
+
129
+ *snip-buffer-specific*
130
+ Buffer Specific Snippets ~
131
+
132
+ The Snippet command defines buffer specific snippets. This is the recommended
133
+ option when using filetype specific snippets. It is possible to define
134
+ 'global' snippets which will act across all buffers. These can be defined
135
+ using the legacy 'Iabbr' command (note the capital 'I').
136
+
137
+ E.g. >
138
+ Iabbr for for <{var}> in <{list}>:<CR><{}>
139
+ ~
140
+ *snip-ftplugin*
141
+ The preferred practice for defining filetype specific snippets is to include
142
+ them in files named <filetype>_snippets.vim and for these files to be placed in the
143
+ ~/.vim/after/ftplugin directory (or vimfiles\after\ftplugin under Windows).
144
+ When a file of a specific type is loaded so will all of the defined snippets.
145
+ The 'after' directory is used to ensure that the plugin has been loaded. It is
146
+ also recommended that the following is included at the top of the file: >
147
+
148
+ if !exists('loaded_snippet') || &cp
149
+ finish
150
+ endif
151
+
152
+ This will stop errors being generated if the plugin has not loaded for any
153
+ reason.
154
+
155
+ Users wishing to add their own filetype snippets should add them to a separate
156
+ file to ensure they are not lost when upgrading the plugin. Naming the files
157
+ <filetype>_mysnippets.vim or similar is the preferred practice.
158
+
159
+ *snip-menu*
160
+ When loading the plugin will search for all files named '*_snippets.vim'.
161
+ These will be added to the 'Snippets' menu which is available in Normal mode.
162
+ Selecting options from the menu will source the file and hence load any
163
+ snippets defined within it.
164
+
165
+ *creating-snippets* *CreateSnippet*
166
+ [range]CreateSnippet
167
+ The CreateSnippet command allows the simple creation of
168
+ snippets for use within your own file. Without a range the
169
+ current line will be used. When passed a range then all the
170
+ lines in the range will be converted for use in a command.
171
+
172
+ Snippets created by the command will be added to a scratch
173
+ buffer called 'Snippets'. The current value of an empty tag
174
+ (snip_start_tag.snip_end_tag, '<{}>' by default) will be added
175
+ to the unnamed register and so can be inserted with appropriate
176
+ paste commands.
177
+
178
+ *CreateBundleSnippet*
179
+ [range]CreateBundleSnippet
180
+ CreateBundleSnippet works exactly like CreateSnippet but the
181
+ resulting text will be suitable for including in one of the
182
+ included bundles. The unnamed register will include the text
183
+ '"st.et."' so start and end tag agnostic empty tags can be
184
+ included.
185
+
186
+ ===============================================================================
187
+ SNIPPETSEMU OPTIONS *snippets_emu-options*
188
+ *snip-start-end-tags*
189
+ Start and End Tags ~
190
+
191
+ By default the start and end tags are set to be '<{' and '}>'. These can be
192
+ changed by setting the following variables in vimrc: >
193
+
194
+ g:snip_start_tag
195
+ g:snip_end_tag
196
+
197
+ They can be also changed for a specific buffer by setting the following: >
198
+
199
+ b:snip_start_tag
200
+ b:snip_end_tag
201
+ ~
202
+ *snip-elem-delimiter*
203
+ Element Delimiter ~
204
+
205
+ The value of snip_elem_delim is used to separate a tag's name and its command.
206
+ By default it is set to ':' but can be set as above either globally or for a
207
+ specific buffer using the following variables: >
208
+
209
+ g:snip_elem_delim
210
+ b:snip_elem_delim
211
+ ~
212
+ *snip-remap-key*
213
+ Remapping the default jump key ~
214
+
215
+ The trigger key is mapped to Tab by default. Some people may wish to remap
216
+ this if it causes conflicts with other plugins. The key can be set in your
217
+ <.vimrc> by setting the 'g:snippetsEmu_key' variable.
218
+ An example
219
+ >
220
+ let g:snippetsEmu_key = "<S-Tab>"
221
+
222
+ Snippets will now be triggered by Shift-Tab rather than just Tab. NB, this
223
+ example may not work in all terminals as some trap Shift-Tab before it gets
224
+ to Vim.
225
+
226
+ ~
227
+ ==============================================================================
228
+ DETAILED EXPLANATIONS *snip-detailed-explanations*
229
+ *snip-tag-name-syntax*
230
+ Valid Tag Names ~
231
+
232
+ Tag names cannot contain whitespace unless they are enclosed in quotes.
233
+
234
+ Valid Examples: >
235
+ <{validName}>
236
+ <{"valid name"}>
237
+ <{tagName:command}>
238
+ <{"Tag Name":command}>
239
+
240
+ Invalid Examples: >
241
+ <{invalid name}>
242
+ <{Tag Name:command}>
243
+ <{:command}>
244
+
245
+ ~
246
+ *snip-advanced-tag-commands*
247
+ Advanced Tag Command Examples ~
248
+
249
+ Commands in tags can be as complex as desired. Readability is the main
250
+ limitation as the command will be placed in the document before execution.
251
+
252
+ The preferred method for defining complex commands is to hide the
253
+ functionality in a user function.
254
+
255
+ Example:
256
+ >
257
+
258
+ function! Count(haystack, needle)
259
+ let counter = 0
260
+ let index = match(a:haystack, a:needle)
261
+ while index > -1
262
+ let counter = counter + 1
263
+ let index = match(a:haystack, a:needle, index+1)
264
+ endwhile
265
+ return counter
266
+ endfunction
267
+
268
+ function! PyArgList(count)
269
+ if a:count == 0
270
+ return "(,)"
271
+ else
272
+ return '('.repeat('<{}>, ', a:count).')'
273
+ endif
274
+ endfunction
275
+
276
+ Snippet pf print "<{s}>" % <{s:PyArgList(Count(@z, '%[^%]'))}><CR><{}>
277
+
278
+ The above snippet will expand 'pf' to 'print "<{s}>" ...'. The user then
279
+ enters a format string. Once the string is entered the Count and PyArgList
280
+ functions are used to generate a number of empty tags.
281
+
282
+ *snip-limitations*
283
+ The above represents once of the limitations of the plugin. Due to the way
284
+ tags are identified it is not possible to include empty tags in another tag's
285
+ command. The only way to generate empty tags is to return them from a function
286
+ as in the above example. For other examples see the included bundles.
287
+
288
+ *snip-bundles*
289
+ The included bundles are not defined in the 'preferred style'. In order to
290
+ accommodate users who wish to redefine the default tags all snippet
291
+ definitions are 'executed' with the 'exec' command.
292
+
293
+ E.g.
294
+ >
295
+ exec "Snippet test This isn't the right way to ".st.et." define snippets"
296
+
297
+ Executing the command allows 'st' and 'et' to be used in place of start and
298
+ end tags. 'st' and 'et' are defined elsewhere in the bundle file.
299
+
300
+ ==============================================================================
301
+ SNIPPETSEMU CONTACT DETAILS *snip-contact-details*
302
+
303
+ To contact the author please email:
304
+
305
+ F <dot> Ingram <dot> lists <at> gmail <dot> com
306
+
307
+ The author welcomes corrections to this documentation, example snippets and
308
+ bug reports.
309
+
310
+ The plugin is also currently hosted at Google Code:
311
+ http://code.google.com/p/snippetsemu
312
+
313
+ Bug reports can also be posted on the hosting site:
314
+ http://code.google.com/p/snippetsemu/issues/list
315
+
316
+ *snip-contributors*
317
+ Contributors to SnippetsEmu ~
318
+
319
+ Patches:
320
+ Ori Avtalion - Improvements to Snippet command
321
+ Freddy Vulto - Improved behaviour
322
+ Andy Block - Bug with commands on same line. This is why I should do better
323
+ test suites.
324
+ bzklrm - Removal of some normal commands
325
+ Priit Tamboom - Sorting out left and right mappings
326
+
327
+ Documentation:
328
+ Panos Laganakos - Greek translation (coming soon)
329
+
330
+ Bundles:
331
+ Panos Laganakos - Python snippets
332
+ Alex Pounds - Django snippets
333
+ Chris Lasher - Python snippets
334
+ knipknap - Python snippets
335
+ James Widman - C snippets
336
+
337
+ ==============================================================================
338
+ SNIPPETSEMU KNOWN BUGS *snippets_emu-bugs*
339
+
340
+ Bugs are currently tracked on Google Code. Please post any you find on the
341
+ issue tracker:
342
+ http://code.google.com/p/snippetsemu/issues/list
343
+
344
+ ==============================================================================
345
+ SNIPPETSEMU TROUBLESHOOTING *snippets_emu-troubleshooting*
346
+
347
+ Problem: Bundles are not loading.
348
+ Answer: Ensure that you have filetype plugins turned on. Include the
349
+ following in your vimrc: >
350
+
351
+ filetype plugin on
352
+
353
+
354
+ vim:tw=78:sw=4:ts=8:ft=help:norl:
@@ -0,0 +1,218 @@
1
+ *surround.txt* Plugin for deleting, changing, and adding "surroundings"
2
+
3
+ Author: Tim Pope <vimNOSPAM@tpope.info> *surround-author*
4
+ License: Same terms as Vim itself (see |license|)
5
+
6
+ This plugin is only available if 'compatible' is not set.
7
+
8
+ INTRODUCTION *surround*
9
+
10
+ This plugin is a tool for dealing with pairs of "surroundings." Examples
11
+ of surroundings include parentheses, quotes, and HTML tags. They are
12
+ closely related to what Vim refers to as |text-objects|. Provided
13
+ are mappings to allow for removing, changing, and adding surroundings.
14
+
15
+ Details follow on the exact semantics, but first, consider the following
16
+ examples. An asterisk (*) is used to denote the cursor position.
17
+
18
+ Old text Command New text ~
19
+ "Hello *world!" ds" Hello world!
20
+ [123+4*56]/2 cs]) (123+456)/2
21
+ "Look ma, I'm *HTML!" cs"<q> <q>Look ma, I'm HTML!</q>
22
+ if *x>3 { ysW( if ( x>3 ) {
23
+ my $str = *whee!; vlllls' my $str = 'whee!';
24
+
25
+ While a few features of this plugin will work in older versions of Vim,
26
+ Vim 7 is recommended for full functionality.
27
+
28
+ MAPPINGS *surround-mappings*
29
+
30
+ Delete surroundings is *ds* . The next character given determines the target
31
+ to delete. The exact nature of the target is explained in |surround-targets|
32
+ but essentially it is the last character of a |text-object|. This mapping
33
+ deletes the difference between the "i"nner object and "a"n object. This is
34
+ easiest to understand with some examples:
35
+
36
+ Old text Command New text ~
37
+ "Hello *world!" ds" Hello world!
38
+ (123+4*56)/2 ds) 123+456/2
39
+ <div>Yo!*</div> dst Yo!
40
+
41
+ Change surroundings is *cs* . It takes two arguments, a target like with
42
+ |ds|, and a replacement. Details about the second argument can be found
43
+ below in |surround-replacements|. Once again, examples are in order.
44
+
45
+ Old text Command New text ~
46
+ "Hello *world!" cs"' 'Hello world!'
47
+ "Hello *world!" cs"<q> <q>Hello world!</q>
48
+ (123+4*56)/2 cs)] [123+456]/2
49
+ (123+4*56)/2 cs)[ [ 123+456 ]/2
50
+ <div>Yo!*</div> cst<p> <p>Yo!</p>
51
+
52
+ *ys* takes a valid Vim motion or text object as the first object, and wraps
53
+ it using the second argument as with |cs|. (Unfortunately there's no good
54
+ mnemonic for "ys".)
55
+
56
+ Old text Command New text ~
57
+ Hello w*orld! ysiw) Hello (world)!
58
+
59
+ As a special case, *yss* operates on the current line, ignoring leading
60
+ whitespace.
61
+
62
+ Old text Command New text ~
63
+ Hello w*orld! yssB {Hello world!}
64
+
65
+ There is also *yS* and *ySS* which indent the surrounded text and place it
66
+ on a line of its own.
67
+
68
+ In visual mode, a simple "s" with an argument wraps the selection. This is
69
+ referred to as the *vs* mapping, although ordinarily there will be
70
+ additional keystrokes between the v and s. In linewise visual mode, the
71
+ surroundings are placed on separate lines. In blockwise visual mode, each
72
+ line is surrounded.
73
+
74
+ An "S" in visual mode (*vS*) behaves similarly but always places the
75
+ surroundings on separate lines. Additionally, the surrounded text is
76
+ indented. In blockwise visual mode, using "S" instead of "s" instead skips
77
+ trailing whitespace.
78
+
79
+ Note that "s" and "S" already have valid meaning in visual mode, but it is
80
+ identical to "c". If you have muscle memory for "s" and would like to use a
81
+ different key, add your own mapping and the existing one will be disabled.
82
+ >
83
+ vmap <Leader>s <Plug>Vsurround
84
+ vmap <Leader>S <Plug>VSurround
85
+ <
86
+ *i_CTRL-G_s* *i_CTRL-G_S*
87
+ Finally, there is an experimental insert mode mapping on <C-G>s and <C-S>.
88
+ Beware that the latter won't work on terminals with flow control (if you
89
+ accidentally freeze your terminal, use <C-Q> to unfreeze it). The mapping
90
+ inserts the specified surroundings and puts the cursor between them. If,
91
+ immediately after the mapping and before the replacement, a second <C-S> or
92
+ carriage return is pressed, the prefix, cursor, and suffix will be placed on
93
+ three separate lines. <C-G>S (not <C-G>s) also exhibits this behavior.
94
+
95
+ TARGETS *surround-targets*
96
+
97
+ The |ds| and |cs| commands both take a target as their first argument. The
98
+ possible targets are based closely on the |text-objects| provided by Vim.
99
+ In order for a target to work, the corresponding text object must be
100
+ supported in the version of Vim used (Vim 7 adds several text objects, and
101
+ thus is highly recommended). All targets are currently just one character.
102
+
103
+ Eight punctuation marks, (, ), {, }, [, ], <, and >, represent themselves
104
+ and their counterparts. If the opening mark is used, contained whitespace is
105
+ also trimmed. The targets b, B, r, and a are aliases for ), }, ], and >
106
+ (the first two mirror Vim; the second two are completely arbitrary and
107
+ subject to change).
108
+
109
+ Three quote marks, ', ", `, represent themselves, in pairs. They are only
110
+ searched for on the current line.
111
+
112
+ A t is a pair of HTML or XML tags. See |tag-blocks| for details. Remember
113
+ that you can specify a numerical argument if you want to get to a tag other
114
+ than the innermost one.
115
+
116
+ The letters w, W, and s correspond to a |word|, a |WORD|, and a |sentence|,
117
+ respectively. These are special in that they have nothing to delete, and
118
+ used with |ds| they are a no-op. With |cs|, one could consider them a
119
+ slight shortcut for ysi (cswb == ysiwb, more or less).
120
+
121
+ A p represents a |paragraph|. This behaves similarly to w, W, and s above;
122
+ however, newlines are sometimes added and/or removed.
123
+
124
+ REPLACEMENTS *surround-replacements*
125
+
126
+ A replacement argument is a single character, and is required by |cs|, |ys|,
127
+ and |vs|. Undefined replacement characters (with the exception of alphabetic
128
+ characters) default to placing themselves at the beginning and end of the
129
+ destination, which can be useful for characters like / and |.
130
+
131
+ If either ), }, ], or > is used, the text is wrapped in the appropriate pair
132
+ of characters. Similar behavior can be found with (, {, and [ (but not <),
133
+ which append an additional space to the inside. Like with the targets above,
134
+ b, B, r, and a are aliases for ), }, ], and >. To fulfill the common need for
135
+ code blocks in C-style languages, <C-}> (which is really <C-]>) adds braces on
136
+ lines separate from the content.
137
+
138
+ If t or < is used, Vim prompts for an HTML/XML tag to insert. You may specify
139
+ attributes here and they will be stripped from the closing tag. End your
140
+ input by pressing <CR> or >. If <C-T> is used, the tags will appear on lines
141
+ by themselves.
142
+
143
+ A deprecated replacement of a LaTeX environment is provided on \ and l. The
144
+ name of the environment and any arguments will be input from a prompt. This
145
+ will be removed once a more fully functional customization system is
146
+ implemented. The following shows the resulting environment from
147
+ csp\tabular}{lc<CR>
148
+ >
149
+ \begin{tabular}{lc}
150
+ \end{tabular}
151
+ <
152
+ CUSTOMIZING *surround-customizing*
153
+
154
+ The following adds a potential replacement on "-" (ASCII 45) in PHP files.
155
+ (To determine the ASCII code to use, :echo char2nr("-")). The carriage
156
+ return will be replaced by the original text.
157
+ >
158
+ autocmd FileType php let b:surround_45 = "<?php \r ?>"
159
+ <
160
+ This can be used in a PHP file as in the following example.
161
+
162
+ Old text Command New text ~
163
+ print "Hello *world!" yss- <?php print "Hello world!" ?>
164
+
165
+ Additionally, one can use a global variable for globally available
166
+ replacements.
167
+ >
168
+ let g:surround_45 = "<% \r %>"
169
+ let g:surround_61 = "<%= \r %>"
170
+ <
171
+ Advanced, experimental, and subject to change: One can also prompt for
172
+ replacement text. The syntax for this is to surround the replacement in pairs
173
+ of low numbered control characters. If this sounds confusing, that's because
174
+ it is (but it makes the parsing easy). Consider the following example for a
175
+ LaTeX environment on the "l" replacement.
176
+ >
177
+ let g:surround_108 = "\\begin{\1environment: \1}\r\\end{\1\1}"
178
+ <
179
+ When this replacement is used, the user is prompted with an "environment: "
180
+ prompt for input. This input is inserted between each set of \1's.
181
+ Additional inputs up to \7 can be used.
182
+
183
+ Furthermore, one can specify a regular expression substitution to apply.
184
+ >
185
+ let g:surround_108 = "\\begin{\1environment: \1}\r\\end{\1\r}.*\r\1}"
186
+ <
187
+ This will remove anything after the first } in the input when the text is
188
+ placed within the \end{} slot. The first \r marks where the pattern begins,
189
+ and the second where the replacement text begins.
190
+
191
+ Here's a second example for creating an HTML <div>. The substitution cleverly
192
+ prompts for an id, but only adds id="" if it is non-blank. You may have to
193
+ read this one a few times slowly before you understand it.
194
+ >
195
+ let g:surround_{char2nr("d")} = "<div\1id: \r..*\r id=\"&\"\1>\r</div>"
196
+ <
197
+ Inputting text replacements is a proof of concept at this point. The ugly,
198
+ unintuitive interface and the brevity of the documentation reflect this.
199
+
200
+ Finally, It is possible to always append a string to surroundings in insert
201
+ mode (and only insert mode). This is useful with certain plugins and mappings
202
+ that allow you to jump to such markings.
203
+ >
204
+ let g:surround_insert_tail = "<++>"
205
+ <
206
+ ISSUES *surround-issues*
207
+
208
+ Vim could potentially get confused when deleting/changing occurs at the very
209
+ end of the line. Please report any repeatable instances of this.
210
+
211
+ Do we need to use |inputsave()|/|inputrestore()| with the tag replacement?
212
+
213
+ Indenting is handled haphazardly. Need to decide the most appropriate
214
+ behavior and implement it. Right now one can do :let b:surround_indent = 1
215
+ (or the global equivalent) to enable automatic re-indenting by Vim via |=|;
216
+ should this be the default?
217
+
218
+ vim:tw=78:ts=8:ft=help:norl: