Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find path of an executable in vim

Tags:

vim

On some machines I'm using an external executable to format text (it's named 'par'). Therefore I'd like to detect if the executable is installed.

Edit: I just want to detect if the executable is available in my .vimrc itself. So I prefer internal functions over external utils like 'which'. Prince Goulash's solution is already very helpful and I'm going with it, despite I'd prefer finding the exact path. Thanks.

like image 648
urso Avatar asked Sep 15 '11 12:09

urso


1 Answers

You can use the vimscript function executable(), which returns 1 if its argument exists and is executable, and 0 otherwise. It doesn't return the path of the file, though. See help executable for more info.

like image 126
Prince Goulash Avatar answered Sep 27 '22 19:09

Prince Goulash