aboutsummaryrefslogtreecommitdiff
path: root/vim/ftdetect
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-10-30 14:44:15 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-10-30 14:44:15 +1300
commit2ec6966a06ea4fa55f8a0fcf68e08a6e0c60332a (patch)
tree3e61728d8f982e37343a5498e49f459914ec30f2 /vim/ftdetect
parentUse :setfiletype in lieu of :setlocal filetype= (diff)
downloaddotfiles-2ec6966a06ea4fa55f8a0fcf68e08a6e0c60332a.tar.gz
dotfiles-2ec6966a06ea4fa55f8a0fcf68e08a6e0c60332a.zip
Add detection, tweak indent/whitespace for CSV/TSV
Vim does not seem to have any built-in detection or settings for CSV or TSV files, so I've added a couple here, based on filename patterns matching the .csv and .tsv extensions. If either of these types are detected, the 'autoindent' and 'expandtab' options are both switched off, as they're undesirable, especially in TSVs where a literal tab is almost certainly what's intended. Ideally, these same two setting would apply to any filetype not otherwise categorisable, but I can't figure out a way to do that safely yet; there was an attempt made in d3d998c.
Diffstat (limited to 'vim/ftdetect')
-rw-r--r--vim/ftdetect/csv.vim7
-rw-r--r--vim/ftdetect/tsv.vim7
2 files changed, 14 insertions, 0 deletions
diff --git a/vim/ftdetect/csv.vim b/vim/ftdetect/csv.vim
new file mode 100644
index 00000000..4a2d082f
--- /dev/null
+++ b/vim/ftdetect/csv.vim
@@ -0,0 +1,7 @@
+" Add automatic commands to detect CSV files
+augroup dfcsv
+ autocmd!
+ autocmd BufNewFile,BufRead
+ \ *.csv
+ \ setfiletype csv
+augroup END
diff --git a/vim/ftdetect/tsv.vim b/vim/ftdetect/tsv.vim
new file mode 100644
index 00000000..7cfaf1b8
--- /dev/null
+++ b/vim/ftdetect/tsv.vim
@@ -0,0 +1,7 @@
+" Add automatic commands to detect TSV files
+augroup dftsv
+ autocmd!
+ autocmd BufNewFile,BufRead
+ \ *.tsv
+ \ setfiletype tsv
+augroup END