From 4eed69afe5c219a76dd5de529c3e74ed9ac0c888 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 29 Aug 2011 00:54:17 -0400 Subject: [PATCH] Kill boilerplate and commented code --- plugin/surround.vim | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/plugin/surround.vim b/plugin/surround.vim index 320bea9..0891eac 100644 --- a/plugin/surround.vim +++ b/plugin/surround.vim @@ -2,27 +2,12 @@ " Author: Tim Pope " Version: 1.90 " GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim -" -" See surround.txt for help. This can be accessed by doing -" -" :helptags ~/.vim/doc -" :help surround -" -" Licensed under the same terms as Vim itself. -" ============================================================================ - -" Exit quickly when: -" - this plugin was already loaded or disabled -" - when 'compatible' is set -if (exists("g:loaded_surround") && g:loaded_surround) || &cp +if exists("g:loaded_surround") || &cp finish endif let g:loaded_surround = 1 -let s:cpo_save = &cpo -set cpo&vim - " Input functions {{{1 function! s:getchar() @@ -49,7 +34,6 @@ function! s:inputtarget() endfunction function! s:inputreplacement() - "echo '-- SURROUND --' let c = s:getchar() if c == " " let c = c . s:getchar() @@ -164,7 +148,6 @@ function! s:wrap(string,char,type,...) else let initspaces = matchstr(getline('.'),'\%^\s*') endif - " Duplicate b's are just placeholders (removed) let pairs = "b()B{}r[]a<>" let extraspace = "" if newchar =~ '^ ' @@ -233,12 +216,6 @@ function! s:wrap(string,char,type,...) let before = '\begin'.env let after = '\end'.matchstr(env,'[^}]*').'}' endif - "if type ==# 'v' || type ==# 'V' - "let before = before ."\n\t" - "endif - "if type ==# 'v' - "let after = "\n".initspaces.after - "endif elseif newchar ==# 'f' || newchar ==# 'F' let fnc = input('function: ') if fnc != "" @@ -264,9 +241,7 @@ function! s:wrap(string,char,type,...) let before = '' let after = '' endif - "let before = substitute(before,'\n','\n'.initspaces,'g') let after = substitute(after ,'\n','\n'.initspaces,'g') - "let after = substitute(after,"\n\\s*\\\s*",'\n','g') if type ==# 'V' || (special && type ==# "v") let before = substitute(before,' \+$','','') let after = substitute(after ,'^ \+','','') @@ -321,7 +296,6 @@ endfunction function! s:insert(...) " {{{1 " Optional argument causes the result to appear on 3 lines, not 1 - "call inputsave() let linemode = a:0 ? a:1 : 0 let char = s:inputreplacement() while char == "\" || char == "\" @@ -329,11 +303,9 @@ function! s:insert(...) " {{{1 let linemode = linemode + 1 let char = s:inputreplacement() endwhile - "call inputrestore() if char == "" return "" endif - "call inputsave() let cb_save = &clipboard set clipboard-=unnamed clipboard-=unnamedplus let reg_save = @@ @@ -350,9 +322,6 @@ function! s:insert(...) " {{{1 if exists("g:surround_insert_tail") call setreg('"',g:surround_insert_tail,"a".getregtype('"')) endif - "if linemode - "call setreg('"',substitute(getreg('"'),'^\s\+','',''),'c') - "endif if col('.') >= col('$') norm! ""p else @@ -502,7 +471,6 @@ function! s:opfunc(type,...) " {{{1 set clipboard-=unnamed clipboard-=unnamedplus let reg_save = getreg(reg) let reg_type = getregtype(reg) - "call setreg(reg,"\n","c") let type = a:type if a:type == "char" silent exe 'norm! v`[o`]"'.reg.'y' @@ -617,10 +585,6 @@ if !exists("g:surround_no_mappings") || ! g:surround_no_mappings endif imap s Isurround imap S ISurround - "Implemented internally instead - "imap ISurround endif -let &cpo = s:cpo_save - " vim:set ft=vim sw=2 sts=2 et: