Builtin Tools

V has several built-in tools to simplify development.

v fmt

You don't need to worry about formatting your code or setting style guidelines. v fmt takes care of that:

v fmt -w file.v

With -w flag v fmt will overwrite the file with formatted code.

It's recommended to set up your editor, so that v fmt -w runs on every save. A vfmt run is usually pretty cheap (takes <30ms).

Always run v fmt -w file.v before pushing your code.

Disabling formatting

To disable formatting for a block of code, wrap it with // vfmt off and // vfmt on comments:

// Affected by fmt a := [1, 2, 3] // vfmt off // This code will not be formatted b := [ 1, 2, 3, ] // vfmt on // Affected by fmt c := [1, 2, 3]

v shader

You can use GPU shaders with V graphical apps. You write your shaders in an annotated GLSL dialect and use v shader to compile them for all supported target platforms.

v shader /path/to/project/dir/or/file.v

Currently, you need to include a header and declare a glue function before using the shader in your code.

On this page