Permalink
Browse files

Alphabetic characters won't insert themselves

  • Loading branch information...
1 parent f168e0d commit dd236914cf79d77162ad17b9be455a2753b86824 @tpope committed Nov 5, 2006
Showing with 7 additions and 4 deletions.
  1. +7 −4 plugin/surround.vim
View
@@ -132,9 +132,9 @@
" Replacements: *surround-replacements*
"
" A replacement argument is a single character, and is required by |cs|, |ys|,
-" and |vs|. Undefined replacement characters default to placing themselves at
-" the beginning and end of the destination, which can be useful for characters
-" like / and |.
+" 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 |.
"
" If either ), }, ], or > is used, the text is wrapped in the appropriate
" pair of characters. Similar behavior can be found with (, {, and [ (but not
@@ -420,9 +420,12 @@ function! s:wrap(string,char,type,...)
let idx = idx / 3 * 3
let before = strpart(pairs,idx+1,1) . spc
let after = spc . strpart(pairs,idx+2,1)
- else
+ elseif newchar !~ '\a'
let before = newchar
let after = newchar
+ else
+ let before = ''
+ let after = ''
endif
"let before = substitute(before,'\n','\n'.initspaces,'g')
let after = substitute(after ,'\n','\n'.initspaces,'g')

0 comments on commit dd23691

Please sign in to comment.