From e6de67899a4fa0a896db40b3c0f1b5560c7ae3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Vulquin?= Date: Tue, 12 Nov 2024 12:49:56 +0100 Subject: nvim: add editorconfig ft extension This is NOT an optimal or reliable solution. I want to take a closer look at it later, but right now I don't have the time. --- dot_config/nvim/pre.fnl | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'dot_config/nvim/pre.fnl') diff --git a/dot_config/nvim/pre.fnl b/dot_config/nvim/pre.fnl index 0b2c9af..a22a233 100644 --- a/dot_config/nvim/pre.fnl +++ b/dot_config/nvim/pre.fnl @@ -35,3 +35,13 @@ :* (recc :vim.ui.clipboard.osc52 :copy :*)} :paste {:+ (recc :vim.ui.clipboard.osc52 :paste :+) :* (recc :vim.ui.clipboard.osc52 :paste :*)}}))) + +; editorconfig extensions +(let [ec (require :editorconfig)] + (set ec.properties.filetype + (fn [bufnr val opts] + (let [bo (. vim.bo bufnr)] + (when (not= bo.filetype val) + (set bo.filetype val) + ; otherwise the change in ft will override editorconfig settings + (ec.config bufnr)))))) -- cgit v1.2.3