robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Christian Clasonvim-patch:1ce65e3: runtime(csv): include a simple csv filetype and syntax plugin (#29395)fe5d1279a4

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