From 79aff1844f1defbe73801efa6dd176b64baba917 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 6 Oct 2023 19:56:46 +0200 Subject: ftplugin/typescript.vim: Add 'prettier' formatting Set up formatting for the current buffer using 'prettier'. --- ftplugin/typescript.vim | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ftplugin') diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim index 94b9c9e..fb9fc46 100644 --- a/ftplugin/typescript.vim +++ b/ftplugin/typescript.vim @@ -16,10 +16,15 @@ nnoremap nnoremap gf \ :call FindFile(v:count1, expand(''), 'tabfind', 'gf') +nnoremap Zf + \ :execute 'silent !prettier --write ' . shellescape(expand('%')) + \ redraw! + let b:undo_ftplugin .= 'nunmap gf' let b:undo_ftplugin .= '| nunmap f' let b:undo_ftplugin .= '| nunmap ' let b:undo_ftplugin .= '| nunmap gf' +let b:undo_ftplugin .= '| nunmap Zf' if exists('*s:FindFile') -- cgit v1.2.3