diff options
author | Teddy Wing | 2023-10-06 19:56:46 +0200 |
---|---|---|
committer | Teddy Wing | 2023-11-06 20:54:14 +0100 |
commit | 79aff1844f1defbe73801efa6dd176b64baba917 (patch) | |
tree | ebfe7948671052e187d7b08d6226b9b434a35f50 /ftplugin/typescript.vim | |
parent | d54d9140ed15465d1b1e8569d11c580c95ec69e5 (diff) | |
download | dotvim-79aff1844f1defbe73801efa6dd176b64baba917.tar.bz2 |
ftplugin/typescript.vim: Add 'prettier' formatting
Set up formatting for the current buffer using 'prettier'.
Diffstat (limited to 'ftplugin/typescript.vim')
-rw-r--r-- | ftplugin/typescript.vim | 5 |
1 files changed, 5 insertions, 0 deletions
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 <silent> <buffer> <C-w><C-f> nnoremap <silent> <buffer> <C-w>gf \ :<C-u>call <SID>FindFile(v:count1, expand('<cfile>'), 'tabfind', '<C-v><C-w>gf')<CR> +nnoremap <buffer> Zf + \ :<C-u>execute 'silent !prettier --write ' . shellescape(expand('%')) + \ <Bar> redraw!<CR> + let b:undo_ftplugin .= 'nunmap <buffer> gf' let b:undo_ftplugin .= '| nunmap <buffer> <C-w>f' let b:undo_ftplugin .= '| nunmap <buffer> <C-w><C-f>' let b:undo_ftplugin .= '| nunmap <buffer> <C-w>gf' +let b:undo_ftplugin .= '| nunmap <buffer> Zf' if exists('*s:FindFile') |