我在我的vimrc中有这些:
if has("autocmd")
augroup Misc
" Jump to the last known position when reopening a file
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
augroup FTOptions
autocmd!
autocmd FileType cpp,java setlocal commentstring=//\ %s
autocmd FileType markdown setlocal textwidth=78 formatprg=par\ -w78
augroup END
Run Code Online (Sandbox Code Playgroud)
在markdown文件中,我想使用par进行格式化.它运行良好,但如果系统上没有安装"par",我会收到警告.我想知道是否有办法检查并且只在安装par时设置"formatprg = par\-78",否则使用VIM的默认格式.
我会很感激任何建议.