Kill boilerplate and commented code
This commit is contained in:
parent
010c5fc915
commit
4eed69afe5
@ -2,27 +2,12 @@
|
|||||||
" Author: Tim Pope <http://tpo.pe/>
|
" Author: Tim Pope <http://tpo.pe/>
|
||||||
" Version: 1.90
|
" Version: 1.90
|
||||||
" GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim
|
" 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.
|
|
||||||
|
|
||||||
" ============================================================================
|
if exists("g:loaded_surround") || &cp
|
||||||
|
|
||||||
" Exit quickly when:
|
|
||||||
" - this plugin was already loaded or disabled
|
|
||||||
" - when 'compatible' is set
|
|
||||||
if (exists("g:loaded_surround") && g:loaded_surround) || &cp
|
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_surround = 1
|
let g:loaded_surround = 1
|
||||||
|
|
||||||
let s:cpo_save = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
" Input functions {{{1
|
" Input functions {{{1
|
||||||
|
|
||||||
function! s:getchar()
|
function! s:getchar()
|
||||||
@ -49,7 +34,6 @@ function! s:inputtarget()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:inputreplacement()
|
function! s:inputreplacement()
|
||||||
"echo '-- SURROUND --'
|
|
||||||
let c = s:getchar()
|
let c = s:getchar()
|
||||||
if c == " "
|
if c == " "
|
||||||
let c = c . s:getchar()
|
let c = c . s:getchar()
|
||||||
@ -164,7 +148,6 @@ function! s:wrap(string,char,type,...)
|
|||||||
else
|
else
|
||||||
let initspaces = matchstr(getline('.'),'\%^\s*')
|
let initspaces = matchstr(getline('.'),'\%^\s*')
|
||||||
endif
|
endif
|
||||||
" Duplicate b's are just placeholders (removed)
|
|
||||||
let pairs = "b()B{}r[]a<>"
|
let pairs = "b()B{}r[]a<>"
|
||||||
let extraspace = ""
|
let extraspace = ""
|
||||||
if newchar =~ '^ '
|
if newchar =~ '^ '
|
||||||
@ -233,12 +216,6 @@ function! s:wrap(string,char,type,...)
|
|||||||
let before = '\begin'.env
|
let before = '\begin'.env
|
||||||
let after = '\end'.matchstr(env,'[^}]*').'}'
|
let after = '\end'.matchstr(env,'[^}]*').'}'
|
||||||
endif
|
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'
|
elseif newchar ==# 'f' || newchar ==# 'F'
|
||||||
let fnc = input('function: ')
|
let fnc = input('function: ')
|
||||||
if fnc != ""
|
if fnc != ""
|
||||||
@ -264,9 +241,7 @@ function! s:wrap(string,char,type,...)
|
|||||||
let before = ''
|
let before = ''
|
||||||
let after = ''
|
let after = ''
|
||||||
endif
|
endif
|
||||||
"let before = substitute(before,'\n','\n'.initspaces,'g')
|
|
||||||
let after = substitute(after ,'\n','\n'.initspaces,'g')
|
let after = substitute(after ,'\n','\n'.initspaces,'g')
|
||||||
"let after = substitute(after,"\n\\s*\<C-U>\\s*",'\n','g')
|
|
||||||
if type ==# 'V' || (special && type ==# "v")
|
if type ==# 'V' || (special && type ==# "v")
|
||||||
let before = substitute(before,' \+$','','')
|
let before = substitute(before,' \+$','','')
|
||||||
let after = substitute(after ,'^ \+','','')
|
let after = substitute(after ,'^ \+','','')
|
||||||
@ -321,7 +296,6 @@ endfunction
|
|||||||
|
|
||||||
function! s:insert(...) " {{{1
|
function! s:insert(...) " {{{1
|
||||||
" Optional argument causes the result to appear on 3 lines, not 1
|
" Optional argument causes the result to appear on 3 lines, not 1
|
||||||
"call inputsave()
|
|
||||||
let linemode = a:0 ? a:1 : 0
|
let linemode = a:0 ? a:1 : 0
|
||||||
let char = s:inputreplacement()
|
let char = s:inputreplacement()
|
||||||
while char == "\<CR>" || char == "\<C-S>"
|
while char == "\<CR>" || char == "\<C-S>"
|
||||||
@ -329,11 +303,9 @@ function! s:insert(...) " {{{1
|
|||||||
let linemode = linemode + 1
|
let linemode = linemode + 1
|
||||||
let char = s:inputreplacement()
|
let char = s:inputreplacement()
|
||||||
endwhile
|
endwhile
|
||||||
"call inputrestore()
|
|
||||||
if char == ""
|
if char == ""
|
||||||
return ""
|
return ""
|
||||||
endif
|
endif
|
||||||
"call inputsave()
|
|
||||||
let cb_save = &clipboard
|
let cb_save = &clipboard
|
||||||
set clipboard-=unnamed clipboard-=unnamedplus
|
set clipboard-=unnamed clipboard-=unnamedplus
|
||||||
let reg_save = @@
|
let reg_save = @@
|
||||||
@ -350,9 +322,6 @@ function! s:insert(...) " {{{1
|
|||||||
if exists("g:surround_insert_tail")
|
if exists("g:surround_insert_tail")
|
||||||
call setreg('"',g:surround_insert_tail,"a".getregtype('"'))
|
call setreg('"',g:surround_insert_tail,"a".getregtype('"'))
|
||||||
endif
|
endif
|
||||||
"if linemode
|
|
||||||
"call setreg('"',substitute(getreg('"'),'^\s\+','',''),'c')
|
|
||||||
"endif
|
|
||||||
if col('.') >= col('$')
|
if col('.') >= col('$')
|
||||||
norm! ""p
|
norm! ""p
|
||||||
else
|
else
|
||||||
@ -502,7 +471,6 @@ function! s:opfunc(type,...) " {{{1
|
|||||||
set clipboard-=unnamed clipboard-=unnamedplus
|
set clipboard-=unnamed clipboard-=unnamedplus
|
||||||
let reg_save = getreg(reg)
|
let reg_save = getreg(reg)
|
||||||
let reg_type = getregtype(reg)
|
let reg_type = getregtype(reg)
|
||||||
"call setreg(reg,"\n","c")
|
|
||||||
let type = a:type
|
let type = a:type
|
||||||
if a:type == "char"
|
if a:type == "char"
|
||||||
silent exe 'norm! v`[o`]"'.reg.'y'
|
silent exe 'norm! v`[o`]"'.reg.'y'
|
||||||
@ -617,10 +585,6 @@ if !exists("g:surround_no_mappings") || ! g:surround_no_mappings
|
|||||||
endif
|
endif
|
||||||
imap <C-G>s <Plug>Isurround
|
imap <C-G>s <Plug>Isurround
|
||||||
imap <C-G>S <Plug>ISurround
|
imap <C-G>S <Plug>ISurround
|
||||||
"Implemented internally instead
|
|
||||||
"imap <C-S><C-S> <Plug>ISurround
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
|
||||||
|
|
||||||
" vim:set ft=vim sw=2 sts=2 et:
|
" vim:set ft=vim sw=2 sts=2 et:
|
||||||
|
Loading…
Reference in New Issue
Block a user