https://github.com/chrisgrieser/nvim-justice
Just an integration of `just` in nvim.
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: researchgate.net -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.7%) to scientific vocabulary
Keywords
Repository
Just an integration of `just` in nvim.
Basic Info
Statistics
- Stars: 25
- Watchers: 0
- Forks: 1
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
nvim-justice ⚖️
Just an integration of just in nvim.
Table of contents
- Features
- Installation
- Configuration
- Usage
- Advanced usage
- More
justtooling for nvim - About the author
Features
- Quick-select recipes via keys shown at the left of the window. Running recipes thus requires only 2–3 keystrokes.
- As opposed to vim's builtin
:make, always runs asynchronously. - Modes for running recipes:
- Default: results are shown in a notification window
- Quickfix: output is added to the quickfix list, using the errorformat
- Streaming: useful for example when the recipe has a progress bar
- Terminal: useful for example when the recipe prompts for further input
- Support for
just's run parameters. Parameters are read viavim.ui.input. - Inspect recipes and variable values.
- Hide specific recipes, helpful to always exclude recipes that require user input.
Installation
Requirements
- nvim 0.10+
- just
- optional: snacks.nvim (for streaming
output)
- optional: vim.ui.input provider, such as
snacks.nvim, for nicer recipe parameter
input
- optional: Treesitter parser for syntax highlighting (:TSInstall just)
lua
-- lazy.nvim
return {
"chrisgrieser/nvim-justice"
-- optional, for streaming output and nicer parameter input
-- dependencies = "folke/snacks.nvim",
}
Configuration
The setup call is optional.
lua
-- default settings
require("justice").setup {
-- Defines how recipe modes are determined. For example, if a recipe has
-- "download" in the name, or if it has "streaming" or "curl" in the comment,
-- it will be considered a "streaming" recipe.
-- (strings are interpreted as lua patterns, thus `-` needs to be escaped as `%-`)
recipeModes = {
streaming = { -- useful for progress bars (requires `snacks.nvim`)
name = { "download" },
comment = { "streaming", "curl" }, -- comment contains "streaming" or "curl"
},
terminal = { -- useful for recipes with input
name = {},
comment = { "input", "terminal", "fzf" },
},
quickfix = {
name = { "%-qf$" }, -- name ending with "-qf"
comment = { "quickfix" },
},
ignore = { -- hides them from the nvim-justice selection window
name = {},
comment = {},
},
},
window = {
border = getBorder(), -- `vim.o.winborder` on nvim 0.11, otherwise "rounded"
recipeCommentMaxLen = 35,
keymaps = {
next = "<Tab>",
prev = "<S-Tab>",
runRecipeUnderCursor = "<CR>",
runFirstRecipe = "1",
closeWin = { "q", "<Esc>" },
showRecipe = "<Space>",
showVariables = "?",
dontUseForQuickKey = { "j", "k", "-", "_" },
},
highlightGroups = {
quickKey = "Keyword",
icons = "Function",
},
icons = {
just = "",
streaming = "ﲋ",
quickfix = "",
terminal = "",
ignore = "",
recipeParameters = "",
},
},
terminal = {
height = 10,
},
}
Usage
lua
require("justice").select()
vim
:Justice
Recipe parameters
If the recipe expects parameters from the command
line, nvim-justice will
automatically prompt for them.
If a parameter default has been defined, confirm the prompt with an empty value to use the default.
Keymaps in the selection window
- Navigate the window via <Tab> & <S-Tab>.
- Run selected recipe with <CR>.
- Quick-select recipes via the highlighted keys.
- Run the first recipe via 1.
- Inspect recipe via <Space>.
- Show variable values via ?.
Use with a specific Justfile (--justfile)
lua
require("justice").select({
justfile = "path/to/custom/justfile", -- passed to `--justfile=`
})
Advanced usage
Using progress bars and streaming output
Here is an example of a just recipe that displays a simple progress bar
This kind of progress bar works the same when triggered in the terminal via
just demo-progressbar or via nivm-justice.
```just
opts.recipes.streaming.comment is configured to make recipes whose comment
contains "streaming" stream the output
streaming
demo-progressbar:
#!/usr/bin/env zsh
char="+"
progress=""
for i in {1..20}; do
progress="$progress$char"
printf "\33[2K\r" # \33[2K fully erase the line, \r moves to start of line
printf "$progress" # printf (or echo -n) needed to not create a newline
sleep 0.1
done
printf "\33[2K\r"
echo "Done."
```
Note that the following version of a progress bar works in the terminal, but
not work in nvim-justice, since the plugin prints every unit of data
individually.
```just
streaming
progressbarnotworkinginnvim_justice: #!/usr/bin/env zsh char="+" for i in {1..20}; do printf "$char" sleep 0.1 done printf "\33[2K\r" echo "Done." ```
More just tooling for nvim
- Just-LSP
- Treesitter parser for
Just (
:TSInstall just)
About the author
In my day job, I am a sociologist studying the social mechanisms underlying the digital economy. For my PhD project, I investigate the governance of the app economy and how software ecosystems manage the tension between innovation and compatibility. If you are interested in this subject, feel free to get in touch.
Owner
- Name: Chris Grieser
- Login: chrisgrieser
- Kind: user
- Location: Berlin, Germany
- Company: Technical University of Berlin
- Website: https://chris-grieser.de/
- Repositories: 189
- Profile: https://github.com/chrisgrieser
Researcher in sociology & software developer
GitHub Events
Total
- Watch event: 23
- Delete event: 4
- Issue comment event: 6
- Push event: 134
- Pull request event: 9
- Create event: 7
Last Year
- Watch event: 23
- Delete event: 4
- Issue comment event: 6
- Push event: 134
- Pull request event: 9
- Create event: 7
Issues and Pull Requests
Last synced: 5 months ago
All Time
- Total issues: 0
- Total pull requests: 5
- Average time to close issues: N/A
- Average time to close pull requests: about 1 hour
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 5
Past Year
- Issues: 0
- Pull requests: 5
- Average time to close issues: N/A
- Average time to close pull requests: about 1 hour
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 5
Top Authors
Issue Authors
Pull Request Authors
- dependabot[bot] (5)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v4 composite
- kdheepak/panvimdoc main composite
- stefanzweifel/git-auto-commit-action v5 composite
- amannn/action-semantic-pull-request v5 composite
- actions/stale v9 composite
- JohnnyMorganz/stylua-action v4 composite
- actions/checkout v4 composite
- stefanzweifel/git-auto-commit-action v5 composite
- actions/checkout v4 composite
- stevearc/nvim-typecheck-action v2 composite