Sun, 05 May 2024 13:24:32 -0500
Convert backup/undofile pruning to lua
1022 | 1 | func! vimrc#AutoFmtToggle() abort |
2 | if &formatoptions =~# 'a' | |
3 | setl formatoptions-=a | echo '-a' | |
4 | else | |
5 | setl formatoptions+=a | echo '+a' | |
6 | endif | |
7 | endfunc | |
8 | ||
9 | func! vimrc#SafeFilterFile(cmd) | |
10 | let errors = tempname() | |
11 | try | |
12 | exec 'silent %!' . a:cmd . ' 2>' . shellescape(errors) | |
13 | if v:shell_error | |
14 | for line in readfile(errors) | |
15 | echomsg line | |
16 | endfor | |
17 | endif | |
18 | finally | |
19 | call delete(errors) | |
20 | endtry | |
21 | endfunc |