Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 26 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ⚒️ builder.nvim

Simple building plugin for neovim inspired by the Build Tool from Sublime Text.

| Default |
Expand All @@ -9,19 +10,18 @@ Simple building plugin for neovim inspired by the Build Tool from Sublime Text.
| ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| ![vert](https://github.com/trimclain/builder.nvim/assets/84108846/1e2ee23a-6ad1-4a3a-b8b1-893403f5c01c) | ![float](https://github.com/trimclain/builder.nvim/assets/84108846/6f94dc76-b652-4ac8-b54e-c3d19aaebdaa) |


## Demo

https://github.com/trimclain/builder.nvim/assets/84108846/c2468898-e5c6-4786-bf37-9dc780261cc7


## Requirements
- [Neovim](https://neovim.io) >= 0.9.0

- [Neovim](https://neovim.io) >= 0.9.0

## Installation

Using [lazy.nvim](https://github.com/folke/lazy.nvim) *(recommended)*

```lua
{
"trimclain/builder.nvim",
Expand All @@ -37,7 +37,9 @@ Using [lazy.nvim](https://github.com/folke/lazy.nvim) *(recommended)*
},
}
```

Using [packer.nvim](https://github.com/wbthomason/packer.nvim)

```lua
use {
"trimclain/builder.nvim",
Expand All @@ -52,10 +54,10 @@ use {
}
```


## Configuration

Builder comes with the following defaults:

```lua
{
-- location of Builder buffer; opts: "bot", "top", "vert" or float
Expand Down Expand Up @@ -88,18 +90,20 @@ Builder comes with the following defaults:
-- for lua and vim filetypes `:source %` will be used by default
commands = {},
}


```

When creating a command, there are following available variables

- `%` — path to the current file from the current working directory
- `$file` — current file name with extension
- `$basename` — basename of the file
- `$ext` — current file extension
- `$path` — full path to the file
- `$dir` — current working directory
- `$dir` — parent folder of the file
- `$pwd` — current working directory (what you get with `:pwd`)

This is an example of what `commands` could look like

```lua
commands = {
c = "gcc % -o $basename.out && ./$basename.out",
Expand All @@ -123,32 +127,38 @@ This is an example of what `commands` could look like
},
```


## Usage

Run `:Build` to build/run current file/project using the command for current filetype from `commands` table.
Run `:Build` to build/run current file/project using the command
for current filetype from `commands` table.
You can also pass different `size` and `type` arguments:
```

```vim
:Build size=0.4 type=vert
```

or
```

```vim
:lua require("builder").build({ type = "float" })
```

To build with the alternative command use:
```

```vim
:Build alt=true
```

To enable colored output use:
```

```vim
:Build color=true
```


## Feedback

If you have any questions or would like to see any new features, feel free to open a new [Issue](https://github.com/trimclain/builder.nvim/issues).

If you have any questions or would like to see any new features,
feel free to open a new [Issue](https://github.com/trimclain/builder.nvim/issues).

## Credit

Expand Down
1 change: 1 addition & 0 deletions lua/builder/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ function M.substitute(cmd)
cmd = cmd:gsub("$basename", vim.fn.expand("%:t:r"))
cmd = cmd:gsub("$path", vim.fn.expand("%:p"))
cmd = cmd:gsub("$dir", vim.fn.expand("%:p:h"))
cmd = cmd:gsub("$pwd", vim.fn.escape(vim.fn.getcwd(), "/\\"))
return cmd
end

Expand Down