diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2020-07-26 10:20:08 +0200 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-07-26 10:20:08 +0200 | 
| commit | 56121b4e27cb48efb17be55a969b2f0d725266f8 (patch) | |
| tree | 30df0f431705cdb72b2014177ce3f0655287a81c /autoload/csv.vim | |
| parent | 9c3c0bc082e0d58d15dc6f24d8a335931417e2f0 (diff) | |
| download | vim-polyglot-56121b4e27cb48efb17be55a969b2f0d725266f8.tar.gz vim-polyglot-56121b4e27cb48efb17be55a969b2f0d725266f8.zip | |
Update
Diffstat (limited to 'autoload/csv.vim')
| -rw-r--r-- | autoload/csv.vim | 14 | 
1 files changed, 9 insertions, 5 deletions
| 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(<bang>0)',          \ '-nargs=0 -bang') -    call csv#LocalCmd("Analyze", ':call csv#AnalyzeColumn(<args>)', -        \ '-nargs=?') +    call csv#LocalCmd("Analyze", ':call csv#AnalyzeColumn(<f-args>)', +        \ '-nargs=*' )      call csv#LocalCmd("VertFold", ':call csv#Vertfold(<bang>0,<q-args>)',          \ '-bang -nargs=? -range=% -complete=custom,csv#SortComplete')      call csv#LocalCmd("CSVFixed", ':call csv#InitCSVFixedWidth()', '') | 
