" Also there is :Brsplit command behaving similarly, but it splits other
" types of brackets: "{}", "[]".
-if exists("g:loaded_defsplit") | finish | endif
-let g:loaded_defsplit = 1
if !exists("g:defsplit_shift") | let g:defsplit_shift = " " | endif
+if exists('*<SID>Defsplit') | finish | endif
function! s:bracket_find(brs_allowable, line, offset)
let possible = []
return min(possible)
endfunction
-function! s:defsplit(brs_allowable, single_line_comma, ...)
+function! s:Defsplit(brs_allowable, single_line_comma, ...)
if a:0 == 0 | let skip = 0 | else | let skip = str2nr(a:1) | endif
let shift = g:defsplit_shift
let line = getline(".")
let [curly, round, squar, outbuf] = [0, 0, 0, ""]
let ready = [strpart(line, 0, brfirst + 1)]
let trailing_comma = 1
- for c in split(line[brfirst + 1 : brlast-1], "\zs")
+ for c in split(line[brfirst + 1 : brlast-1], '\zs')
if c ==# "*" | let trailing_comma = 0 | endif
if outbuf ==# "" && c ==# " " | continue | endif
let outbuf .= c
normal "_dd
endfunction
-command! -nargs=? Defsplit call s:defsplit(["("], v:false, <f-args>)
-command! -nargs=? Brsplit call s:defsplit(["(", "[", "{"], v:false, <f-args>)
-command! -nargs=? Defsplits call s:defsplit(["("], v:true, <f-args>)
-command! -nargs=? Brsplits call s:defsplit(["(", "[", "{"], v:true, <f-args>)
+command! -nargs=? Defsplit call s:Defsplit(["("], v:false, <f-args>)
+command! -nargs=? Brsplit call s:Defsplit(["(", "[", "{"], v:false, <f-args>)
+command! -nargs=? Defsplits call s:Defsplit(["("], v:true, <f-args>)
+command! -nargs=? Brsplits call s:Defsplit(["(", "[", "{"], v:true, <f-args>)
command! Undefsplit normal ^v%$J:keepp s/^\(.*\)\([([{]\) \(.*[^,]\),\?\([)\]}]\)\(.*\)$/\1\2\3\4\5<CR>:keepp s/, \?\([)\]}]\+\)$/\1/e<CR>:<CR>