sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

Makeshift : Selects the right 'makeprg' for your build system

 script karma  Rating 14/6, Downloaded by 1576    Comments, bugs, improvements  Vim wiki

created by
Pete Johns
script type

You'll want to use this plugin if you work on a lot of projects with different build systems. You want your editor to be able to detect your current build system and set 'makeprg' accordingly.

To make building really fast, map the :make command to a function key in your vimrc.

nnoremap <F5> :<C-U>make<CR>

How it works

This plug-in works by looking for known build files in the current working directory upwards, and sets 'makeprg'; by default this happens on start-up. You can use the command to re-evaluate 'makeprg':


Sometimes your build script won't be in the current working directory, this is particularly common when 'autochdir' is set. For this reason :Makeshift sets b:makeshift_root to be the directory containing the build script that it used to determine the build system.

:MakeshiftBuild is a wrapper around Vim's own :make command, which changes directory to b:makeshift_root before calling :make with any arguments you provide and then returns to your working directory. If you often work in subdirectories, you may want to map the :MakeshiftBuild command to a function key in your vimrc:

nnoremap <F5> :<C-U>MakeshiftBuild<CR>
nnoremap <F6> :<C-U>MakeshiftBuild check<CR>

Alternatively you can use the makeshift_chdir option to automatically change the current working directory to the one containing your build script.


To tune the behaviour of this plugin, add any of the following switches to your vimrc:

let g:makeshift_on_startup = 0

To prevent Makeshift from setting 'makeprg' on BufRead:

let g:makeshift_on_bufread = 0

To prevent Makeshift from setting 'makeprg' on BufNewFile:

let g:makeshift_on_bufnewfile = 0

To prevent Makeshift from setting 'makeprg' on BufEnter:

let g:makeshift_on_bufenter = 0

To automatically change directory to 'b:makeshift_root' when it is discovered:

let g:makeshift_chdir = 1

To try the build file in the current directory before searching from the file directory:

let g:makeshift_use_pwd_first = 1

To enable search for bundled build program/script:

let g:makeshift_find_bundled = 1

Build Systems

Makeshift currently associates the following files with their build systems:

* Jamfile: bjam
* Makefile: make
* GNUmakefile: make
* Rakefile: rake
* SConstruct: scons
* build.gradle: gradle
* build.xml: ant
* mix.exs: mix
* pom.xml: mvn
* build.ninja: ninja
* wscript: waf

Adding a new build system

If Makeshift doesn't already know about your build system, or you wish to override the default program for a given file, you can define a dictionary, which has filenames as keys and corresponding programs as values.

let g:makeshift_systems = {
    'build.sbt ': 'sbt',

Removing a build system

If you don't want Makeshift to set 'makeprg' for a given build system, you can disable it by defining a list of the files to ignore.

let g:makeshift_ignored = ['Jamfile']


Makeshift is licensed under the same terms as Vim itself (see :help license).


If you find this plug-in useful, please follow this repository on GitHub and vote for it vim.org. If you have something to say, you can contact @johnsyweb on Twitter and GitHub.

Many thanks

I'm grateful for contributions to what was a solo project (hooray for GitHub)! If you'd like to thank the contributors, you can find their details here:


You can grab the latest version of this plugin, submit an improvement or report a bug on GitHub:


install details
I recommend installing pathogen.vim (vimscript#2332), and then simply copy and paste:

cd ~/.vim/bundle
git clone git://github.com/johnsyweb/vim-makeshift.git
vim -cHelptags

Once help tags have been generated, you can view the manual with

:help makeshift

Alternatively, just unzip the file into your 'runtimepath' and run :helptags.

Rating scripts is only available on the HTTPS page

script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-makeshift-0.15.0.zip 0.15.0 2017-02-01 7.0 Pete Johns https://github.com/johnsyweb/vim-makeshift/releases/tag/0.15.0
vim-makeshift-0.14.0.zip 0.14.0 2014-11-20 7.0 Pete Johns https://github.com/johnsyweb/vim-makeshift/releases/tag/0.14.0
vim-makeshift-0.13.0.zip 0.13.0 2014-10-11 7.0 Pete Johns https://github.com/johnsyweb/vim-makeshift/compare/0.12.0...0.13.0
vim-makeshift-0.12.0.zip 0.12.0 2014-04-26 7.0 Pete Johns https://github.com/johnsyweb/vim-makeshift/compare/0.11.0...0.12.0
vim-makeshift-0.11.0.zip 0.11.0 2014-04-18 7.0 Pete Johns https://github.com/johnsyweb/vim-makeshift/compare/0.10.0...0.11.0
vim-makeshift-0.10.0.zip 0.10.0 2014-03-21 7.0 Pete Johns https://github.com/johnsyweb/vim-makeshift/compare/v0.9...0.10.0
vim-makeshift-0.9.zip 0.9 2014-02-27 7.0 Pete Johns https://github.com/johnsyweb/vim-makeshift/compare/v0.8...v0.9
vim-makeshift-0.8.zip 0.8 2014-01-13 7.0 Pete Johns Add support for Gradle (thanks to Simon Lundström)
vim-makeshift-0.7.zip 0.7 2013-11-02 7.0 Pete Johns Add g:makeshift_root and :MakeshiftBuild
Allow for passing arguments to :MakeshiftBuild
Fix typo
Add help for g:makeshift_root and :MakeshiftBuild
Update README for v0.7
Bump version to 0.7
vim-makeshift-0.6.zip 0.6 2013-05-18 7.0 Pete Johns 13d7f84 makeshift_define_command works around issue #2
8c6361a Admit issue
3d36530 Tidy whitespace
vim-makeshift-0.4.zip 0.4 2012-11-25 7.0 Pete Johns * cccc476 - (HEAD, v0.4, origin/master, master) v0.4 (7 minutes ago) <Pete Johns>
* b46c503 - Don't set makeprg=0 if no makefile is found. (7 days ago) <Pete Johns>
johnsyweb-vim-makeshift-v0.3-0-g3ed1848.zip 0.3 2012-10-26 7.0 Pete Johns * 3ed1848 - (HEAD, v0.3, origin/master, master) Bumped version. (5 minutes ago) <Pete Johns>
* ce66a04 - Automatic re-evaluation on BufRead (4 days ago) <Pete Johns>
* 336dfe1 - Dig upwards for build system (4 days ago) <Pete Johns>
makeshift.zip 0.2 2012-10-22 7.0 Pete Johns Issue #1: CMake does not generate a Makefile
makeshift.zip 0.1 2012-10-21 7.0 Pete Johns Initial upload
ip used for rating:

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.
SourceForge.net Logo