From 527a85bf11c040b2748bf627001b3f62a5c19482 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 7 May 2023 21:17:17 +0100 Subject: [PATCH] home: vim: ftdetect: switch to lua It looks like `vim.filetype.add` is smarter about "local.am". For some reason opening an *empty* Tiger file results in a backtrace... --- home/vim/ftdetect/automake.lua | 6 ++++++ home/vim/ftdetect/automake.vim | 2 -- home/vim/ftdetect/direnv.lua | 6 ++++++ home/vim/ftdetect/direnv.vim | 2 -- home/vim/ftdetect/tiger.lua | 7 +++++++ home/vim/ftdetect/tiger.vim | 3 --- home/vim/ftdetect/tikz.lua | 6 ++++++ home/vim/ftdetect/tikz.vim | 2 -- 8 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 home/vim/ftdetect/automake.lua delete mode 100644 home/vim/ftdetect/automake.vim create mode 100644 home/vim/ftdetect/direnv.lua delete mode 100644 home/vim/ftdetect/direnv.vim create mode 100644 home/vim/ftdetect/tiger.lua delete mode 100644 home/vim/ftdetect/tiger.vim create mode 100644 home/vim/ftdetect/tikz.lua delete mode 100644 home/vim/ftdetect/tikz.vim diff --git a/home/vim/ftdetect/automake.lua b/home/vim/ftdetect/automake.lua new file mode 100644 index 0000000..cfa15d2 --- /dev/null +++ b/home/vim/ftdetect/automake.lua @@ -0,0 +1,6 @@ +-- Use Automake filetype for `local.am` files, explicit `set` to force override +vim.filetype.add({ + filename = { + ["local.am"] = "automake", + }, +}) diff --git a/home/vim/ftdetect/automake.vim b/home/vim/ftdetect/automake.vim deleted file mode 100644 index 5cc73b0..0000000 --- a/home/vim/ftdetect/automake.vim +++ /dev/null @@ -1,2 +0,0 @@ -" Use Automake filetype for `local.am` files, explicit `set` to force override -au BufNewFile,BufRead local.am set filetype=automake diff --git a/home/vim/ftdetect/direnv.lua b/home/vim/ftdetect/direnv.lua new file mode 100644 index 0000000..fba9748 --- /dev/null +++ b/home/vim/ftdetect/direnv.lua @@ -0,0 +1,6 @@ +-- Use bash filetype for `.envrc` files +vim.filetype.add({ + filename = { + [".envrc"] = "bash", + }, +}) diff --git a/home/vim/ftdetect/direnv.vim b/home/vim/ftdetect/direnv.vim deleted file mode 100644 index 44fb811..0000000 --- a/home/vim/ftdetect/direnv.vim +++ /dev/null @@ -1,2 +0,0 @@ -" Use bash filetype for `.envrc` files -au BufNewFile,BufRead .envrc setfiletype bash diff --git a/home/vim/ftdetect/tiger.lua b/home/vim/ftdetect/tiger.lua new file mode 100644 index 0000000..a261103 --- /dev/null +++ b/home/vim/ftdetect/tiger.lua @@ -0,0 +1,7 @@ +-- Use Tiger filetype for programs and header files +vim.filetype.add({ + extension = { + tig = "tiger", + tih = "tiger", + }, +}) diff --git a/home/vim/ftdetect/tiger.vim b/home/vim/ftdetect/tiger.vim deleted file mode 100644 index d474fd7..0000000 --- a/home/vim/ftdetect/tiger.vim +++ /dev/null @@ -1,3 +0,0 @@ -" Use Tiger filetype for programs and header files -au BufNewFile,BufRead *.tig setfiletype tiger -au BufNewFile,BufRead *.tih setfiletype tiger diff --git a/home/vim/ftdetect/tikz.lua b/home/vim/ftdetect/tikz.lua new file mode 100644 index 0000000..93b7db0 --- /dev/null +++ b/home/vim/ftdetect/tikz.lua @@ -0,0 +1,6 @@ +-- Use LaTeX filetype for TikZ files +vim.filetype.add({ + extension = { + tikz = "tex", + }, +}) diff --git a/home/vim/ftdetect/tikz.vim b/home/vim/ftdetect/tikz.vim deleted file mode 100644 index 7327b11..0000000 --- a/home/vim/ftdetect/tikz.vim +++ /dev/null @@ -1,2 +0,0 @@ -" Use LaTeX filetype for TikZ files -au BufNewFile,BufRead *.tikz setfiletype tex