From 56121b4e27cb48efb17be55a969b2f0d725266f8 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sun, 26 Jul 2020 10:20:08 +0200 Subject: Update --- autoload/csv.vim | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'autoload/csv.vim') diff --git a/autoload/csv.vim b/autoload/csv.vim index 2adcf1bb..8561f30f 100644 --- a/autoload/csv.vim +++ b/autoload/csv.vim @@ -1956,8 +1956,12 @@ fu! csv#CheckHeaderLine() "{{{3 endfu fu! csv#AnalyzeColumn(...) "{{{3 let maxcolnr = csv#MaxColumns() - if len(a:000) == 1 + let topn = 5 + if len(a:000) > 0 let colnr = a:1 + if len(a:000) == 2 + let topn = a:2 + endif else let colnr = csv#WColumn() endif @@ -1985,8 +1989,8 @@ fu! csv#AnalyzeColumn(...) "{{{3 let max_items = reverse(sort(values(res), s:csv_numeric_sort ? 'n' : 'csv#CSVSortValues')) " What about the minimum 5 items? let count_items = keys(res) - if len(max_items) > 5 - call remove(max_items, 5, -1) + if len(max_items) > topn + call remove(max_items, topn, -1) call map(max_items, 'printf(''\V%s\m'', escape(v:val, ''\\''))') call filter(res, 'v:val =~ ''^''.join(max_items, ''\|'').''$''') endif @@ -2311,8 +2315,8 @@ fu! csv#CommandDefinitions() "{{{3 \ '-bang -nargs=? -range=%') call csv#LocalCmd("Filters", ':call csv#OutputFilters(0)', \ '-nargs=0 -bang') - call csv#LocalCmd("Analyze", ':call csv#AnalyzeColumn()', - \ '-nargs=?') + call csv#LocalCmd("Analyze", ':call csv#AnalyzeColumn()', + \ '-nargs=*' ) call csv#LocalCmd("VertFold", ':call csv#Vertfold(0,)', \ '-bang -nargs=? -range=% -complete=custom,csv#SortComplete') call csv#LocalCmd("CSVFixed", ':call csv#InitCSVFixedWidth()', '') -- cgit v1.2.3