Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #152

Merged
merged 4 commits into from
Sep 3, 2023
Merged
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
1 change: 1 addition & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ indent_type = "Spaces"
indent_width = 4
quote_style = "ForceDouble"
call_parentheses = "NoSingleTable"
collapse_simple_statement = "FunctionOnly"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ require "paq" {

{ "lervag/vimtex", opt = true }, -- Use braces when passing options

{ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },
}
```

Expand All @@ -72,10 +72,10 @@ Then, source your configuration (using `:source %` or `:luafile %`) and run `:Pa
|--------|----------|-----------------------------------------------------------|
| as | string | Name to use for the package locally |
| branch | string | Branch of the repository |
| build | function | Lua function to run after install/update |
| build | string | Shell command to run after install/update |
| opt | boolean | Optional packages are not loaded on startup |
| pin | boolean | Pinned packages are not updated |
| run | string | Shell command to run after install/update |
| run | function | Lua function to run after install/update |
| url | string | URL of the remote repository, useful for non-GitHub repos |

For more details on each option, refer to the
Expand Down
59 changes: 32 additions & 27 deletions doc/paq-nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ imported as `paq`, the functions are:
|paq.install| *paq.install*
*:PaqInstall*
Installs all packages listed in your configuration. If a package is already
installed, the function ignores it. If a package has a `run` argument, it'll
be executed after the package is installed.
installed, the function ignores it. If a package has a `build` argument,
it'll be executed after the package is installed.


|paq.update| *paq.update*
*:PaqUpdate*
Updates the installed packages listed in your configuration. If a package
hasn't been installed with |PaqInstall|, the function ignores it.
If a package had changes and it has a `run` argument, then the `run`
argument will be executed.
hasn't been installed with |PaqInstall|, the function ignores it. If a
package had changes and it has a `build` argument, then the `build` argument
will be executed.


|paq.clean| *paq.clean*
Expand All @@ -125,12 +125,11 @@ imported as `paq`, the functions are:
out of order.


|paq._run_hook| *paq._run_hook*
*:PaqRunHook*
Takes as single argument a string with the name of a package. If the package
has a `run` hook (functions and shell commands), it will execute the hook.
This can be used when a hook fails, to run a hook without a package having
changed, or for other debugging purposes.
|PaqBuild| *:PaqBuild*
Takes as single argument with the name of a package. If the package has a
`build` option (function or shell command), it will execute it. This can be
used when a build fails, to run a build without a package having changed, or
for other debugging purposes.


|paq.list| *paq.list*
Expand Down Expand Up @@ -231,6 +230,26 @@ The options and their types are the following:
Default value: `nil`


`build` : function | string
Either a Lua function, a shell command, or an EX-command to be executed
after installing or updating a package. Useful for packages that require
a compiling step.

If a string, Paq will execute the string as a shell command in the
directory of the package (not in the current directory). If the first
character of the string is a `:`, it will be execute as vim `:command`.

If a function, Paq will execute the function right after installing
the package. The function cannot take any arguments.

Note that in Lua, you can use index notation to reference a VimL function
that contains special characters:
>lua
{ "<name-of-package>", build = vim.fn["<name-of-viml-function>"] }
<
Default value: `nil`


`opt` : boolean
Indicates whether the package is optional or not. If set, the package will
be in the optional packages directory. See |packages| and |packadd|.
Expand All @@ -246,21 +265,7 @@ The options and their types are the following:


`run` : string | function
Either a shell command or Lua function to be executed after installing or
updating a package. Useful for packages that require extra build steps.

If a string, Paq will execute the string as a shell command in the
directory of the package (not in the current directory). If the first
character of the string is a `:`, it will be execute as vim `:command`

If a function, Paq will execute the function right after installing
the package. The function cannot take any arguments.

Note that in Lua, you can wrap a VimL function like so:
>lua
{ "<name-of-package>", run = vim.fn["<name-of-viml-function>"] }
<
Default value: `nil`
Deprecated. Use `build` instead.


`url` : string
Expand Down Expand Up @@ -363,7 +368,7 @@ Here's a list of steps to take when something goes wrong with Paq:
so you might want to look from the bottom up.

4. If you think the error wasn't caused by git (or another external program
called with a hook), consider opening an issue on the paq-nvim GitHub
called with `build`), consider opening an issue on the paq-nvim GitHub
repository.

Some common issues are listed below.
Expand Down
Loading