From b4a42bf58309474cd20fa30ce9bbd9dbeadbfe8f Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Fri, 18 Jul 2025 08:50:24 -0500 Subject: [PATCH] nvim: add typescript ftplugin --- .config/nvim/after/ftplugin/typescript.fnl | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .config/nvim/after/ftplugin/typescript.fnl diff --git a/.config/nvim/after/ftplugin/typescript.fnl b/.config/nvim/after/ftplugin/typescript.fnl new file mode 100644 index 00000000..ce543307 --- /dev/null +++ b/.config/nvim/after/ftplugin/typescript.fnl @@ -0,0 +1,12 @@ +(when (= 1 (vim.fn.executable "prettier")) + (let [buf (vim.api.nvim_get_current_buf) + fname (vim.api.nvim_buf_get_name buf)] + (vim.system + ["prettier" "--find-config-path" fname] + {} + (fn [{: code : stdout}] + (let [config (vim.trim stdout)] + (when (and (= 0 code) (= 1 (vim.fn.filereadable config))) + (vim.schedule #(do + (tset vim.bo buf :formatprg (: "prettier --config %s --stdin-filepath %s" :format config fname)) + (tset vim.bo buf :formatexpr ""))))))))) -- knotmirror 0.0.1