From a3f6034b944f3f160a77a030d909278a09c77cdd Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sat, 20 Apr 2024 17:24:32 -0600 Subject: [PATCH 01/14] initial setup for Tabby --- .../completion/tabby-nvim/README.md | 55 +++++++++++++++++++ .../completion/tabby-nvim/init.lua | 8 +++ 2 files changed, 63 insertions(+) create mode 100644 lua/astrocommunity/completion/tabby-nvim/README.md create mode 100644 lua/astrocommunity/completion/tabby-nvim/init.lua diff --git a/lua/astrocommunity/completion/tabby-nvim/README.md b/lua/astrocommunity/completion/tabby-nvim/README.md new file mode 100644 index 000000000..ea7ddcbeb --- /dev/null +++ b/lua/astrocommunity/completion/tabby-nvim/README.md @@ -0,0 +1,55 @@ +# Mac/Windows Installation + +https://tabby.tabbyml.com/docs/installation/ + +# Linux Installation + +## Using Docker + +### Install the latest version of node (this uses [Node Version Manager](https://github.com/nvm-sh/nvm)) +```bash +nvm install node +``` + +### Install NVIDIA Container Toolkit +https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html + +### Run Docker container + +Choose from [Tabby Models Registry](https://tabby.tabbyml.com/docs/models/) + +```bash +docker run -it --gpus all \ + -p 8080:8080 -v $HOME/.tabby:/data \ + tabbyml/tabby serve --model --device cuda +``` + +### Tabby Server + +If your Tabby server endpoint is different from the default http://localhost:8080, please set the endpoint in ~/.tabby-client/agent/config.toml + +### Example Config +```lua +vim.g.tabby_keybinding_accept = '' +vim.g.tabby_keybinding_trigger_or_dismiss = '' + +vim.g.tabby_node_binary = '/path/to/node' -- find using `which node` + +return { + { 'TabbyML/vim-tabby' } +} +``` + + +# Usage + +After installation, please exit and restart Vim or NeoVim. Then you can check the Tabby plugin status by running :Tabby in your vim command line. If you see any message reported by Tabby, it means the plugin is installed successfully. If you see Not an editor command: Tabby or any other error message, please check the installation steps. + +In insert mode, Tabby plugin will show inline completion automatically when you stop typing. You can simply press to accept the completion. If you want to dismiss the completion manually, you can press to dismiss, and press again to show the completion again. + + +# Known Conflicts + + For the default settings, Tabby will attempt to set up the key mapping. If Tabby's inline completion is not displayed, it will fall back to the original mapping. However, this approach might not work when there is a conflict with other plugins that also map the key, as they could overwrite Tabby's mapping. In such cases, you can use a different keybinding to accept the completion and avoid conflicts. + + Tabby internally utilizes the command to insert the completion. If you have mapped to other functions, you won't be able to accept the completion. In such scenarios, you may need to manually modify the function tabby#Accept() in autoload/tabby.vim. diff --git a/lua/astrocommunity/completion/tabby-nvim/init.lua b/lua/astrocommunity/completion/tabby-nvim/init.lua new file mode 100644 index 000000000..ad1afdbfd --- /dev/null +++ b/lua/astrocommunity/completion/tabby-nvim/init.lua @@ -0,0 +1,8 @@ +vim.g.tabby_keybinding_accept = "" +vim.g.tabby_keybinding_trigger_or_dismiss = "" + +vim.g.tabby_node_binary = "/path/to/node" + +return { + { "TabbyML/vim-tabby" }, +} From 9f88d3d32635b403bfd022b1d848408c61d79c9e Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sun, 21 Apr 2024 11:59:24 -0600 Subject: [PATCH 02/14] remove unnecessary --- .../completion/tabby-nvim/README.md | 50 +------------------ 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/README.md b/lua/astrocommunity/completion/tabby-nvim/README.md index ea7ddcbeb..422779797 100644 --- a/lua/astrocommunity/completion/tabby-nvim/README.md +++ b/lua/astrocommunity/completion/tabby-nvim/README.md @@ -1,54 +1,8 @@ -# Mac/Windows Installation +# Installation https://tabby.tabbyml.com/docs/installation/ -# Linux Installation - -## Using Docker - -### Install the latest version of node (this uses [Node Version Manager](https://github.com/nvm-sh/nvm)) -```bash -nvm install node -``` - -### Install NVIDIA Container Toolkit -https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html - -### Run Docker container - -Choose from [Tabby Models Registry](https://tabby.tabbyml.com/docs/models/) - -```bash -docker run -it --gpus all \ - -p 8080:8080 -v $HOME/.tabby:/data \ - tabbyml/tabby serve --model --device cuda -``` - -### Tabby Server - -If your Tabby server endpoint is different from the default http://localhost:8080, please set the endpoint in ~/.tabby-client/agent/config.toml - -### Example Config -```lua -vim.g.tabby_keybinding_accept = '' -vim.g.tabby_keybinding_trigger_or_dismiss = '' - -vim.g.tabby_node_binary = '/path/to/node' -- find using `which node` - -return { - { 'TabbyML/vim-tabby' } -} -``` - - -# Usage - -After installation, please exit and restart Vim or NeoVim. Then you can check the Tabby plugin status by running :Tabby in your vim command line. If you see any message reported by Tabby, it means the plugin is installed successfully. If you see Not an editor command: Tabby or any other error message, please check the installation steps. - -In insert mode, Tabby plugin will show inline completion automatically when you stop typing. You can simply press to accept the completion. If you want to dismiss the completion manually, you can press to dismiss, and press again to show the completion again. - - -# Known Conflicts +## Known Conflicts For the default settings, Tabby will attempt to set up the key mapping. If Tabby's inline completion is not displayed, it will fall back to the original mapping. However, this approach might not work when there is a conflict with other plugins that also map the key, as they could overwrite Tabby's mapping. In such cases, you can use a different keybinding to accept the completion and avoid conflicts. From 0dd853205e74f139a9af0db1a9f880e6a56a7e2a Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sun, 21 Apr 2024 12:00:27 -0600 Subject: [PATCH 03/14] add config function to initialize parameters --- lua/astrocommunity/completion/tabby-nvim/init.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/init.lua b/lua/astrocommunity/completion/tabby-nvim/init.lua index ad1afdbfd..24419fb55 100644 --- a/lua/astrocommunity/completion/tabby-nvim/init.lua +++ b/lua/astrocommunity/completion/tabby-nvim/init.lua @@ -1,8 +1,12 @@ -vim.g.tabby_keybinding_accept = "" -vim.g.tabby_keybinding_trigger_or_dismiss = "" - -vim.g.tabby_node_binary = "/path/to/node" - return { { "TabbyML/vim-tabby" }, + config = function() + -- Configuration settings for vim-tabby + vim.g.tabby_keybinding_accept = "" + vim.g.tabby_keybinding_trigger_or_dismiss = "" + vim.g.tabby_node_binary = "/path/to/node" + + -- You can also set key mappings here if vim-tabby requires them + -- vim.keymap.set('n', '', '') + end, } From 9df25eff05d0c5a926b5e94ac229b2c3b8439fab Mon Sep 17 00:00:00 2001 From: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com> Date: Sun, 21 Apr 2024 20:12:51 +0200 Subject: [PATCH 04/14] Update lua/astrocommunity/completion/tabby-nvim/README.md --- lua/astrocommunity/completion/tabby-nvim/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/README.md b/lua/astrocommunity/completion/tabby-nvim/README.md index 422779797..3b75b22f7 100644 --- a/lua/astrocommunity/completion/tabby-nvim/README.md +++ b/lua/astrocommunity/completion/tabby-nvim/README.md @@ -1,6 +1,6 @@ # Installation -https://tabby.tabbyml.com/docs/installation/ +**Repository:** ## Known Conflicts From f280e0878b2de1c780e8bd16efdc4dd2d0522399 Mon Sep 17 00:00:00 2001 From: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com> Date: Sun, 21 Apr 2024 20:13:58 +0200 Subject: [PATCH 05/14] Update lua/astrocommunity/completion/tabby-nvim/init.lua --- lua/astrocommunity/completion/tabby-nvim/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/init.lua b/lua/astrocommunity/completion/tabby-nvim/init.lua index 24419fb55..d6bf8d1bf 100644 --- a/lua/astrocommunity/completion/tabby-nvim/init.lua +++ b/lua/astrocommunity/completion/tabby-nvim/init.lua @@ -1,6 +1,6 @@ return { { "TabbyML/vim-tabby" }, - config = function() + init = function() -- Configuration settings for vim-tabby vim.g.tabby_keybinding_accept = "" vim.g.tabby_keybinding_trigger_or_dismiss = "" From a9022399836fded7c499d960c2bdca35933545cb Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sun, 21 Apr 2024 12:29:56 -0600 Subject: [PATCH 06/14] fix init.lua, update README --- .../completion/tabby-nvim/README.md | 15 ++++++++++++++- lua/astrocommunity/completion/tabby-nvim/init.lua | 9 --------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/README.md b/lua/astrocommunity/completion/tabby-nvim/README.md index 3b75b22f7..9ad78f767 100644 --- a/lua/astrocommunity/completion/tabby-nvim/README.md +++ b/lua/astrocommunity/completion/tabby-nvim/README.md @@ -1,7 +1,20 @@ -# Installation +# tabby-nvim + +Tabby is a self-hosted AI coding assistant that can suggest multi-line code or full functions in real-time. + +**Repository:** + +## Installation **Repository:** +### Default Mappings + +| Mappings | Action | +|-------------|------------------------| +| `Tab` | Accept all suggestions | +| `Ctrl + \` | Accept line | + ## Known Conflicts For the default settings, Tabby will attempt to set up the key mapping. If Tabby's inline completion is not displayed, it will fall back to the original mapping. However, this approach might not work when there is a conflict with other plugins that also map the key, as they could overwrite Tabby's mapping. In such cases, you can use a different keybinding to accept the completion and avoid conflicts. diff --git a/lua/astrocommunity/completion/tabby-nvim/init.lua b/lua/astrocommunity/completion/tabby-nvim/init.lua index d6bf8d1bf..092d1c2c4 100644 --- a/lua/astrocommunity/completion/tabby-nvim/init.lua +++ b/lua/astrocommunity/completion/tabby-nvim/init.lua @@ -1,12 +1,3 @@ return { { "TabbyML/vim-tabby" }, - init = function() - -- Configuration settings for vim-tabby - vim.g.tabby_keybinding_accept = "" - vim.g.tabby_keybinding_trigger_or_dismiss = "" - vim.g.tabby_node_binary = "/path/to/node" - - -- You can also set key mappings here if vim-tabby requires them - -- vim.keymap.set('n', '', '') - end, } From 24f0999871b45410ddd40238741bd640a4acc5f8 Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sun, 21 Apr 2024 12:34:30 -0600 Subject: [PATCH 07/14] fix up --- lua/astrocommunity/completion/tabby-nvim/README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/README.md b/lua/astrocommunity/completion/tabby-nvim/README.md index 9ad78f767..bf2d5dadf 100644 --- a/lua/astrocommunity/completion/tabby-nvim/README.md +++ b/lua/astrocommunity/completion/tabby-nvim/README.md @@ -4,16 +4,12 @@ Tabby is a self-hosted AI coding assistant that can suggest multi-line code or f **Repository:** -## Installation - -**Repository:** - ### Default Mappings -| Mappings | Action | -|-------------|------------------------| -| `Tab` | Accept all suggestions | -| `Ctrl + \` | Accept line | +| Mappings | Action | +|------------|-------------------| +| `Tab` | Accept completion | +| `Ctrl + \` | Trigger/Dismiss | ## Known Conflicts From b14812a41f1bd949af6f2c0dae17747ac9917bb3 Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sun, 21 Apr 2024 12:39:48 -0600 Subject: [PATCH 08/14] fix README --- lua/astrocommunity/completion/tabby-nvim/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/README.md b/lua/astrocommunity/completion/tabby-nvim/README.md index bf2d5dadf..52ecfc8e6 100644 --- a/lua/astrocommunity/completion/tabby-nvim/README.md +++ b/lua/astrocommunity/completion/tabby-nvim/README.md @@ -13,6 +13,6 @@ Tabby is a self-hosted AI coding assistant that can suggest multi-line code or f ## Known Conflicts - For the default settings, Tabby will attempt to set up the key mapping. If Tabby's inline completion is not displayed, it will fall back to the original mapping. However, this approach might not work when there is a conflict with other plugins that also map the key, as they could overwrite Tabby's mapping. In such cases, you can use a different keybinding to accept the completion and avoid conflicts. +- For the default settings, Tabby will attempt to set up the `` key mapping. If Tabby's inline completion is not displayed, it will fall back to the original mapping. However, this approach might not work when there is a conflict with other plugins that also map the `` key, as they could overwrite Tabby's mapping. In such cases, you can use a different keybinding to accept the completion and avoid conflicts. - Tabby internally utilizes the command to insert the completion. If you have mapped to other functions, you won't be able to accept the completion. In such scenarios, you may need to manually modify the function tabby#Accept() in autoload/tabby.vim. +- Tabby internally utilizes the `` command to insert the completion. If you have mapped `` to other functions, you won't be able to accept the completion. In such scenarios, you may need to manually modify the function `tabby#Accept()` in [`autoload/tabby.vim`](https://github.com/TabbyML/tabby/tree/main/clients/vim/autoload/tabby.vim). From 43341f42f16051db0b39d8b231fcc93177dd74f1 Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sun, 21 Apr 2024 16:52:51 -0600 Subject: [PATCH 09/14] set completion key to , update README --- lua/astrocommunity/completion/tabby-nvim/README.md | 4 +--- lua/astrocommunity/completion/tabby-nvim/init.lua | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/README.md b/lua/astrocommunity/completion/tabby-nvim/README.md index 52ecfc8e6..bc80f0638 100644 --- a/lua/astrocommunity/completion/tabby-nvim/README.md +++ b/lua/astrocommunity/completion/tabby-nvim/README.md @@ -8,11 +8,9 @@ Tabby is a self-hosted AI coding assistant that can suggest multi-line code or f | Mappings | Action | |------------|-------------------| -| `Tab` | Accept completion | +| `` | Accept completion | | `Ctrl + \` | Trigger/Dismiss | ## Known Conflicts -- For the default settings, Tabby will attempt to set up the `` key mapping. If Tabby's inline completion is not displayed, it will fall back to the original mapping. However, this approach might not work when there is a conflict with other plugins that also map the `` key, as they could overwrite Tabby's mapping. In such cases, you can use a different keybinding to accept the completion and avoid conflicts. - - Tabby internally utilizes the `` command to insert the completion. If you have mapped `` to other functions, you won't be able to accept the completion. In such scenarios, you may need to manually modify the function `tabby#Accept()` in [`autoload/tabby.vim`](https://github.com/TabbyML/tabby/tree/main/clients/vim/autoload/tabby.vim). diff --git a/lua/astrocommunity/completion/tabby-nvim/init.lua b/lua/astrocommunity/completion/tabby-nvim/init.lua index 092d1c2c4..3996e6fb3 100644 --- a/lua/astrocommunity/completion/tabby-nvim/init.lua +++ b/lua/astrocommunity/completion/tabby-nvim/init.lua @@ -1,3 +1,8 @@ return { - { "TabbyML/vim-tabby" }, + "TabbyML/vim-tabby", + init = function() + vim.g.tabby_keybinding_accept = "" + vim.g.tabby_keybinding_trigger_or_dismiss = "" + vim.g.tabby_node_binary = "/path/to/node" + end, } From 674fbf168e4b2093077bb1e90a723d56fa9b5ac9 Mon Sep 17 00:00:00 2001 From: PatMulligan <43773168+PatMulligan@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:20:17 -0600 Subject: [PATCH 10/14] set node path to system binary Co-authored-by: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com> --- lua/astrocommunity/completion/tabby-nvim/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/init.lua b/lua/astrocommunity/completion/tabby-nvim/init.lua index 3996e6fb3..32be25ab3 100644 --- a/lua/astrocommunity/completion/tabby-nvim/init.lua +++ b/lua/astrocommunity/completion/tabby-nvim/init.lua @@ -3,6 +3,6 @@ return { init = function() vim.g.tabby_keybinding_accept = "" vim.g.tabby_keybinding_trigger_or_dismiss = "" - vim.g.tabby_node_binary = "/path/to/node" + vim.g.tabby_node_binary = vim.fn.exepath("node") end, } From ba327758a02dab36e43dba0fb57e218fc21dbf1f Mon Sep 17 00:00:00 2001 From: luxus Date: Mon, 22 Apr 2024 19:41:29 +0200 Subject: [PATCH 11/14] move init to astrocore Co-authored-by: Micah Halter --- .../completion/tabby-nvim/init.lua | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/init.lua b/lua/astrocommunity/completion/tabby-nvim/init.lua index 32be25ab3..ff01297c5 100644 --- a/lua/astrocommunity/completion/tabby-nvim/init.lua +++ b/lua/astrocommunity/completion/tabby-nvim/init.lua @@ -1,8 +1,16 @@ return { "TabbyML/vim-tabby", - init = function() - vim.g.tabby_keybinding_accept = "" - vim.g.tabby_keybinding_trigger_or_dismiss = "" - vim.g.tabby_node_binary = vim.fn.exepath("node") - end, + dependencies = { + "AstroNvim/astrocore", + ---@type AstroCoreOpts + opts = { + options = { + g = { + tabby_keybinding_accept = "", + tabby_keybinding_trigger_or_dismiss = "", + tabby_node_binary = vim.fn.exepath "node", + }, + }, + }, + }, } From 0edb744d745b2c8cc714da8b39f22bd19a0faa31 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Mon, 22 Apr 2024 16:35:16 -0400 Subject: [PATCH 12/14] add "User AstroFile" event --- lua/astrocommunity/completion/tabby-nvim/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/astrocommunity/completion/tabby-nvim/init.lua b/lua/astrocommunity/completion/tabby-nvim/init.lua index ff01297c5..b83e8f449 100644 --- a/lua/astrocommunity/completion/tabby-nvim/init.lua +++ b/lua/astrocommunity/completion/tabby-nvim/init.lua @@ -1,5 +1,6 @@ return { "TabbyML/vim-tabby", + event = "User AstroFile", dependencies = { "AstroNvim/astrocore", ---@type AstroCoreOpts From a8e40a61fc6f125cbeb78436fdd84e75aa62b05d Mon Sep 17 00:00:00 2001 From: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com> Date: Tue, 23 Apr 2024 19:22:48 +0200 Subject: [PATCH 13/14] Apply suggestions from code review --- lua/astrocommunity/completion/tabby-nvim/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/init.lua b/lua/astrocommunity/completion/tabby-nvim/init.lua index b83e8f449..7db4270bf 100644 --- a/lua/astrocommunity/completion/tabby-nvim/init.lua +++ b/lua/astrocommunity/completion/tabby-nvim/init.lua @@ -9,7 +9,6 @@ return { g = { tabby_keybinding_accept = "", tabby_keybinding_trigger_or_dismiss = "", - tabby_node_binary = vim.fn.exepath "node", }, }, }, From 781f5603b5a494025d44afd907f75aaf46686b46 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Tue, 23 Apr 2024 20:48:43 -0400 Subject: [PATCH 14/14] disable lazy loading --- lua/astrocommunity/completion/tabby-nvim/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/astrocommunity/completion/tabby-nvim/init.lua b/lua/astrocommunity/completion/tabby-nvim/init.lua index 7db4270bf..ce3082d3c 100644 --- a/lua/astrocommunity/completion/tabby-nvim/init.lua +++ b/lua/astrocommunity/completion/tabby-nvim/init.lua @@ -1,6 +1,6 @@ return { "TabbyML/vim-tabby", - event = "User AstroFile", + lazy = false, dependencies = { "AstroNvim/astrocore", ---@type AstroCoreOpts