sponsor Vim development Vim logo Vim Book Ad

makeprgs : Set makeprg and compiler type based on globbed files

 script karma  Rating 15/6, Downloaded by 837  Comments, bugs, improvements  Vim wiki

created by
Richard Quirk
 
script type
utility
 
description
If you work on several different projects, chances are you will come across Makefile, Ant or SCons based build systems. If you have <F5> mapped to :make with ":nmap <F5> :make<CR>" then it would be nice if the correct build program were used. That is the purpose of this script. It also maps <F5> as mentioned.

The script checks if the file SConstruct or SConscript is in the current directory and if so sets the makeprg to scons, or scons -u for scripts.

If GNUmakefile, makefile or Makefile are found in the current directory, then the makeprg value is set to make.

If build.xml is found, then "ant" is the assumed compiler - i.e. ":compiler ant" is called.

A global variable makeprgs_make_types can be set to extend the functionality somewhat. Example included in the doc/*.txt file.

The file detection is pretty crude - it runs a glob in the CWD and if the files are found sets the appropriate value. I hope you find it useful.

Tested on Vim 7.0 and 7.1, but should work on earlier releases (6.0 at least).
 
install details
The tar contains plugin/makeprgs.vim and doc/makeprgs.txt, so one should use these commands to install:

cd $HOME/.vim
tar xzvf /path/to/makeprgs.tar.gz

Then in Vim, run :helptags ~/.vim/doc to generate the help. :help makeprgs will show the help file with extra details on customising.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
makeprgs-20070928.tar.gz 0.1 2007-09-28 6.0 Richard Quirk Initial upload
ip used for rating: 18.223.111.48

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github