vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

csv.vim (459B)


      1 vim9script
      2 
      3 # Maintainer: Maxim Kim <habamax@gmail.com>
      4 # Last Update: 2024-06-18
      5 
      6 if !exists("b:csv_delimiter")
      7     # detect delimiter
      8     var delimiters = ",;\t|"
      9 
     10     var max = 0
     11     for d in delimiters
     12         var count = getline(1)->split(d)->len() + getline(2)->split(d)->len()
     13         if count > max
     14             max = count
     15             b:csv_delimiter = d
     16         endif
     17     endfor
     18 endif
     19 
     20 if exists("b:did_ftplugin")
     21     finish
     22 endif
     23 b:did_ftplugin = 1