diff options
Diffstat (limited to 'ftplugin/csv.vim')
-rw-r--r-- | ftplugin/csv.vim | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/ftplugin/csv.vim b/ftplugin/csv.vim index b6414d9f..9d8df120 100644 --- a/ftplugin/csv.vim +++ b/ftplugin/csv.vim @@ -160,7 +160,7 @@ fu! <sid>Init(startline, endline) "{{{3 " \ delf <sid>PrepareFolding | delf <sid>OutputFilters | " \ delf <sid>SortFilter | delf <sid>GetColumn | " \ delf <sid>RemoveLastItem | delf <sid>DisableFolding | - " \ delf <sid>GetSID | delf <sid>CheckHeaderLine | + " \ delf <sid>CheckHeaderLine | " \ delf <sid>AnalyzeColumn | delf <sid>Vertfold | " \ delf <sid>InitCSVFixedWidth | delf <sid>LocalCmd | " \ delf <sid>CommandDefinitions | delf <sid>NumberFormat | @@ -806,18 +806,18 @@ fu! <sid>GetColPat(colnr, zs_flag) "{{{3 else if a:colnr >= len(b:csv_fixed_width_cols) " Get last column - let pat='\%' . b:csv_fixed_width_cols[-1] . 'c.*' + let pat='\%' . b:csv_fixed_width_cols[-1] . 'v.*' else let pat='\%' . b:csv_fixed_width_cols[(a:colnr - 1)] . - \ 'c.\{-}\%' . b:csv_fixed_width_cols[a:colnr] . 'c' + \ 'c.\{-}\%' . b:csv_fixed_width_cols[a:colnr] . 'v' endif endif elseif !exists("b:csv_fixed_width_cols") let pat=b:col else - let pat='\%' . b:csv_fixed_width_cols[0] . 'c.\{-}' . + let pat='\%' . b:csv_fixed_width_cols[0] . 'v.\{-}' . \ (len(b:csv_fixed_width_cols) > 1 ? - \ '\%' . b:csv_fixed_width_cols[1] . 'c' : + \ '\%' . b:csv_fixed_width_cols[1] . 'v' : \ '') endif return pat . (a:zs_flag ? '\zs' : '') @@ -1078,12 +1078,12 @@ fu! <sid>Sort(bang, line1, line2, colnr) range "{{{3 if !exists("b:csv_fixed_width_cols") let pat= '^' . <SID>GetColPat(col-1,1) . b:col else - let pat= '^' . <SID>GetColPat(col,0) + let pat= <SID>GetColPat(col,0) endif else let pat= '^' . <SID>GetColPat(col,0) endif - exe a:line1 ',' a:line2 . "sort" . (a:bang ? '!' : '') . + exe a:line1. ','. a:line2. "sort". (a:bang ? '!' : '') . \' r ' . (numeric ? 'n' : '') . ' /' . pat . '/' call winrestview(wsv) endfun @@ -1488,12 +1488,11 @@ fu! <sid>PrepareFolding(add, match) "{{{3 " for val in sort(values(b:csv_filter), '<sid>SortFilter') " let @/ .= val.pat . (val.id == s:filter_count ? '' : '\&') " endfor - let sid = <sid>GetSID() " Fold settings: call <sid>LocalSettings('fold') " Don't put spaces between the arguments! - exe 'setl foldexpr=<snr>' . sid . '_FoldValue(v:lnum,b:csv_filter)' + exe 'setl foldexpr=<snr>' . s:SID . '_FoldValue(v:lnum,b:csv_filter)' " Move folded area to the bottom, so there is only on consecutive " non-folded area @@ -1541,8 +1540,7 @@ fu! <sid>OutputFilters(bang) "{{{3 call <sid>Warn("No filters defined currently!") return else - let sid = <sid>GetSID() - exe 'setl foldexpr=<snr>' . sid . '_FoldValue(v:lnum,b:csv_filter)' + exe 'setl foldexpr=<snr>' . s:SID . '_FoldValue(v:lnum,b:csv_filter)' endif endif endfu @@ -1588,14 +1586,11 @@ fu! <sid>DisableFolding() "{{{3 endif endfu -fu! <sid>GetSID() "{{{3 - if v:version > 703 || v:version == 703 && has("patch032") - return maparg('W', "", "", 1).sid - else - "return substitute(maparg('W'), '\(<SNR>\d\+\)_', '\1', '') - return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_GetSID$') - endif +fu! <sid>DetermineSID() + let s:SID = matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_DetermineSID$') endfu +call s:DetermineSID() +delf s:DetermineSID fu! <sid>NumberFormat() "{{{3 let s:nr_format = [',', '.'] |