For example, to quote a selection: before: bla bla Selected Text bla bla :'<,'>call Surround('"', '"') after : bla bla "Selected Text" bla bla fun! Surround(s1, s2) range exe "normal vgvmboma\" normal `a let lineA = line(".") let columnA = col(".") normal `b let lineB = line(".") let columnB = col(".") " exchange marks if lineA > lineB || lineA <= lineB && columnA > columnB " save b in c normal mc " store a in b normal `amb " set a to old b normal `cma endif exe "normal `ba" . a:s2 . "\`ai" . a:s1 . "\" endfun Surround also works for a selection over more than one line. Some handy mappings:
Attributes | Values |
---|---|
rdfs:label |
|
rdfs:comment |
|
Version |
|
dbkwik:vim/property/wikiPageUsesTemplate | |
Previous |
|
Author |
|
Complexity |
|
Created |
|
ID |
|
NEXT |
|
Rating |
|
abstract |
|