dotfiles from arch

This commit is contained in:
2025-09-28 11:39:12 +02:00
parent 75885729cd
commit d1c6923bbb
1358 changed files with 575835 additions and 0 deletions

1
nvim/lazy/LazyVim Submodule

Submodule nvim/lazy/LazyVim added at 25abbf546d

1
nvim/lazy/blink.cmp Submodule

Submodule nvim/lazy/blink.cmp added at 022521a891

Submodule nvim/lazy/bufferline.nvim added at 655133c3b4

1
nvim/lazy/catppuccin Submodule

Submodule nvim/lazy/catppuccin added at a0c769bc7c

Submodule nvim/lazy/conform.nvim added at 6feb2f28f9

1
nvim/lazy/flash.nvim Submodule

Submodule nvim/lazy/flash.nvim added at 3c942666f1

Submodule nvim/lazy/friendly-snippets added at 572f5660cf

Submodule nvim/lazy/gitsigns.nvim added at 5f1b1e2537

Submodule nvim/lazy/grug-far.nvim added at 6fd719634c

1
nvim/lazy/lazy.nvim Submodule

Submodule nvim/lazy/lazy.nvim added at 6c3bda4aca

Submodule nvim/lazy/lazydev.nvim added at 2367a6c0a0

Submodule nvim/lazy/lualine.nvim added at 0c6cca9f2c

Submodule nvim/lazy/mason-lspconfig.nvim added at 1a31f824b9

1
nvim/lazy/mason.nvim Submodule

Submodule nvim/lazy/mason.nvim added at fc98833b6d

1
nvim/lazy/mini.ai Submodule

Submodule nvim/lazy/mini.ai added at 5225f16eac

1
nvim/lazy/mini.icons Submodule

Submodule nvim/lazy/mini.icons added at 397ed3807e

1
nvim/lazy/mini.pairs Submodule

Submodule nvim/lazy/mini.pairs added at 69864a2efb

1
nvim/lazy/noice.nvim Submodule

Submodule nvim/lazy/noice.nvim added at 0427460c2d

1
nvim/lazy/nui.nvim Submodule

Submodule nvim/lazy/nui.nvim added at 7cd18e73cf

1
nvim/lazy/nvim-lint Submodule

Submodule nvim/lazy/nvim-lint added at b47cbb2493

Submodule nvim/lazy/nvim-lspconfig added at 8adb3b5938

Submodule nvim/lazy/nvim-treesitter added at 42fc28ba91

Submodule nvim/lazy/nvim-treesitter-textobjects added at 0f051e9813

Submodule nvim/lazy/nvim-ts-autotag added at a1d526af39

Submodule nvim/lazy/persistence.nvim added at 166a79a55b

10
nvim/lazy/pkg-cache.lua Normal file
View File

@@ -0,0 +1,10 @@
return {pkgs={{name="noice.nvim",source="lazy",spec=function()
return {
-- nui.nvim can be lazy loaded
{ "MunifTanjim/nui.nvim", lazy = true },
{
"folke/noice.nvim",
},
}
end,dir="/home/daniel/.local/share/nvim/lazy/noice.nvim",file="lazy.lua",},{name="plenary.nvim",source="lazy",spec={"nvim-lua/plenary.nvim",lazy=true,},dir="/home/daniel/.local/share/nvim/lazy/plenary.nvim",file="community",},{name="telescope.nvim",source="rockspec",spec={"telescope.nvim",specs={{"nvim-lua/plenary.nvim",lazy=true,},},build=false,},dir="/home/daniel/.local/share/nvim/lazy/telescope.nvim",file="telescope.nvim-scm-1.rockspec",},},version=12,}

Submodule nvim/lazy/plenary.nvim added at 857c5ac632

View File

@@ -0,0 +1,136 @@
# Friendly Snippets
Snippets collection for a set of different programming languages.
The only goal is to have one community driven repository for all kinds of
snippets in all programming languages, this way you can have it all in one
place.
## Install
Use your plugin manager of choice, e.g.
### With Lazy.nvim
```lua
{ "rafamadriz/friendly-snippets" }
```
> [!WARNING]
> If you're using LuaSnip make sure to use
> `require("luasnip.loaders.from_vscode").lazy_load()`, and add
> `friendly-snippets` as a dependency for LuaSnip, otherwise snippets might not
> be detected. If you don't use `lazy_load()` you might notice a slower
> startup-time
>
> ```lua
> {
> "L3MON4D3/LuaSnip",
> dependencies = { "rafamadriz/friendly-snippets" },
> }
> ```
### With Packer
```lua
use "rafamadriz/friendly-snippets"
```
### With vim-plug
```vim
Plug "rafamadriz/friendly-snippets"
```
### With coc.nvim
```vim
:CocInstall https://github.com/rafamadriz/friendly-snippets@main
```
## Usage
This collection of snippets should work with any snippet engine that supports
loading vscode snippets. Like for example:
- [vim-vsnip](https://github.com/hrsh7th/vim-vsnip)
- [LuaSnip](https://github.com/L3MON4D3/LuaSnip)
- [coc-snippets](https://github.com/neoclide/coc-snippets)
## Add snippets from a framework to a filetype.
> [!NOTE]
> This is handled by your snippet engine and has nothing to do with this snippets collection
There's extra snippets included in this repo but they are not added by default,
since it would be irrelevant for people not using those frameworks. See
[`snippets/frameworks`](https://github.com/rafamadriz/friendly-snippets/tree/main/snippets/frameworks)
For example: if you want to add rails snippets to ruby.
With LuaSnip:
```lua
require'luasnip'.filetype_extend("ruby", {"rails"})
```
With vim-vsnip:
```viml
let g:vsnip_filetypes.ruby = ['rails']
```
## Excluding snippets
> [!NOTE]
> This is handled by your snippet engine and has nothing to do with this snippets collection
With LuaSnip, see `help luasnip-loaders`
```lua
-- will exclude all javascript snippets
require("luasnip.loaders.from_vscode").load {
exclude = { "javascript" },
}
```
## Showcase
### HTML
![HTML gif](https://user-images.githubusercontent.com/67771985/131255337-d53f3408-b60d-44a2-93ba-9a3240a7436e.gif)
### JS
![JS gif](https://user-images.githubusercontent.com/67771985/131255342-e393165a-e4b1-401e-9084-a782b9dd3fef.gif)
## TODO
- Add all included snippets to the
[Wiki](https://github.com/rafamadriz/friendly-snippets/wiki).
## Thanks to all contributors
<a href="https://github.com/rafamadriz/friendly-snippets/graphs/contributors">
<img src="https://contrib.rocks/image?repo=rafamadriz/friendly-snippets" />
</a>
## Credits
A good portion of the snippets have been forked from the following repositories:
- [vscode-standardjs-snippets](https://github.com/capaj/vscode-standardjs-snippets)
- [python-snippets](https://github.com/cstrap/python-snippets)
- [vs-snippets](https://github.com/kitagry/vs-snippets)
- [Wscats/html-snippets](https://github.com/Wscats/html-snippets)
- [Harry-Ross/vscode-c-snippets](https://github.com/Harry-Ross/vscode-c-snippets)
- [vscode-jekyll-snippets](https://github.com/edheltzel/vscode-jekyll-snippets)
- [vscode-fortran-support](https://github.com/krvajal/vscode-fortran-support)
- [vscode_cobol](https://github.com/spgennard/vscode_cobol)
- [VSCode-LaTeX-Snippets](https://github.com/JeffersonQin/VSCode-LaTeX-Snippets)
- [vscode-react-javascript-snippets](https://github.com/dsznajder/vscode-react-javascript-snippets)
- [honza/vim-snippets - Verilog](https://github.com/honza/vim-snippets/blob/master/snippets/verilog.snippets)
- [vscode-relm4-snippets](https://github.com/Relm4/vscode-relm4-snippets)
- And more...
<!-- vim: set ft=markdown: -->

View File

@@ -0,0 +1,116 @@
# Input
Input is an abstraction layer on top of Popup.
It uses prompt buffer (check `:h prompt-buffer`) for its popup window.
```lua
local Input = require("nui.input")
local event = require("nui.utils.autocmd").event
local popup_options = {
relative = "cursor",
position = {
row = 1,
col = 0,
},
size = 20,
border = {
style = "rounded",
text = {
top = "[Input]",
top_align = "left",
},
},
win_options = {
winhighlight = "Normal:Normal",
},
}
local input = Input(popup_options, {
prompt = "> ",
default_value = "42",
on_close = function()
print("Input closed!")
end,
on_submit = function(value)
print("Value submitted: ", value)
end,
on_change = function(value)
print("Value changed: ", value)
end,
})
```
If you provide the `on_change` function, it'll be run everytime value changes.
Pressing `<CR>` runs the `on_submit` callback function and closes the window.
Pressing `<C-c>` runs the `on_close` callback function and closes the window.
Of course, you can override the default keymaps and add more. For example:
```lua
-- unmount input by pressing `<Esc>` in normal mode
input:map("n", "<Esc>", function()
input:unmount()
end, { noremap = true })
```
You can manipulate the associated buffer and window using the
`input.bufnr` and `input.winid` properties.
**NOTE**: the first argument accepts options for `nui.popup` component.
## Options
### `prompt`
**Type:** `string` or `NuiText`
Prefix in the input.
### `default_value`
**Type:** `string`
Default value placed in the input on mount
### `on_close`
**Type:** `function`
_Signature:_ `on_close() -> nil`
Callback function, called when input is closed.
### `on_submit`
**Type:** `function`
_Signature:_ `on_submit(value: string) -> nil`
Callback function, called when input value is submitted.
### `on_change`
**Type:** `function`
_Signature:_ `on_change(value: string) -> nil`
Callback function, called when input value is changed.
### `disable_cursor_position_patch`
By default, `nui.input` will try to make sure the cursor on parent window is not
moved after input is submitted/closed. If you want to disable this behavior
for some reason, you can set `disable_cursor_position_patch` to `true`.
## Methods
Methods from `nui.popup` are also available for `nui.input`.
## Wiki Page
You can find additional documentation/examples/guides/tips-n-tricks in [nui.input wiki page](https://github.com/MunifTanjim/nui.nvim/wiki/nui.input).
<!-- vim: set ft=markdown: -->

View File

@@ -0,0 +1,309 @@
# Layout
Layout is a helper component for creating complex layout by automatically
handling the calculation for position and size of other components.
**Example**
```lua
local Layout = require("nui.layout")
local Popup = require("nui.popup")
local top_popup = Popup({ border = "double" })
local bottom_left_popup = Popup({ border = "single" })
local bottom_right_popup = Popup({ border = "single" })
local layout = Layout(
{
position = "50%",
size = {
width = 80,
height = 40,
},
},
Layout.Box({
Layout.Box(top_popup, { size = "40%" }),
Layout.Box({
Layout.Box(bottom_left_popup, { size = "50%" }),
Layout.Box(bottom_right_popup, { size = "50%" }),
}, { dir = "row", size = "60%" }),
}, { dir = "col" })
)
layout:mount()
```
_Signature:_ `Layout(options, box)` or `Layout(component, box)`
`component` can be `Popup` or `Split`.
## Options (for float layout)
### `anchor`
**Type:** `"NW"` / `"NE"` / `"SW"` / `"SE"`
Decides which corner of the layout to place at `position`.
---
### `relative`
**Type:** `string` or `table`
This option affects how `position` and `size` are calculated.
**Examples**
Relative to cursor on current window:
```lua
relative = "cursor",
```
Relative to the current editor screen:
```lua
relative = "editor",
```
Relative to the current window (_default_):
```lua
relative = "win",
```
Relative to the window with specific id:
```lua
relative = {
type = "win",
winid = 5,
},
```
Relative to the buffer position:
```lua
relative = {
type = "buf",
-- zero-indexed
position = {
row = 5,
col = 5,
},
},
```
---
### `position`
**Type:** `number` or `percentage string` or `table`
Position is calculated from the top-left corner.
If `position` is `number` or `percentage string`, it applies to both `row` and `col`.
Or you can pass a table to set them separately.
For `percentage string`, position is calculated according to the option `relative`.
If `relative` is set to `"buf"` or `"cursor"`, `percentage string` is not allowed.
**Examples**
```lua
position = 50,
```
```lua
position = "50%",
```
```lua
position = {
row = 30,
col = 20,
},
```
```lua
position = {
row = "20%",
col = "50%",
},
```
---
### `size`
**Type:** `number` or `percentage string` or `table`
Determines the size of the layout.
If `size` is `number` or `percentage string`, it applies to both `width` and `height`.
You can also pass a table to set them separately.
For `percentage string`, `size` is calculated according to the option `relative`.
If `relative` is set to `"buf"` or `"cursor"`, window size is considered.
Decimal `number` in `(0,1)` range is treated similar to `percentage string`. For
example: `0.5` is same as `"50%"`.
**Examples**
```lua
size = 50,
```
```lua
size = "50%",
```
```lua
size = 0.5,
```
```lua
size = {
width = 80,
height = 40,
},
```
```lua
size = {
width = "80%",
height = 0.6,
},
```
## Options (for split layout)
### `relative`
**Type:** `string` or `table`
This option affects how `size` is calculated.
**Examples**
Split current editor screen:
```lua
relative = "editor"
```
Split current window (_default_):
```lua
relative = "win"
```
Split window with specific id:
```lua
relative = {
type = "win",
winid = 42,
}
```
---
### `position`
**Type:** `"top" | "right"| "bottom" | "left"`.
---
### `size`
**Type:** `number` or `percentage string`
Determines the size of the layout.
For `percentage string`, size is calculated according to the option `relative`.
## Layout.Box
_Signature:_ `Layout.Box(box, options)`
**Parameters**
| Name | Type | Description |
| --------- | ------------------------------ | ----------------------------------------- |
| `box` | `Layout.Box[]` / nui component | list of `Layout.Box` or any nui component |
| `options` | `table` | box options |
`options` is a `table` having the following keys:
| Key | Type | Description |
| ------ | ----------------------------- | ------------------------------------------------------ |
| `dir` | `"col"` / `"row"` (_default_) | arrangement direction, only if `box` is `Layout.Box[]` |
| `grow` | `number` | growth factor to fill up the box free space |
| `size` | `number` / `string` / `table` | optional if `grow` is present |
## Methods
### `layout:mount`
_Signature:_ `layout:mount()`
Mounts the layout with all the components.
**Examples**
```lua
layout:mount()
```
### `layout:unmount`
_Signature:_ `layout:unmount()`
Unmounts the layout with all the components.
**Examples**
```lua
layout:unmount()
```
### `layout:hide`
_Signature:_ `layout:hide()`
Hides the layout with all the components. Preserves the buffer (related content, autocmds and keymaps).
### `layout:show`
_Signature:_ `layout:show()`
Shows the hidden layout with all the components.
### `layout:update`
_Signature:_ `layout:update(config, box?)` or `layout:update(box?)`
**Parameters**
`config` is a `table` having the following keys:
| Key | Type |
| ---------- | --------------------------------- |
| `anchor` | `"NW"` / `"NE"` / `"SW"` / `"SE"` |
| `relative` | `string` / `table` |
| `position` | `string` / `table` |
| `size` | `string` / `table` |
`box` is a `table` returned by `Layout.Box`.
They are the same options used for layout initialization.
## Wiki Page
You can find additional documentation/examples/guides/tips-n-tricks in
[nui.layout wiki page](https://github.com/MunifTanjim/nui.nvim/wiki/nui.layout).
<!-- vim: set ft=markdown: -->

View File

@@ -0,0 +1,102 @@
# NuiLine
NuiLine is an abstraction layer on top of the following native functions:
- `vim.api.nvim_buf_set_lines` (check `:h nvim_buf_set_lines()`)
- `vim.api.nvim_buf_set_text` (check `:h nvim_buf_set_text()`)
- `vim.api.nvim_buf_add_highlight` (check `:h nvim_buf_add_highlight()`)
It helps you create line on the buffer containing multiple [`NuiText`](../text)s.
_Signature:_ `NuiLine(texts?)`
**Example**
```lua
local NuiLine = require("nui.line")
local line = NuiLine()
line:append("Something Went Wrong!", "Error")
local bufnr, ns_id, linenr_start = 0, -1, 1
line:render(bufnr, ns_id, linenr_start)
```
## Parameters
### `texts`
**Type:** `table[]`
List of `NuiText` objects to set as initial texts.
**Example**
```lua
local text_one = NuiText("One")
local text_two = NuiText("Two")
local line = NuiLine({ text_one, text_two })
```
## Methods
### `line:append`
_Signature:_ `line:append(content, highlight?)`
Adds a chunk of content to the line.
**Parameters**
| Name | Type | Description |
| ----------- | -------------------------------- | --------------------- |
| `content` | `string` / `NuiText` / `NuiLine` | content |
| `highlight` | `string` or `table` | highlight information |
If `text` is `string`, these parameters are passed to `NuiText`
and a `NuiText` object is returned.
It `content` is a `NuiText`/`NuiLine` object, it is returned unchanged.
### `line:content`
_Signature:_ `line:content()`
Returns the line content.
### `line:highlight`
_Signature:_ `line:highlight(bufnr, ns_id, linenr)`
Applies highlight for the line.
**Parameters**
| Name | Type | Description |
| -------- | -------- | ---------------------------------------------- |
| `bufnr` | `number` | buffer number |
| `ns_id` | `number` | namespace id (use `-1` for fallback namespace) |
| `linenr` | `number` | line number (1-indexed) |
### `line:render`
_Signature:_ `line:render(bufnr, ns_id, linenr_start, linenr_end?)`
Sets the line on buffer and applies highlight.
**Parameters**
| Name | Type | Description |
| -------------- | -------- | ---------------------------------------------- |
| `bufnr` | `number` | buffer number |
| `ns_id` | `number` | namespace id (use `-1` for fallback namespace) |
| `linenr_start` | `number` | start line number (1-indexed) |
| `linenr_end` | `number` | end line number (1-indexed) |
## Wiki Page
You can find additional documentation/examples/guides/tips-n-tricks in [nui.line wiki page](https://github.com/MunifTanjim/nui.nvim/wiki/nui.line).
<!-- vim: set ft=markdown: -->

View File

@@ -0,0 +1,209 @@
# Menu
`Menu` is abstraction layer on top of `Popup`.
```lua
local Menu = require("nui.menu")
local event = require("nui.utils.autocmd").event
local popup_options = {
relative = "cursor",
position = {
row = 1,
col = 0,
},
border = {
style = "rounded",
text = {
top = "[Choose Item]",
top_align = "center",
},
},
win_options = {
winhighlight = "Normal:Normal",
}
}
local menu = Menu(popup_options, {
lines = {
Menu.separator("Group One"),
Menu.item("Item 1"),
Menu.item("Item 2"),
Menu.separator("Group Two", {
char = "-",
text_align = "right",
}),
Menu.item("Item 3"),
Menu.item("Item 4"),
},
max_width = 20,
keymap = {
focus_next = { "j", "<Down>", "<Tab>" },
focus_prev = { "k", "<Up>", "<S-Tab>" },
close = { "<Esc>", "<C-c>" },
submit = { "<CR>", "<Space>" },
},
on_close = function()
print("CLOSED")
end,
on_submit = function(item)
print("SUBMITTED", vim.inspect(item))
end,
})
```
You can manipulate the associated buffer and window using the
`split.bufnr` and `split.winid` properties.
**NOTE**: the first argument accepts options for `nui.popup` component.
## Options
### `lines`
**Type:** `table`
List of menu items.
**`Menu.item(content, data?)`**
`Menu.item` is used to create an item object for the `Menu`.
**Parameters**
| Name | Type |
| --------- | -------------------------------- |
| `content` | `string` / `NuiText` / `NuiLine` |
| `data` | `table` / `nil` |
**Example**
```lua
Menu.item("One") --> { text = "One" }
Menu.item("Two", { id = 2 }) --> { id = 2, text = "Two" }
```
This is what you get as the argument of `on_submit` callback function.
You can include whatever you want in the item object.
**`Menu.separator(content?, options?)`**
`Menu.separator` is used to create a menu item that can't be focused.
**Parameters**
| Name | Type |
| --------- | ---------------------------------------------------------------------------------- |
| `content` | `string` / `NuiText` / `NuiLine` / `nil` |
| `options` | `{ char?: string\|NuiText, text_align?: "'left'"\|"'center'"\|"'right'" }` / `nil` |
You can just use `Menu.item` only and implement `Menu.separator`'s behavior
by providing a custom `should_skip_item` function.
### `prepare_item`
**Type:** `function`
_Signature:_ `prepare_item(item)`
If provided, this function is used for preparing each menu item.
The return value should be a `NuiLine` object or `string` or a list containing either of them.
If return value is `nil`, that node will not be rendered.
### `should_skip_item`
**Type:** `function`
_Signature:_ `should_skip_item(item)`
If provided, this function is used to determine if an item should be
skipped when focusing previous/next item.
The return value should be `boolean`.
By default, items created by `Menu.separator` are skipped.
### `max_height`
**Type:** `number`
Maximum height of the menu.
### `min_height`
**Type:** `number`
Minimum height of the menu.
### `max_width`
**Type:** `number`
Maximum width of the menu.
### `min_width`
**Type:** `number`
Minimum width of the menu.
### `keymap`
**Type:** `table`
Key mappings for the menu.
**Example**
```lua
keymap = {
close = { "<Esc>", "<C-c>" },
focus_next = { "j", "<Down>", "<Tab>" },
focus_prev = { "k", "<Up>", "<S-Tab>" },
submit = { "<CR>" },
},
```
### `on_change`
**Type:** `function`
_Signature:_ `on_change(item, menu) -> nil`
Callback function, called when menu item is focused.
### `on_close`
**Type:** `function`
_Signature:_ `on_close() -> nil`
Callback function, called when menu is closed.
### `on_submit`
**Type:** `function`
_Signature:_ `on_submit(item) -> nil`
Callback function, called when menu is submitted.
## Methods
Methods from `nui.popup` are also available for `nui.menu`.
## Properties
### `menu.tree`
The underlying `NuiTree` object used for rendering the menu. You can use it to
manipulate the menu items on-the-fly and access all the `NuiTree` methods.
## Wiki Page
You can find additional documentation/examples/guides/tips-n-tricks in [nui.menu wiki page](https://github.com/MunifTanjim/nui.nvim/wiki/nui.menu).
<!-- vim: set ft=markdown: -->

View File

@@ -0,0 +1,676 @@
# Popup
Popup is an abstraction layer on top of window.
Creates a new popup object (but does not mount it immediately).
**Examples**
```lua
local Popup = require("nui.popup")
local popup = Popup({
position = "50%",
size = {
width = 80,
height = 40,
},
enter = true,
focusable = true,
zindex = 50,
relative = "editor",
border = {
padding = {
top = 2,
bottom = 2,
left = 3,
right = 3,
},
style = "rounded",
text = {
top = " I am top title ",
top_align = "center",
bottom = "I am bottom title",
bottom_align = "left",
},
},
buf_options = {
modifiable = true,
readonly = false,
},
win_options = {
winblend = 10,
winhighlight = "Normal:Normal,FloatBorder:FloatBorder",
},
})
```
You can manipulate the associated buffer and window using the
`split.bufnr` and `split.winid` properties.
## Options
### `border`
**Type:** `table`
Contains all border related options.
#### `border.padding`
**Type:** `table`
Controls the popup padding.
**Examples**
It can be a list (`table`) with number of cells for top, right, bottom and left.
The order behaves like [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) padding.
```lua
border = {
-- `1` for top/bottom and `2` for left/right
padding = { 1, 2 },
},
```
You can also use a map (`table`) to set padding at specific side:
```lua
border = {
-- `1` for top, `2` for left, `0` for other sides
padding = {
top = 1,
left = 2,
},
},
```
#### `border.style`
**Type:** `string` or `table`
Controls the styling of the border.
**Examples**
Can be one of the pre-defined styles: `"double"`, `"none"`, `"rounded"`, `"shadow"`, `"single"`, `"solid"` or `"default"`.
```lua
border = {
style = "double",
},
```
List (`table`) of characters starting from the top-left corner and then clockwise:
```lua
border = {
style = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
},
```
Map (`table`) with named characters:
```lua
border = {
style = {
top_left = "╭", top = "─", top_right = "╮",
left = "│", right = "│",
bottom_left = "╰", bottom = "─", bottom_right = "╯",
},
},
```
If you don't need all these options, you can also pass the value of `border.style` to `border`
directly.
To set the highlight group for all the border characters, use the `win_options.winhighlight`
option and include the name of highlight group for `FloatBorder`.
**Examples**
```lua
win_options = {
winhighlight = "Normal:Normal,FloatBorder:SpecialChar",
},
```
To set the highlight group for individual border character, you can use `NuiText` or a tuple
with `(char, hl_group)`.
**Examples**
```lua
border = {
style = { { [[/]], "SpecialChar" }, [[─]], NuiText([[\]], "SpecialChar"), [[│]] },
},
```
#### `border.text`
**Type:** `table`
Text displayed on the border (as title/footnote).
| Key | Type | Description |
| ---------------- | -------------------------------------------- | ---------------------------- |
| `"top"` | `string` / `NuiLine` / `NuiText` | top border text |
| `"top_align"` | `"left"` / `"right"`/ `"center"` _(default)_ | top border text alignment |
| `"bottom"` | `string` / `NuiLine` / `NuiText` | bottom border text |
| `"bottom_align"` | `"left"` / `"right"`/ `"center"` _(default)_ | bottom border text alignment |
`"top"` and `"bottom"` also supports list of `(text, hl_group)` tuples, just like the native popup.
**Examples**
```lua
border = {
text = {
top = "Popup Title",
top_align = "center",
},
},
```
---
### `ns_id`
**Type:** `number` or `string`
Namespace id (`number`) or name (`string`).
---
### `anchor`
**Type:** `"NW"` / `"NE"` / `"SW"` / `"SE"`
Decides which corner of the popup to place at `position`.
---
### `relative`
**Type:** `string` or `table`
This option affects how `position` and `size` are calculated.
**Examples**
Relative to cursor on current window:
```lua
relative = "cursor",
```
Relative to the current editor screen:
```lua
relative = "editor",
```
Relative to the current window (_default_):
```lua
relative = "win",
```
Relative to the window with specific id:
```lua
relative = {
type = "win",
winid = 5,
},
```
Relative to the buffer position:
```lua
relative = {
type = "buf",
-- zero-indexed
position = {
row = 5,
col = 5,
},
},
```
---
### `position`
**Type:** `number` or `percentage string` or `table`
Position is calculated from the top-left corner.
If `position` is `number` or `percentage string`, it applies to both `row` and `col`.
Or you can pass a table to set them separately.
For `percentage string`, position is calculated according to the option `relative`.
If `relative` is set to `"buf"` or `"cursor"`, `percentage string` is not allowed.
**Examples**
```lua
position = 50,
```
```lua
position = "50%",
```
```lua
position = {
row = 30,
col = 20,
},
```
```lua
position = {
row = "20%",
col = "50%",
},
```
---
### `size`
**Type:** `number` or `percentage string` or `table`
Determines the size of the popup.
If `size` is `number` or `percentage string`, it applies to both `width` and `height`.
You can also pass a table to set them separately.
For `percentage string`, `size` is calculated according to the option `relative`.
If `relative` is set to `"buf"` or `"cursor"`, window size is considered.
Decimal `number` in `(0,1)` range is treated similar to `percentage string`. For
example: `0.5` is same as `"50%"`.
**Examples**
```lua
size = 50,
```
```lua
size = "50%",
```
```lua
size = 0.5,
```
```lua
size = {
width = 80,
height = 40,
},
```
```lua
size = {
width = "80%",
height = 0.6,
},
```
---
### `enter`
**Type:** `boolean`
If `true`, the popup is entered immediately after mount.
**Examples**
```lua
enter = true,
```
---
### `focusable`
**Type:** `boolean`
If `false`, the popup can not be entered by user actions (wincmds, mouse events).
**Examples**
```lua
focusable = true,
```
---
### `zindex`
**Type:** `number`
Sets the order of the popup on z-axis.
Popup with higher the `zindex` goes on top of popups with lower `zindex`.
**Examples**
```lua
zindex = 50,
```
---
### `buf_options`
**Type:** `table`
Contains all buffer related options (check `:h options | /local to buffer`).
**Examples**
```lua
buf_options = {
modifiable = false,
readonly = true,
},
```
---
### `win_options`
**Type:** `table`
Contains all window related options (check `:h options | /local to window`).
**Examples**
```lua
win_options = {
winblend = 10,
winhighlight = "Normal:Normal,FloatBorder:FloatBorder",
},
```
---
### `bufnr`
**Type:** `number`
You can pass `bufnr` of an existing buffer to display it on the popup.
**Examples:**
```lua
bufnr = vim.api.nvim_get_current_buf(),
```
## Methods
### `popup:mount`
_Signature:_ `popup:mount()`
Mounts the popup.
**Examples**
```lua
popup:mount()
```
---
### `popup:unmount`
_Signature:_ `popup:unmount()`
Unmounts the popup.
**Examples**
```lua
popup:unmount()
```
---
### `popup:hide`
_Signature:_ `popup:hide()`
Hides the popup window. Preserves the buffer (related content, autocmds and keymaps).
---
### `popup:show`
_Signature:_ `popup:show()`
Shows the hidden popup window.
---
### `popup:map`
_Signature:_ `popup:map(mode, key, handler, opts) -> nil`
Sets keymap for the popup.
**Parameters**
| Name | Type | Description |
| --------- | --------------------- | --------------------------------------------------------------------------- |
| `mode` | `string` | check `:h :map-modes` |
| `key` | `string` | key for the mapping |
| `handler` | `string` / `function` | handler for the mapping |
| `opts` | `table` | check `:h :map-arguments` (including `remap`/`noremap`, excluding `buffer`) |
**Examples**
```lua
local ok = popup:map("n", "<esc>", function(bufnr)
print("ESC pressed in Normal mode!")
end, { noremap = true })
```
---
### `popup:unmap`
_Signature:_ `popup:unmap(mode, key) -> nil`
Deletes keymap for the popup.
**Parameters**
| Name | Type | Description |
| ------ | ------------- | --------------------- |
| `mode` | `"n"` / `"i"` | check `:h :map-modes` |
| `key` | `string` | key for the mapping |
**Examples**
```lua
local ok = popup:unmap("n", "<esc>")
```
---
### `popup:on`
_Signature:_ `popup:on(event, handler, options)`
Defines `autocmd` to run on specific events for this popup.
**Parameters**
| Name | Type | Description |
| --------- | --------------------- | ------------------------------------------ |
| `event` | `string[]` / `string` | check `:h events` |
| `handler` | `function` | handler function for event |
| `options` | `table` | keys `once`, `nested` and values `boolean` |
**Examples**
```lua
local event = require("nui.utils.autocmd").event
popup:on({ event.BufLeave }, function()
popup:unmount()
end, { once = true })
```
`event` can be expressed as any of the followings:
```lua
{ event.BufLeave, event.BufDelete }
-- or
{ event.BufLeave, "BufDelete" }
-- or
event.BufLeave
-- or
"BufLeave"
-- or
"BufLeave,BufDelete"
```
---
### `popup:off`
_Signature:_ `popup:off(event)`
Removes `autocmd` defined with `popup:on({ ... })`
**Parameters**
| Name | Type | Description |
| ------- | --------------------- | ----------------- |
| `event` | `string[]` / `string` | check `:h events` |
**Examples**
```lua
popup:off("*")
```
---
### `popup:update_layout`
_Signature:_ `popup:update_layout(config)`
Sets the layout of the popup. You can use this method to change popup's
size or position after it's mounted.
**Parameters**
`config` is a `table` having the following keys:
| Key | Type |
| ---------- | --------------------------------- |
| `anchor` | `"NW"` / `"NE"` / `"SW"` / `"SE"` |
| `relative` | `string` / `table` |
| `position` | `string` / `table` |
| `size` | `string` / `table` |
They are the same options used for popup initialization.
**Examples**
```lua
popup:update_layout({
relative = "win",
size = {
width = 80,
height = 40,
},
position = {
row = 30,
col = 20,
},
})
```
---
### `popup.border:set_highlight`
_Signature:_ `popup.border:set_highlight(highlight: string) -> nil`
Sets border highlight.
**Parameters**
| Name | Type | Description |
| ----------- | -------- | -------------------- |
| `highlight` | `string` | highlight group name |
**Examples**
```lua
popup.border:set_highlight("SpecialChar")
```
---
### `popup.border:set_style`
_Signature:_ `popup.border:set_style(style: string|table) -> nil`
Sets border style.
**Parameters**
| Name | Type | Description |
| ------- | ------------------ | ------------ |
| `style` | `string` / `table` | border style |
This `style` parameter is exactly the same as popup option `border.style`.
You'll need to call `popup:update_layout()` after this for the change to render on screen.
**Examples**
```lua
popup.border:set_style("rounded")
popup:update_layout()
```
---
### `popup.border:set_text`
_Signature:_ `popup.border:set_text(edge, text, align)`
Sets border text.
**Parameters**
| Name | Type |
| ------- | ------------------------------------------- |
| `edge` | `"top"` / `"bottom"` / `"left"` / `"right"` |
| `text` | `string` |
| `align` | `"left"` / `"right"`/ `"center"` |
**Examples**
```lua
popup.border:set_text("bottom", "[Progress: 42%]", "right")
```
## Wiki Page
You can find additional documentation/examples/guides/tips-n-tricks in [nui.popup wiki page](https://github.com/MunifTanjim/nui.nvim/wiki/nui.popup).
<!-- vim: set ft=markdown: -->

View File

@@ -0,0 +1,93 @@
# Split
Split is can be used to split your current window or editor.
```lua
local Split = require("nui.split")
local split = Split({
relative = "editor",
position = "bottom",
size = "20%",
})
```
You can manipulate the associated buffer and window using the
`split.bufnr` and `split.winid` properties.
## Options
### `ns_id`
**Type:** `number` or `string`
Namespace id (`number`) or name (`string`).
### `relative`
**Type:** `string` or `table`
This option affects how `size` is calculated.
**Examples**
Split current editor screen:
```lua
relative = "editor"
```
Split current window (_default_):
```lua
relative = "win"
```
Split window with specific id:
```lua
relative = {
type = "win",
winid = 42,
}
```
### `position`
`position` can be one of: `"top"`, `"right"`, `"bottom"` or `"left"`.
### `size`
`size` can be `number` or `percentage string`.
For `percentage string`, size is calculated according to the option `relative`.
### `enter`
**Type:** `boolean`
If `false`, the split is not entered immediately after mount.
**Examples**
```lua
enter = false
```
### `buf_options`
Table containing buffer options to set for this split.
### `win_options`
Table containing window options to set for this split.
## Methods
[Methods from `nui.popup`](/lua/nui/popup#methods) are also available for `nui.split`.
## Wiki Page
You can find additional documentation/examples/guides/tips-n-tricks in [nui.split wiki page](https://github.com/MunifTanjim/nui.nvim/wiki/nui.split).
<!-- vim: set ft=markdown: -->

View File

@@ -0,0 +1,117 @@
# NuiTable
NuiTable can render table-like structured content on the buffer.
**Examples**
```lua
local NuiTable = require("nui.table")
local tbl = NuiTable({
bufnr = bufnr,
columns = {
{
align = "center",
header = "Name",
columns = {
{ accessor_key = "firstName", header = "First" },
{
id = "lastName",
accessor_fn = function(row)
return row.lastName
end,
header = "Last",
},
},
},
{
align = "right",
accessor_key = "age",
cell = function(cell)
return Text(tostring(cell.get_value()), "DiagnosticInfo")
end,
header = "Age",
},
},
data = {
{ firstName = "John", lastName = "Doe", age = 42 },
{ firstName = "Jane", lastName = "Doe", age = 27 },
},
})
tbl:render()
```
## Options
### `bufnr`
**Type:** `number`
Id of the buffer where the table will be rendered.
---
### `ns_id`
**Type:** `number` or `string`
Namespace id (`number`) or name (`string`).
---
### `columns`
**Type:** `NuiTable.ColumnDef[]`
List of `NuiTable.ColumnDef` objects.
---
### `data`
**Type:** `any[]`
List of data items.
## Methods
### `tbl:get_cell`
_Signature:_ `tbl:get_cell(position?: {integer, integer}) -> NuiTable.Cell | nil`
**Parameters**
| Name | Type | Description |
| ---------- | ---------------------- | ------------------------------------- |
| `position` | `{ integer, integer }` | `(row, col)` tuple relative to cursor |
Returns the `NuiTable.Cell` if found.
### `tbl:refresh_cell`
_Signature:_ `tbl:refresh_cell(cell: NuiTable.Cell) -> nil`
Refreshes the `cell` on buffer.
**Parameters**
| Name | Type | Description |
| ------ | --------------- | ----------- |
| `cell` | `NuiTable.Cell` | cell |
### `tbl:render`
_Signature:_ `tbl:render(linenr_start?: integer) -> nil`
Renders the table on buffer.
| Name | Type | Description |
| -------------- | ----------------- | ----------------------------- |
| `linenr_start` | `integer` / `nil` | start line number (1-indexed) |
## Wiki Page
You can find additional documentation/examples/guides/tips-n-tricks in [nui.table wiki page](https://github.com/MunifTanjim/nui.nvim/wiki/nui.table).
<!-- vim: set ft=markdown: -->

View File

@@ -0,0 +1,143 @@
# NuiText
NuiText is an abstraction layer on top of the following native functions:
- `vim.api.nvim_buf_set_text` (check `:h nvim_buf_set_text()`)
- `vim.api.nvim_buf_set_extmark` (check `:h nvim_buf_set_extmark()`)
It helps you set text and add highlight for it on the buffer.
_Signature:_ `NuiText(content, extmark?)`
**Examples**
```lua
local NuiText = require("nui.text")
local text = NuiText("Something Went Wrong!", "Error")
local bufnr, ns_id, linenr_start, byte_start = 0, -1, 1, 0
text:render(bufnr, ns_id, linenr_start, byte_start)
```
## Parameters
### `content`
**Type:** `string` or `table`
Text content or `NuiText` object.
If `NuiText` object is passed, a copy of it is created.
### `extmark`
**Type:** `string` or `table`
Highlight group name or extmark options.
If a `string` is passed, it is used as the highlight group name.
If a `table` is passed it is used as extmark data. It can have the
following keys:
| Key | Description |
| ------------ | -------------------- |
| `"hl_group"` | highlight group name |
For more, check `:help nvim_buf_set_extmark()`.
## Methods
### `text:set`
_Signature:_ `text:set(content, extmark?)`
Sets the text content and highlight information.
**Parameters**
| Name | Type | Description |
| --------- | ------------------- | --------------------------------------- |
| `content` | `string` | text content |
| `extmark` | `string` or `table` | highlight group name or extmark options |
This `extmark` parameter is exactly the same as `NuiText`'s `extmark` parameter.
### `text:content`
_Signature:_ `text:content()`
Returns the text content.
### `text:length`
_Signature:_ `text:length()`
Returns the byte length of the text.
### `text:width`
_Signature:_ `text:width()`
Returns the character length of the text.
### `text:highlight`
_Signature:_ `text:highlight(bufnr, ns_id, linenr, byte_start)`
Applies highlight for the text.
**Parameters**
| Name | Type | Description |
| ------------ | -------- | -------------------------------------------------- |
| `bufnr` | `number` | buffer number |
| `ns_id` | `number` | namespace id (use `-1` for fallback namespace) |
| `linenr` | `number` | line number (1-indexed) |
| `byte_start` | `number` | start position of the text on the line (0-indexed) |
### `text:render`
_Signature:_ `text:render(bufnr, ns_id, linenr_start, byte_start, linenr_end?, byte_end?)`
Sets the text on buffer and applies highlight.
**Parameters**
| Name | Type | Description |
| -------------- | -------- | -------------------------------------------------- |
| `bufnr` | `number` | buffer number |
| `ns_id` | `number` | namespace id (use `-1` for fallback namespace) |
| `linenr_start` | `number` | start line number (1-indexed) |
| `byte_start` | `number` | start position of the text on the line (0-indexed) |
| `linenr_end` | `number` | end line number (1-indexed) |
| `byte_end` | `number` | end position of the text on the line (0-indexed) |
### `text:render_char`
_Signature:_ `text:render_char(bufnr, ns_id, linenr_start, char_start, linenr_end?, char_end?)`
Sets the text on buffer and applies highlight.
This does the thing as `text:render` method, but you can use character count
instead of byte count. It will convert multibyte character count to appropriate
byte count for you.
**Parameters**
| Name | Type | Description |
| -------------- | -------- | -------------------------------------------------- |
| `bufnr` | `number` | buffer number |
| `ns_id` | `number` | namespace id (use `-1` for fallback namespace) |
| `linenr_start` | `number` | start line number (1-indexed) |
| `char_start` | `number` | start position of the text on the line (0-indexed) |
| `linenr_end` | `number` | end line number (1-indexed) |
| `char_end` | `number` | end position of the text on the line (0-indexed) |
## Wiki Page
You can find additional documentation/examples/guides/tips-n-tricks in [nui.text wiki page](https://github.com/MunifTanjim/nui.nvim/wiki/nui.text).
<!-- vim: set ft=markdown: -->

View File

@@ -0,0 +1,310 @@
# NuiTree
NuiTree can render tree-like structured content on the buffer.
**Examples**
```lua
local NuiTree = require("nui.tree")
local tree = NuiTree({
bufnr = bufnr,
nodes = {
NuiTree.Node({ text = "a" }),
NuiTree.Node({ text = "b" }, {
NuiTree.Node({ text = "b-1" }),
NuiTree.Node({ text = { "b-2", "b-3" } }),
}),
},
})
tree:render()
```
## Options
### `bufnr`
**Type:** `number`
Id of the buffer where the tree will be rendered.
---
### `ns_id`
**Type:** `number` or `string`
Namespace id (`number`) or name (`string`).
---
### `nodes`
**Type:** `table`
List of [`NuiTree.Node`](#nuitreenode) objects.
---
### `get_node_id`
**Type:** `function`
_Signature:_ `get_node_id(node) -> string`
If provided, this function is used for generating node's id.
The return value should be a unique `string`.
**Example**
```lua
get_node_id = function(node)
if node.id then
return "-" .. node.id
end
if node.text then
return string.format("%s-%s-%s", node:get_parent_id() or "", node:get_depth(), node.text)
end
return "-" .. math.random()
end,
```
---
### `prepare_node`
**Type:** `function`
_Signature:_ `prepare_node(node, parent_node?) -> nil | string | string[] | NuiLine | NuiLine[]`
If provided, this function is used for preparing each node line.
The return value should be a `NuiLine` object or `string` or a list containing either of them.
If return value is `nil`, that node will not be rendered.
**Example**
```lua
prepare_node = function(node)
local line = NuiLine()
line:append(string.rep(" ", node:get_depth() - 1))
if node:has_children() then
line:append(node:is_expanded() and " " or " ")
else
line:append(" ")
end
line:append(node.text)
return line
end,
```
---
### `buf_options`
**Type:** `table`
Contains all buffer related options (check `:h options | /local to buffer`).
**Examples**
```lua
buf_options = {
bufhidden = "hide",
buflisted = false,
buftype = "nofile",
swapfile = false,
},
```
## Methods
### `tree:get_node`
_Signature:_ `tree:get_node(node_id_or_linenr?) -> NuiTreeNode | nil, number | nil, number | nil`
**Parameters**
| Name | Type | Description |
| ------------------- | ----------------------------- | ------------------------ |
| `node_id_or_linenr` | `number` or `string` or `nil` | node's id or line number |
If `node_id_or_linenr` is `string`, the node with that _id_ is returned.
If `node_id_or_linenr` is `number`, the node on that _linenr_ is returned.
If `node_id` is `nil`, the current node under cursor is returned.
Returns the `node` if found, and the start and end `linenr` if it is rendered.
### `tree:get_nodes`
_Signature:_ `tree:get_node(parent_id?) -> NuiTreeNode[]`
**Parameters**
| Name | Type | Description |
| ----------- | ----------------- | ---------------- |
| `parent_id` | `string` or `nil` | parent node's id |
If `parent_id` is present, child nodes under that parent are returned,
Otherwise root nodes are returned.
### `tree:add_node`
_Signature:_ `tree:add_node(node, parent_id?)`
Adds a node to the tree.
| Name | Type | Description |
| ----------- | ----------------- | ---------------- |
| `node` | `NuiTree.Node` | node |
| `parent_id` | `string` or `nil` | parent node's id |
If `parent_id` is present, node is added under that parent,
Otherwise node is added to the tree root.
### `tree:remove_node`
_Signature:_ `tree:remove_node(node)`
Removes a node from the tree.
Returns the removed node.
| Name | Type | Description |
| --------- | -------- | ----------- |
| `node_id` | `string` | node's id |
### `tree:set_nodes`
_Signature:_ `tree:set_nodes(nodes, parent_id?)`
Adds a node to the tree.
| Name | Type | Description |
| ----------- | ----------------- | ---------------- |
| `nodes` | `NuiTree.Node[]` | list of nodes |
| `parent_id` | `string` or `nil` | parent node's id |
If `parent_id` is present, nodes are set as parent node's children,
otherwise nodes are set at tree root.
### `tree:render`
_Signature:_ `tree:render(linenr_start?)`
Renders the tree on buffer.
| Name | Type | Description |
| -------------- | ---------------- | ----------------------------- |
| `linenr_start` | `number` / `nil` | start line number (1-indexed) |
## NuiTree.Node
`NuiTree.Node` is used to create a node object for `NuiTree`.
_Signature:_ `NuiTree.Node(data, children)`
**Examples**
```lua
local NuiTree = require("nui.tree")
local node = NuiTree.Node({ text = "b" }, {
NuiTree.Node({ text = "b-1" }),
NuiTree.Node({ text = "b-2" }),
})
```
### Parameters
#### `data`
**Type:** `table`
Data for the node. Can contain anything. The default `get_node_id`
and `prepare_node` functions uses the `id` and `text` keys.
**Example**
```lua
{
id = "/usr/local/bin/lua",
text = "lua"
}
```
If you don't want to provide those two values, you should consider
providing your own `get_node_id` and `prepare_node` functions.
#### `children`
**Type:** `table`
List of `NuiTree.Node` objects.
### Methods
#### `node:get_id`
_Signature:_ `node:get_id()`
Returns node's id.
#### `node:get_depth`
_Signature:_ `node:get_depth()`
Returns node's depth.
#### `node:get_parent_id`
_Signature:_ `node:get_parent_id()`
Returns parent node's id.
#### `node:has_children`
_Signature:_ `node:has_children()`
Checks if node has children.
#### `node:get_child_ids`
_Signature:_ `node:get_child_ids() -> string[]`
Returns ids of child nodes.
#### `node:is_expanded`
_Signature:_ `node:is_expanded()`
Checks if node is expanded.
#### `node:expand`
_Signature:_ `node:expand()`
Expands node.
#### `node:collapse`
_Signature:_ `node:collapse()`
Collapses node.
## Wiki Page
You can find additional documentation/examples/guides/tips-n-tricks in [nui.tree wiki page](https://github.com/MunifTanjim/nui.nvim/wiki/nui.tree).
<!-- vim: set ft=markdown: -->

View File

@@ -0,0 +1,355 @@
![GitHub Workflow Status: CI](https://img.shields.io/github/actions/workflow/status/MunifTanjim/nui.nvim/ci.yml?branch=main&label=CI&style=for-the-badge)
[![Coverage](https://img.shields.io/codecov/c/gh/MunifTanjim/nui.nvim/master?style=for-the-badge)](https://codecov.io/gh/MunifTanjim/nui.nvim)
[![Version](https://img.shields.io/luarocks/v/MunifTanjim/nui.nvim?color=%232c3e67&style=for-the-badge)](https://luarocks.org/modules/MunifTanjim/nui.nvim)
![License](https://img.shields.io/github/license/MunifTanjim/nui.nvim?color=%23000080&style=for-the-badge)
# nui.nvim
UI Component Library for Neovim.
## Requirements
- [Neovim 0.5.0](https://github.com/neovim/neovim/releases/tag/v0.5.0)
## Installation
Install the plugins with your preferred plugin manager. For example, with [`vim-plug`](https://github.com/junegunn/vim-plug):
```vim
Plug 'MunifTanjim/nui.nvim'
```
## Blocks
### [NuiText](lua/nui/text)
Quickly add highlighted text on the buffer.
**[Check Detailed Documentation for `nui.text`](lua/nui/text)**
**[Check Wiki Page for `nui.text`](https://github.com/MunifTanjim/nui.nvim/wiki/nui.text)**
### [NuiLine](lua/nui/line)
Quickly add line containing highlighted text chunks on the buffer.
**[Check Detailed Documentation for `nui.line`](lua/nui/line)**
**[Check Wiki Page for `nui.line`](https://github.com/MunifTanjim/nui.nvim/wiki/nui.line)**
### [NuiTable](lua/nui/table)
Quickly render table-like structured content on the buffer.
**[Check Detailed Documentation for `nui.table`](lua/nui/table)**
**[Check Wiki Page for `nui.table`](https://github.com/MunifTanjim/nui.nvim/wiki/nui.table)**
### [NuiTree](lua/nui/tree)
Quickly render tree-like structured content on the buffer.
**[Check Detailed Documentation for `nui.tree`](lua/nui/tree)**
**[Check Wiki Page for `nui.tree`](https://github.com/MunifTanjim/nui.nvim/wiki/nui.tree)**
## Components
### [Layout](lua/nui/layout)
![Layout GIF](https://github.com/MunifTanjim/nui.nvim/wiki/media/layout.gif)
```lua
local Popup = require("nui.popup")
local Layout = require("nui.layout")
local popup_one, popup_two = Popup({
enter = true,
border = "single",
}), Popup({
border = "double",
})
local layout = Layout(
{
position = "50%",
size = {
width = 80,
height = "60%",
},
},
Layout.Box({
Layout.Box(popup_one, { size = "40%" }),
Layout.Box(popup_two, { size = "60%" }),
}, { dir = "row" })
)
local current_dir = "row"
popup_one:map("n", "r", function()
if current_dir == "col" then
layout:update(Layout.Box({
Layout.Box(popup_one, { size = "40%" }),
Layout.Box(popup_two, { size = "60%" }),
}, { dir = "row" }))
current_dir = "row"
else
layout:update(Layout.Box({
Layout.Box(popup_two, { size = "60%" }),
Layout.Box(popup_one, { size = "40%" }),
}, { dir = "col" }))
current_dir = "col"
end
end, {})
layout:mount()
```
**[Check Detailed Documentation for `nui.layout`](lua/nui/layout)**
**[Check Wiki Page for `nui.layout`](https://github.com/MunifTanjim/nui.nvim/wiki/nui.layout)**
### [Popup](lua/nui/popup)
![Popup GIF](https://github.com/MunifTanjim/nui.nvim/wiki/media/popup.gif)
```lua
local Popup = require("nui.popup")
local event = require("nui.utils.autocmd").event
local popup = Popup({
enter = true,
focusable = true,
border = {
style = "rounded",
},
position = "50%",
size = {
width = "80%",
height = "60%",
},
})
-- mount/open the component
popup:mount()
-- unmount component when cursor leaves buffer
popup:on(event.BufLeave, function()
popup:unmount()
end)
-- set content
vim.api.nvim_buf_set_lines(popup.bufnr, 0, 1, false, { "Hello World" })
```
**[Check Detailed Documentation for `nui.popup`](lua/nui/popup)**
**[Check Wiki Page for `nui.popup`](https://github.com/MunifTanjim/nui.nvim/wiki/nui.popup)**
### [Input](lua/nui/input)
![Input GIF](https://github.com/MunifTanjim/nui.nvim/wiki/media/input.gif)
```lua
local Input = require("nui.input")
local event = require("nui.utils.autocmd").event
local input = Input({
position = "50%",
size = {
width = 20,
},
border = {
style = "single",
text = {
top = "[Howdy?]",
top_align = "center",
},
},
win_options = {
winhighlight = "Normal:Normal,FloatBorder:Normal",
},
}, {
prompt = "> ",
default_value = "Hello",
on_close = function()
print("Input Closed!")
end,
on_submit = function(value)
print("Input Submitted: " .. value)
end,
})
-- mount/open the component
input:mount()
-- unmount component when cursor leaves buffer
input:on(event.BufLeave, function()
input:unmount()
end)
```
**[Check Detailed Documentation for `nui.input`](lua/nui/input)**
**[Check Wiki Page for `nui.input`](https://github.com/MunifTanjim/nui.nvim/wiki/nui.input)**
### [Menu](lua/nui/menu)
![Menu GIF](https://github.com/MunifTanjim/nui.nvim/wiki/media/menu.gif)
```lua
local Menu = require("nui.menu")
local event = require("nui.utils.autocmd").event
local menu = Menu({
position = "50%",
size = {
width = 25,
height = 5,
},
border = {
style = "single",
text = {
top = "[Choose-an-Element]",
top_align = "center",
},
},
win_options = {
winhighlight = "Normal:Normal,FloatBorder:Normal",
},
}, {
lines = {
Menu.item("Hydrogen (H)"),
Menu.item("Carbon (C)"),
Menu.item("Nitrogen (N)"),
Menu.separator("Noble-Gases", {
char = "-",
text_align = "right",
}),
Menu.item("Helium (He)"),
Menu.item("Neon (Ne)"),
Menu.item("Argon (Ar)"),
},
max_width = 20,
keymap = {
focus_next = { "j", "<Down>", "<Tab>" },
focus_prev = { "k", "<Up>", "<S-Tab>" },
close = { "<Esc>", "<C-c>" },
submit = { "<CR>", "<Space>" },
},
on_close = function()
print("Menu Closed!")
end,
on_submit = function(item)
print("Menu Submitted: ", item.text)
end,
})
-- mount the component
menu:mount()
```
**[Check Detailed Documentation for `nui.menu`](lua/nui/menu)**
**[Check Wiki Page for `nui.menu`](https://github.com/MunifTanjim/nui.nvim/wiki/nui.menu)**
### [Split](lua/nui/split)
![Split GIF](https://github.com/MunifTanjim/nui.nvim/wiki/media/split.gif)
```lua
local Split = require("nui.split")
local event = require("nui.utils.autocmd").event
local split = Split({
relative = "editor",
position = "bottom",
size = "20%",
})
-- mount/open the component
split:mount()
-- unmount component when cursor leaves buffer
split:on(event.BufLeave, function()
split:unmount()
end)
```
**[Check Detailed Documentation for `nui.split`](lua/nui/split)**
**[Check Wiki Page for `nui.split`](https://github.com/MunifTanjim/nui.nvim/wiki/nui.split)**
## Extendibility
Each of the [blocks](#blocks) and [components](#components) can be extended to add new
methods or change their behaviors.
```lua
local Timer = Popup:extend("Timer")
function Timer:init(popup_options)
local options = vim.tbl_deep_extend("force", popup_options or {}, {
border = "double",
focusable = false,
position = { row = 0, col = "100%" },
size = { width = 10, height = 1 },
win_options = {
winhighlight = "Normal:Normal,FloatBorder:SpecialChar",
},
})
Timer.super.init(self, options)
end
function Timer:countdown(time, step, format)
local function draw_content(text)
local gap_width = 10 - vim.api.nvim_strwidth(text)
vim.api.nvim_buf_set_lines(self.bufnr, 0, -1, false, {
string.format(
"%s%s%s",
string.rep(" ", math.floor(gap_width / 2)),
text,
string.rep(" ", math.ceil(gap_width / 2))
),
})
end
self:mount()
local remaining_time = time
draw_content(format(remaining_time))
vim.fn.timer_start(step, function()
remaining_time = remaining_time - step
draw_content(format(remaining_time))
if remaining_time <= 0 then
self:unmount()
end
end, { ["repeat"] = math.ceil(remaining_time / step) })
end
local timer = Timer()
timer:countdown(10000, 1000, function(time)
return tostring(time / 1000) .. "s"
end)
```
#### `nui.object`
A small object library is bundled with `nui.nvim`. It is, more or less, a clone of the
[`kikito/middleclass`](https://github.com/kikito/middleclass) library.
[Check Wiki Page for `nui.object`](https://github.com/MunifTanjim/nui.nvim/wiki/nui.object)
## License
Licensed under the MIT License. Check the [LICENSE](./LICENSE) file for details.
<!-- vim: set ft=markdown: -->

View File

@@ -0,0 +1,136 @@
# nvim-ts-autotag
Use treesitter to **autoclose** and **autorename** html tag
It works with:
- astro
- glimmer
- handlebars
- html
- javascript
- jsx
- liquid
- markdown
- php
- rescript
- svelte
- tsx
- twig
- typescript
- vue
- xml
and more
## Usage
```text
Before Input After
------------------------------------
<div > <div></div>
<div></div> ciwspan<esc> <span></span>
------------------------------------
```
## Setup
Requires `Nvim 0.9.5` and up.
Note that `nvim-ts-autotag` will not work unless you have treesitter parsers (like `html`) installed for a given
filetype. See [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) for installing parsers.
```lua
require('nvim-ts-autotag').setup({
opts = {
-- Defaults
enable_close = true, -- Auto close tags
enable_rename = true, -- Auto rename pairs of tags
enable_close_on_slash = false -- Auto close on trailing </
},
-- Also override individual filetype configs, these take priority.
-- Empty by default, useful if one of the "opts" global settings
-- doesn't work well in a specific filetype
per_filetype = {
["html"] = {
enable_close = false
}
}
})
```
> [!CAUTION]
> If you are setting up via `nvim-treesitter.configs` it has been deprecated! Please migrate to the
> new way. It will be removed in `1.0.0`.
### A note on lazy loading
For those of you using lazy loading through a plugin manager (like [lazy.nvim](https://github.com/folke/lazy.nvim)) lazy
loading is not particularly necessary for this plugin. `nvim-ts-autotag` is efficient in choosing when it needs to load.
If you still insist on lazy loading `nvim-ts-autotag`, then two good events to use are `BufReadPre` & `BufNewFile`.
### Extending the default config
Let's say that there's a language that `nvim-ts-autotag` doesn't currently support and you'd like to support it in your
config. While it would be the preference of the author that you upstream your changes, perhaps you would rather not 😢.
For example, if you have a language that has a very similar layout in its Treesitter Queries as `html`, you could add an
alias like so:
```lua
require('nvim-ts-autotag').setup({
aliases = {
["your language here"] = "html",
}
})
-- or
local TagConfigs = require("nvim-ts-autotag.config.init")
TagConfigs:add_alias("your language here", "html")
```
That will make `nvim-ts-autotag` close tags according to the rules of the `html` config in the given language.
But what if a parser breaks for whatever reason, for example the upstream Treesitter tree changes its node names and now
the default queries that `nvim-ts-autotag` provides no longer work.
Fear not! You can directly extend and override the existing configs. For example, let's say the start and end tag
patterns have changed for `xml`. We can directly override the `xml` config:
```lua
local TagConfigs = require("nvim-ts-autotag.config.init")
TagConfigs:update(TagConfigs:get("xml"):override("xml", {
start_tag_pattern = { "STag" },
end_tag_pattern = { "ETag" },
}))
```
In fact, this very nearly what we do during our own internal initialization phase for `nvim-ts-autotag`.
### Enable update on insert
If you have that issue
[#19](https://github.com/windwp/nvim-ts-autotag/issues/19)
```lua
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics,
{
underline = true,
virtual_text = {
spacing = 5,
severity_limit = 'Warning',
},
update_in_insert = true,
}
)
```
## Contributors
Thank [@PriceHiller](https://github.com/PriceHiller) for his work on this plugin.
## Sponsor
If you find this plugin useful, please consider sponsoring the project.
[Sponsor](https://paypal.me/trieule1vn)
<!-- vim: set ft=markdown: -->

200
nvim/lazy/readme/doc/tags Normal file
View File

@@ -0,0 +1,200 @@
!_TAG_FILE_ENCODING utf-8 //
friendly-snippets-add-snippets-from-a-framework-to-a-filetype friendly-snippets.md /## Add snippets from a framework to a filetype.
friendly-snippets-credits friendly-snippets.md /## Credits
friendly-snippets-excluding-snippets friendly-snippets.md /## Excluding snippets
friendly-snippets-friendly-snippets friendly-snippets.md /# Friendly Snippets
friendly-snippets-html friendly-snippets.md /### HTML
friendly-snippets-install friendly-snippets.md /## Install
friendly-snippets-js friendly-snippets.md /### JS
friendly-snippets-showcase friendly-snippets.md /## Showcase
friendly-snippets-thanks-to-all-contributors friendly-snippets.md /## Thanks to all contributors
friendly-snippets-todo friendly-snippets.md /## TODO
friendly-snippets-usage friendly-snippets.md /## Usage
friendly-snippets-with-coc-nvim friendly-snippets.md /### With coc.nvim
friendly-snippets-with-lazy-nvim friendly-snippets.md /### With Lazy.nvim
friendly-snippets-with-packer friendly-snippets.md /### With Packer
friendly-snippets-with-vim-plug friendly-snippets.md /### With vim-plug
nui.nvim-blocks nui.nvim.md /## Blocks
nui.nvim-components nui.nvim.md /## Components
nui.nvim-extendibility nui.nvim.md /## Extendibility
nui.nvim-input-lua-nui-input nui.nvim.md /### \[Input\](lua\/nui\/input)
nui.nvim-installation nui.nvim.md /## Installation
nui.nvim-layout-lua-nui-layout nui.nvim.md /### \[Layout\](lua\/nui\/layout)
nui.nvim-license nui.nvim.md /## License
nui.nvim-lua-nui-input-default-value nui.nvim-lua-nui-input.md /### `default_value`
nui.nvim-lua-nui-input-disable-cursor-position-patch nui.nvim-lua-nui-input.md /### `disable_cursor_position_patch`
nui.nvim-lua-nui-input-input nui.nvim-lua-nui-input.md /# Input
nui.nvim-lua-nui-input-methods nui.nvim-lua-nui-input.md /## Methods
nui.nvim-lua-nui-input-on-change nui.nvim-lua-nui-input.md /### `on_change`
nui.nvim-lua-nui-input-on-close nui.nvim-lua-nui-input.md /### `on_close`
nui.nvim-lua-nui-input-on-submit nui.nvim-lua-nui-input.md /### `on_submit`
nui.nvim-lua-nui-input-options nui.nvim-lua-nui-input.md /## Options
nui.nvim-lua-nui-input-prompt nui.nvim-lua-nui-input.md /### `prompt`
nui.nvim-lua-nui-input-wiki-page nui.nvim-lua-nui-input.md /## Wiki Page
nui.nvim-lua-nui-layout-anchor nui.nvim-lua-nui-layout.md /### `anchor`
nui.nvim-lua-nui-layout-layout nui.nvim-lua-nui-layout.md /# Layout
nui.nvim-lua-nui-layout-layout-box nui.nvim-lua-nui-layout.md /## Layout.Box
nui.nvim-lua-nui-layout-layout-hide nui.nvim-lua-nui-layout.md /### `layout:hide`
nui.nvim-lua-nui-layout-layout-mount nui.nvim-lua-nui-layout.md /### `layout:mount`
nui.nvim-lua-nui-layout-layout-show nui.nvim-lua-nui-layout.md /### `layout:show`
nui.nvim-lua-nui-layout-layout-unmount nui.nvim-lua-nui-layout.md /### `layout:unmount`
nui.nvim-lua-nui-layout-layout-update nui.nvim-lua-nui-layout.md /### `layout:update`
nui.nvim-lua-nui-layout-methods nui.nvim-lua-nui-layout.md /## Methods
nui.nvim-lua-nui-layout-options-for-float-layout nui.nvim-lua-nui-layout.md /## Options (for float layout)
nui.nvim-lua-nui-layout-options-for-split-layout nui.nvim-lua-nui-layout.md /## Options (for split layout)
nui.nvim-lua-nui-layout-position nui.nvim-lua-nui-layout.md /### `position`
nui.nvim-lua-nui-layout-relative nui.nvim-lua-nui-layout.md /### `relative`
nui.nvim-lua-nui-layout-size nui.nvim-lua-nui-layout.md /### `size`
nui.nvim-lua-nui-layout-wiki-page nui.nvim-lua-nui-layout.md /## Wiki Page
nui.nvim-lua-nui-line-line-append nui.nvim-lua-nui-line.md /### `line:append`
nui.nvim-lua-nui-line-line-content nui.nvim-lua-nui-line.md /### `line:content`
nui.nvim-lua-nui-line-line-highlight nui.nvim-lua-nui-line.md /### `line:highlight`
nui.nvim-lua-nui-line-line-render nui.nvim-lua-nui-line.md /### `line:render`
nui.nvim-lua-nui-line-methods nui.nvim-lua-nui-line.md /## Methods
nui.nvim-lua-nui-line-nuiline nui.nvim-lua-nui-line.md /# NuiLine
nui.nvim-lua-nui-line-parameters nui.nvim-lua-nui-line.md /## Parameters
nui.nvim-lua-nui-line-texts nui.nvim-lua-nui-line.md /### `texts`
nui.nvim-lua-nui-line-wiki-page nui.nvim-lua-nui-line.md /## Wiki Page
nui.nvim-lua-nui-menu-keymap nui.nvim-lua-nui-menu.md /### `keymap`
nui.nvim-lua-nui-menu-lines nui.nvim-lua-nui-menu.md /### `lines`
nui.nvim-lua-nui-menu-max-height nui.nvim-lua-nui-menu.md /### `max_height`
nui.nvim-lua-nui-menu-max-width nui.nvim-lua-nui-menu.md /### `max_width`
nui.nvim-lua-nui-menu-menu nui.nvim-lua-nui-menu.md /# Menu
nui.nvim-lua-nui-menu-menu-tree nui.nvim-lua-nui-menu.md /### `menu.tree`
nui.nvim-lua-nui-menu-methods nui.nvim-lua-nui-menu.md /## Methods
nui.nvim-lua-nui-menu-min-height nui.nvim-lua-nui-menu.md /### `min_height`
nui.nvim-lua-nui-menu-min-width nui.nvim-lua-nui-menu.md /### `min_width`
nui.nvim-lua-nui-menu-on-change nui.nvim-lua-nui-menu.md /### `on_change`
nui.nvim-lua-nui-menu-on-close nui.nvim-lua-nui-menu.md /### `on_close`
nui.nvim-lua-nui-menu-on-submit nui.nvim-lua-nui-menu.md /### `on_submit`
nui.nvim-lua-nui-menu-options nui.nvim-lua-nui-menu.md /## Options
nui.nvim-lua-nui-menu-prepare-item nui.nvim-lua-nui-menu.md /### `prepare_item`
nui.nvim-lua-nui-menu-properties nui.nvim-lua-nui-menu.md /## Properties
nui.nvim-lua-nui-menu-should-skip-item nui.nvim-lua-nui-menu.md /### `should_skip_item`
nui.nvim-lua-nui-menu-wiki-page nui.nvim-lua-nui-menu.md /## Wiki Page
nui.nvim-lua-nui-popup-anchor nui.nvim-lua-nui-popup.md /### `anchor`
nui.nvim-lua-nui-popup-border nui.nvim-lua-nui-popup.md /### `border`
nui.nvim-lua-nui-popup-border-padding nui.nvim-lua-nui-popup.md /#### `border.padding`
nui.nvim-lua-nui-popup-border-style nui.nvim-lua-nui-popup.md /#### `border.style`
nui.nvim-lua-nui-popup-border-text nui.nvim-lua-nui-popup.md /#### `border.text`
nui.nvim-lua-nui-popup-buf-options nui.nvim-lua-nui-popup.md /### `buf_options`
nui.nvim-lua-nui-popup-bufnr nui.nvim-lua-nui-popup.md /### `bufnr`
nui.nvim-lua-nui-popup-enter nui.nvim-lua-nui-popup.md /### `enter`
nui.nvim-lua-nui-popup-focusable nui.nvim-lua-nui-popup.md /### `focusable`
nui.nvim-lua-nui-popup-methods nui.nvim-lua-nui-popup.md /## Methods
nui.nvim-lua-nui-popup-ns-id nui.nvim-lua-nui-popup.md /### `ns_id`
nui.nvim-lua-nui-popup-options nui.nvim-lua-nui-popup.md /## Options
nui.nvim-lua-nui-popup-popup nui.nvim-lua-nui-popup.md /# Popup
nui.nvim-lua-nui-popup-popup-border-set-highlight nui.nvim-lua-nui-popup.md /### `popup.border:set_highlight`
nui.nvim-lua-nui-popup-popup-border-set-style nui.nvim-lua-nui-popup.md /### `popup.border:set_style`
nui.nvim-lua-nui-popup-popup-border-set-text nui.nvim-lua-nui-popup.md /### `popup.border:set_text`
nui.nvim-lua-nui-popup-popup-hide nui.nvim-lua-nui-popup.md /### `popup:hide`
nui.nvim-lua-nui-popup-popup-map nui.nvim-lua-nui-popup.md /### `popup:map`
nui.nvim-lua-nui-popup-popup-mount nui.nvim-lua-nui-popup.md /### `popup:mount`
nui.nvim-lua-nui-popup-popup-off nui.nvim-lua-nui-popup.md /### `popup:off`
nui.nvim-lua-nui-popup-popup-on nui.nvim-lua-nui-popup.md /### `popup:on`
nui.nvim-lua-nui-popup-popup-show nui.nvim-lua-nui-popup.md /### `popup:show`
nui.nvim-lua-nui-popup-popup-unmap nui.nvim-lua-nui-popup.md /### `popup:unmap`
nui.nvim-lua-nui-popup-popup-unmount nui.nvim-lua-nui-popup.md /### `popup:unmount`
nui.nvim-lua-nui-popup-popup-update-layout nui.nvim-lua-nui-popup.md /### `popup:update_layout`
nui.nvim-lua-nui-popup-position nui.nvim-lua-nui-popup.md /### `position`
nui.nvim-lua-nui-popup-relative nui.nvim-lua-nui-popup.md /### `relative`
nui.nvim-lua-nui-popup-size nui.nvim-lua-nui-popup.md /### `size`
nui.nvim-lua-nui-popup-wiki-page nui.nvim-lua-nui-popup.md /## Wiki Page
nui.nvim-lua-nui-popup-win-options nui.nvim-lua-nui-popup.md /### `win_options`
nui.nvim-lua-nui-popup-zindex nui.nvim-lua-nui-popup.md /### `zindex`
nui.nvim-lua-nui-split-buf-options nui.nvim-lua-nui-split.md /### `buf_options`
nui.nvim-lua-nui-split-enter nui.nvim-lua-nui-split.md /### `enter`
nui.nvim-lua-nui-split-methods nui.nvim-lua-nui-split.md /## Methods
nui.nvim-lua-nui-split-ns-id nui.nvim-lua-nui-split.md /### `ns_id`
nui.nvim-lua-nui-split-options nui.nvim-lua-nui-split.md /## Options
nui.nvim-lua-nui-split-position nui.nvim-lua-nui-split.md /### `position`
nui.nvim-lua-nui-split-relative nui.nvim-lua-nui-split.md /### `relative`
nui.nvim-lua-nui-split-size nui.nvim-lua-nui-split.md /### `size`
nui.nvim-lua-nui-split-split nui.nvim-lua-nui-split.md /# Split
nui.nvim-lua-nui-split-wiki-page nui.nvim-lua-nui-split.md /## Wiki Page
nui.nvim-lua-nui-split-win-options nui.nvim-lua-nui-split.md /### `win_options`
nui.nvim-lua-nui-table-bufnr nui.nvim-lua-nui-table.md /### `bufnr`
nui.nvim-lua-nui-table-columns nui.nvim-lua-nui-table.md /### `columns`
nui.nvim-lua-nui-table-data nui.nvim-lua-nui-table.md /### `data`
nui.nvim-lua-nui-table-methods nui.nvim-lua-nui-table.md /## Methods
nui.nvim-lua-nui-table-ns-id nui.nvim-lua-nui-table.md /### `ns_id`
nui.nvim-lua-nui-table-nuitable nui.nvim-lua-nui-table.md /# NuiTable
nui.nvim-lua-nui-table-options nui.nvim-lua-nui-table.md /## Options
nui.nvim-lua-nui-table-tbl-get-cell nui.nvim-lua-nui-table.md /### `tbl:get_cell`
nui.nvim-lua-nui-table-tbl-refresh-cell nui.nvim-lua-nui-table.md /### `tbl:refresh_cell`
nui.nvim-lua-nui-table-tbl-render nui.nvim-lua-nui-table.md /### `tbl:render`
nui.nvim-lua-nui-table-wiki-page nui.nvim-lua-nui-table.md /## Wiki Page
nui.nvim-lua-nui-text-content nui.nvim-lua-nui-text.md /### `content`
nui.nvim-lua-nui-text-extmark nui.nvim-lua-nui-text.md /### `extmark`
nui.nvim-lua-nui-text-methods nui.nvim-lua-nui-text.md /## Methods
nui.nvim-lua-nui-text-nuitext nui.nvim-lua-nui-text.md /# NuiText
nui.nvim-lua-nui-text-parameters nui.nvim-lua-nui-text.md /## Parameters
nui.nvim-lua-nui-text-text-content nui.nvim-lua-nui-text.md /### `text:content`
nui.nvim-lua-nui-text-text-highlight nui.nvim-lua-nui-text.md /### `text:highlight`
nui.nvim-lua-nui-text-text-length nui.nvim-lua-nui-text.md /### `text:length`
nui.nvim-lua-nui-text-text-render nui.nvim-lua-nui-text.md /### `text:render`
nui.nvim-lua-nui-text-text-render-char nui.nvim-lua-nui-text.md /### `text:render_char`
nui.nvim-lua-nui-text-text-set nui.nvim-lua-nui-text.md /### `text:set`
nui.nvim-lua-nui-text-text-width nui.nvim-lua-nui-text.md /### `text:width`
nui.nvim-lua-nui-text-wiki-page nui.nvim-lua-nui-text.md /## Wiki Page
nui.nvim-lua-nui-tree-buf-options nui.nvim-lua-nui-tree.md /### `buf_options`
nui.nvim-lua-nui-tree-bufnr nui.nvim-lua-nui-tree.md /### `bufnr`
nui.nvim-lua-nui-tree-children nui.nvim-lua-nui-tree.md /#### `children`
nui.nvim-lua-nui-tree-data nui.nvim-lua-nui-tree.md /#### `data`
nui.nvim-lua-nui-tree-get-node-id nui.nvim-lua-nui-tree.md /### `get_node_id`
nui.nvim-lua-nui-tree-methods nui.nvim-lua-nui-tree.md /### Methods
nui.nvim-lua-nui-tree-node-collapse nui.nvim-lua-nui-tree.md /#### `node:collapse`
nui.nvim-lua-nui-tree-node-expand nui.nvim-lua-nui-tree.md /#### `node:expand`
nui.nvim-lua-nui-tree-node-get-child-ids nui.nvim-lua-nui-tree.md /#### `node:get_child_ids`
nui.nvim-lua-nui-tree-node-get-depth nui.nvim-lua-nui-tree.md /#### `node:get_depth`
nui.nvim-lua-nui-tree-node-get-id nui.nvim-lua-nui-tree.md /#### `node:get_id`
nui.nvim-lua-nui-tree-node-get-parent-id nui.nvim-lua-nui-tree.md /#### `node:get_parent_id`
nui.nvim-lua-nui-tree-node-has-children nui.nvim-lua-nui-tree.md /#### `node:has_children`
nui.nvim-lua-nui-tree-node-is-expanded nui.nvim-lua-nui-tree.md /#### `node:is_expanded`
nui.nvim-lua-nui-tree-nodes nui.nvim-lua-nui-tree.md /### `nodes`
nui.nvim-lua-nui-tree-ns-id nui.nvim-lua-nui-tree.md /### `ns_id`
nui.nvim-lua-nui-tree-nuitree nui.nvim-lua-nui-tree.md /# NuiTree
nui.nvim-lua-nui-tree-nuitree-node nui.nvim-lua-nui-tree.md /## NuiTree.Node
nui.nvim-lua-nui-tree-options nui.nvim-lua-nui-tree.md /## Options
nui.nvim-lua-nui-tree-parameters nui.nvim-lua-nui-tree.md /### Parameters
nui.nvim-lua-nui-tree-prepare-node nui.nvim-lua-nui-tree.md /### `prepare_node`
nui.nvim-lua-nui-tree-tree-add-node nui.nvim-lua-nui-tree.md /### `tree:add_node`
nui.nvim-lua-nui-tree-tree-get-node nui.nvim-lua-nui-tree.md /### `tree:get_node`
nui.nvim-lua-nui-tree-tree-get-nodes nui.nvim-lua-nui-tree.md /### `tree:get_nodes`
nui.nvim-lua-nui-tree-tree-remove-node nui.nvim-lua-nui-tree.md /### `tree:remove_node`
nui.nvim-lua-nui-tree-tree-render nui.nvim-lua-nui-tree.md /### `tree:render`
nui.nvim-lua-nui-tree-tree-set-nodes nui.nvim-lua-nui-tree.md /### `tree:set_nodes`
nui.nvim-lua-nui-tree-wiki-page nui.nvim-lua-nui-tree.md /## Wiki Page
nui.nvim-menu-lua-nui-menu nui.nvim.md /### \[Menu\](lua\/nui\/menu)
nui.nvim-nui-nvim nui.nvim.md /# nui.nvim
nui.nvim-nui-object nui.nvim.md /#### `nui.object`
nui.nvim-nuiline-lua-nui-line nui.nvim.md /### \[NuiLine\](lua\/nui\/line)
nui.nvim-nuitable-lua-nui-table nui.nvim.md /### \[NuiTable\](lua\/nui\/table)
nui.nvim-nuitext-lua-nui-text nui.nvim.md /### \[NuiText\](lua\/nui\/text)
nui.nvim-nuitree-lua-nui-tree nui.nvim.md /### \[NuiTree\](lua\/nui\/tree)
nui.nvim-popup-lua-nui-popup nui.nvim.md /### \[Popup\](lua\/nui\/popup)
nui.nvim-requirements nui.nvim.md /## Requirements
nui.nvim-split-lua-nui-split nui.nvim.md /### \[Split\](lua\/nui\/split)
nvim-ts-autotag-a-note-on-lazy-loading nvim-ts-autotag.md /### A note on lazy loading
nvim-ts-autotag-contributors nvim-ts-autotag.md /## Contributors
nvim-ts-autotag-enable-update-on-insert nvim-ts-autotag.md /### Enable update on insert
nvim-ts-autotag-extending-the-default-config nvim-ts-autotag.md /### Extending the default config
nvim-ts-autotag-nvim-ts-autotag nvim-ts-autotag.md /# nvim-ts-autotag
nvim-ts-autotag-setup nvim-ts-autotag.md /## Setup
nvim-ts-autotag-sponsor nvim-ts-autotag.md /## Sponsor
nvim-ts-autotag-usage nvim-ts-autotag.md /## Usage
telescope-project.nvim-available-functions telescope-project.nvim.md /## Available functions:
telescope-project.nvim-available-options telescope-project.nvim.md /## Available options:
telescope-project.nvim-available-setup-settings telescope-project.nvim.md /## Available setup settings:
telescope-project.nvim-default-mappings-insert-mode telescope-project.nvim.md /## Default mappings (insert mode):
telescope-project.nvim-default-mappings-normal-mode telescope-project.nvim.md /## Default mappings (normal mode):
telescope-project.nvim-demo telescope-project.nvim.md /## Demo
telescope-project.nvim-installation telescope-project.nvim.md /## Installation
telescope-project.nvim-lazy-nvim telescope-project.nvim.md /### Lazy.nvim
telescope-project.nvim-packer-nvim telescope-project.nvim.md /### packer.nvim
telescope-project.nvim-project telescope-project.nvim.md /### Project
telescope-project.nvim-requirements telescope-project.nvim.md /## Requirements
telescope-project.nvim-roadmap-blue-car telescope-project.nvim.md /## Roadmap :blue_car:
telescope-project.nvim-setup telescope-project.nvim.md /## Setup
telescope-project.nvim-telescope-project-nvim telescope-project.nvim.md /# telescope-project.nvim

View File

@@ -0,0 +1,190 @@
# telescope-project.nvim
An extension for [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim)
that allows you to switch between projects.
## Demo
![Demo](./demo.gif)
## Requirements
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) (required)
- [telescope-file-browser.nvim](https://github.com/nvim-telescope/telescope-file-browser.nvim) (optional, only for `file_browser` action)
## Installation
### Lazy.nvim
```lua
{
'nvim-telescope/telescope-project.nvim',
dependencies = {
'nvim-telescope/telescope.nvim',
},
}
```
### packer.nvim
```lua
use {
'nvim-telescope/telescope-project.nvim',
requires = {
'nvim-telescope/telescope.nvim',
},
}
```
## Setup
You can set up the extension by adding the following to your config:
```lua
require'telescope'.load_extension('project')
```
You may skip explicitly loading extensions (they will then be lazy-loaded), but tab completions will not be available right away.
## Available functions:
### Project
The `projects` picker:
```lua
require'telescope'.extensions.project.project{}
```
## Default mappings (normal mode):
| Key | Description |
| --- | ------------------------------------------------------------- |
| `d` | delete currently selected project |
| `r` | rename currently selected project |
| `c` | create a project\* |
| `s` | search inside files within your project |
| `b` | browse inside files within your project |
| `w` | change to the selected project's directory without opening it |
| `R` | find a recently opened file within your project |
| `f` | find a file within your project (same as \<CR\>) |
| `o` | change current cd scope |
## Default mappings (insert mode):
| Key | Description |
| ------- | ------------------------------------------------------------- |
| `<c-d>` | delete currently selected project |
| `<c-v>` | rename currently selected project |
| `<c-a>` | create a project\* |
| `<c-s>` | search inside files within your project |
| `<c-b>` | browse inside files within your project |
| `<c-l>` | change to the selected project's directory without opening it |
| `<c-r>` | find a recently opened file within your project |
| `<c-f>` | find a file within your project (same as \<CR\>) |
| `<c-o>` | change current cd scope |
\* _defaults to your git root if used inside a git project, otherwise, it will use your current working directory_
Example key map config:
```lua
vim.api.nvim_set_keymap(
'n',
'<C-p>',
":lua require'telescope'.extensions.project.project{}<CR>",
{noremap = true, silent = true}
)
```
## Available options:
| Keys | Description | Options |
| ---------------- | ------------------------------------------ | ----------------------------- |
| `display_type` | Show the title and the path of the project | 'full' or 'minimal' (default) |
| `hide_workspace` | Hide the workspace of the project | true or false (default) |
Options can be added when requiring telescope-project, as shown below:
```lua
lua require'telescope'.extensions.project.project{ display_type = 'full' }
```
## Available setup settings:
| Keys | Description | Options |
| --------------------- | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `base_dirs` | Array of project base directory configurations | table (default: nil) |
| `ignore_missing_dirs` | Don't show an error if base dirs are missing | bool (default: false) |
| `hidden_files` | Show hidden files in selected project | bool (default: false) |
| `order_by` | Order projects by `asc`, `desc`, `recent` | string (default: recent) |
| `sync_with_nvim_tree` | Sync projects with nvim tree plugin | bool (default: false) |
| `search_by` | Telescope finder search by field (title/path) | string or table (default: title). Can also be a table {"title", "path"} to search by both title and path |
| `on_project_selected` | Custom handler when project is selected | function(prompt_bufnr) (default: find project files) |
| `cd_scope` | Array of cd scopes: `tab`, `window`, `global` | table (default: {"tab", "window"}) |
| `mappings` | Sets the mappings inside the telescope view | table (default: the mappings described bellow) |
Setup settings can be added when requiring telescope, as shown below:
```lua
require('telescope').setup {
local project_actions = require("telescope._extensions.project.actions")
extensions = {
project = {
base_dirs = {
'~/dev/src',
{'~/dev/src2'},
{'~/dev/src3', max_depth = 4},
{path = '~/dev/src4'},
{path = '~/dev/src5', max_depth = 2},
},
ignore_missing_dirs = true, -- default: false
hidden_files = true, -- default: false
theme = "dropdown",
order_by = "asc",
search_by = "title",
sync_with_nvim_tree = true, -- default false
-- default for on_project_selected = find project files
on_project_selected = function(prompt_bufnr)
-- Do anything you want in here. For example:
project_actions.change_working_directory(prompt_bufnr, false)
require("harpoon.ui").nav_file(1)
end,
mappings = {
n = {
['d'] = project_actions.delete_project,
['r'] = project_actions.rename_project,
['c'] = project_actions.add_project,
['C'] = project_actions.add_project_cwd,
['f'] = project_actions.find_project_files,
['b'] = project_actions.browse_project_files,
['s'] = project_actions.search_in_project_files,
['R'] = project_actions.recent_project_files,
['w'] = project_actions.change_working_directory,
['o'] = project_actions.next_cd_scope,
},
i = {
['<c-d>'] = project_actions.delete_project,
['<c-v>'] = project_actions.rename_project,
['<c-a>'] = project_actions.add_project,
['<c-A>'] = project_actions.add_project_cwd,
['<c-f>'] = project_actions.find_project_files,
['<c-b>'] = project_actions.browse_project_files,
['<c-s>'] = project_actions.search_in_project_files,
['<c-r>'] = project_actions.recent_project_files,
['<c-l>'] = project_actions.change_working_directory,
['<c-o>'] = project_actions.next_cd_scope,
}
}
}
}
}
```
## Roadmap :blue_car:
- order projects by last opened :heavy_check_mark:
- add all (git-enabled) subdirectories automatically :heavy_check_mark:
- workspaces :construction:
<!-- vim: set ft=markdown: -->

1
nvim/lazy/snacks.nvim Submodule

Submodule nvim/lazy/snacks.nvim added at bc0630e43b

1
nvim/lazy/state.json Normal file
View File

@@ -0,0 +1 @@
{"checker":{"last_check":1759051335}}

Submodule nvim/lazy/telescope-project.nvim added at 8e11df9441

Submodule nvim/lazy/telescope.nvim added at b4da76be54

Submodule nvim/lazy/todo-comments.nvim added at 304a8d204e

Submodule nvim/lazy/tokyonight.nvim added at 057ef5d260

Submodule nvim/lazy/trouble.nvim added at 85bedb7eb7

Submodule nvim/lazy/ts-comments.nvim added at 1bd9d0ba1d

Submodule nvim/lazy/which-key.nvim added at 370ec46f71