The Wayback Machine - https://web.archive.org/web/20210122064250/https://github.com/AlxHnr/build.vim
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
doc
 
 
 
 
 
 
 
 
 
 

README.md

This plugin provides commands for using the build system to which the current file belongs. It searches from each files directory upwards for Makefiles and the like.

Note: If the current file does not belong to any known build systems, it will be build using associated compilers. E.g. C files will be build using gcc.

Usage Examples

CMake

Your project may look like this:

├── CMakeLists.txt
└── src/
    └── main.cpp

Open any file in the project and use the following command to initialize CMake. Optional arguments can be provided:

:Build init -DCMAKE_BUILD_TYPE=Release

The :Build command runs make inside the build directory. It takes optional arguments which will be passed directly to make:

:Build build -j20
:Build build all
:Build test
:Build clean

Note: Running :Build without any arguments is equivalent to :Build build.

CMake with subdirectories

Your project may look like this:

├── CMakeLists.txt
├── src/
│   └── main.cpp
└── util/
    ├── CMakeLists.txt
    ├── util.cpp
    └── misc/
        ├── CMakeLists.txt
        └── misc.cpp

Set the current working directory to the directory containing the main CMakeLists.txt and proceed as in the previous example:

:lchdir ~/path/to/project
:Build init -DCMAKE_BUILD_TYPE=Release
:Build
:Build --target my_target

Note: You can use this plugin to set the working directory automatically.

Autotools

Your project may look like this:

├── configure
├── Makefile.in
├── LICENSE
├── README
└── src/
    └── main.c
    └── foo.h
    └── foo.c

Open any file in the project and configure the build using the following command. Optional configure flags can be provided:

:Build init --enable-gtk --without-foo --prefix="$HOME/.local"

Then run make using the :Build command:

:Build
:Build clean
:Build build -j8 --keep-going --dry-run

Plain C files

If the current file does not belong to a build system, it can be compiled using the :Build command. This plugin defines three subcommands for C files:

:Build build
:Build run
:Build clean

Pass custom arguments to the compiler:

:Build build -Wall -Wextra -Werror -pedantic

Note: If :Build is called without arguments it will be equivalent to :Build build.

Python, Bash and other scripting languages

For some files which don't belong to a build system, the run target will be defined:

:Build run