2016-07-28 4 views
1

をインストールされているかどうかを確認、私は私のvimrcでこれらを持っている:私はparを使用して書式設定を行うにはしたいと思います値下げファイルでのvimrcは:UNIXコマンドは

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 

。うまくいきますが、 "par"がシステムにインストールされていないと警告が表示されます。確認する方法があり、parがインストールされている場合にのみ "formatprg = par \ -78"を設定するか、そうでなければVIMのデフォルトの書式設定を使用するかどうか疑問に思っています。

私はどんな提案にも感謝します。

答えて

6
if executable('par') 
    " stuff 
endif