Skip to content

Commit

Permalink
Allow using {}, [] and <> for function surround
Browse files Browse the repository at this point in the history
If the function name ends in "{", "[" or "<", use that as a delimiter
instead of "(".
  • Loading branch information
Miseran committed Mar 27, 2015
1 parent 772ab95 commit 3181a65
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plugin/surround.vim
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,15 @@ function! s:wrap(string,char,type,removed,special)
let fnc = input('function: ')
if fnc != ""
let s:input = fnc."\<CR>"
let before = substitute(fnc,'($','','').'('
let after = ')'
let lastchar = strpart(fnc,strlen(fnc)-1,1)
let lastidx = stridx(pairs,lastchar)
if lastidx >= 0 && lastidx % 3 == 1
let before = fnc
let after = strpart(pairs,lastidx+1,1)
else
let before = fnc.'('
let after = ')'
endif
if newchar ==# 'F'
let before .= ' '
let after = ' ' . after
Expand Down

0 comments on commit 3181a65

Please sign in to comment.