Skip to content
Draft
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
5 changes: 5 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/refs/heads/main/schema/markdownlint-config-schema.json",

"extends": "markdownlint/style/prettier"
}
2 changes: 2 additions & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
indent_type = "Spaces"
quote_style = "AutoPreferSingle"
53 changes: 49 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# nvim-jsonnet

Features:
* Provide functions to evaluate Jsonnet code inside a split view
* Extend nvim-treesitter highlighting with references and linting

- Provide functions to evaluate Jsonnet code inside a split view
- Extend nvim-treesitter highlighting with references and linting

## Usage

Expand Down Expand Up @@ -41,9 +42,10 @@ This plugin does not provide syntax highlighting, folding, formatting or linting

LSP with jsonnet-language-server provides formatting and linting out of the box, this config uses [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig/).

See [Usage](#Usage) to enable opinionated setup.
See [Usage](#usage) to enable opinionated setup.

Tip: configure format on save for all LSP buffers:

```lua
-- Format on save
vim.api.nvim_create_autocmd(
Expand All @@ -61,7 +63,7 @@ vim.api.nvim_create_autocmd(

[nvim-dap](https://github.com/mfussenegger/nvim-dap) provides a way to run the [jsonnet-debugger](https://github.com/grafana/jsonnet-debugger), this works great in combination with [nvim-dap-ui](https://github.com/rcarriga/nvim-dap-ui).

Install the debugger with `go install github.com/grafana/jsonnet-debugger@v0.1.0` and see [Usage](#Usage) to enable.
Install the debugger with `go install github.com/grafana/jsonnet-debugger@v0.1.0` and see [Usage](#usage) to enable.

### Treesitter

Expand All @@ -80,6 +82,49 @@ vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
vim.wo.foldlevel = 1000
```

### Window layouts

Various window layouts are available. See [./lua/nvim-jsonnet/config.lua] for
full details of all the configuration options and the defaults. Set just what
you need: unchanged values will be taken from the defaults.

Use a floating window sized to 40% of the screen width:

```lua
window = {
layout = "float",
width = 0.4
}
```

![Floating window](./screenshots/float.png)

Integrate with [`edgy.nvim`][edgy]'s sidebar:

```lua
// This is an example `lazy.nvim` configuration
{
"folke/edgy.nvim",

optional = true,

opts = function(_, opts)
opts.right = opts.right or {}

table.insert(opts.right, {
ft = "jsonnet-output",
title = "Jsonnet",

size = { width = 50 },
})
end,
},
```

![Edgy sidebar](./screenshots/edgy.png)

[edgy]: https://github.com/folke/edgy.nvim

### null-ls/cbfmt

For formatting code blocks inside Markdown you can use null-ls with `cbfmt`.
Expand Down
52 changes: 0 additions & 52 deletions lua/jsonnet/utils.lua

This file was deleted.

96 changes: 0 additions & 96 deletions lua/nvim-jsonnet.lua

This file was deleted.

Loading