summaryrefslogtreecommitdiff
path: root/dot_config/nvim/pre.fnl
diff options
context:
space:
mode:
authorChloƩ Vulquin <code@toast.bunkerlabs.net>2024-11-12 12:49:56 +0100
committerChloƩ Vulquin <code@toast.bunkerlabs.net>2024-11-12 12:49:56 +0100
commite6de67899a4fa0a896db40b3c0f1b5560c7ae3d7 (patch)
tree4a78d5281689ae108c58bc371ef844085cee7c4a /dot_config/nvim/pre.fnl
parentsh: add /tmp helpers (diff)
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.
Diffstat (limited to 'dot_config/nvim/pre.fnl')
-rw-r--r--dot_config/nvim/pre.fnl10
1 files changed, 10 insertions, 0 deletions
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))))))