Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(docs): add Neovim plugin #552

Merged
merged 14 commits into from
Aug 28, 2024
157 changes: 157 additions & 0 deletions docs/extensions-plugins/neovim/commands.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
---
title: Pieces Neovim Plugin Commands
description: Learn how to use the Pieces Neovim Plugin commands to streamline your workflow and boost productivity.
---

# Commands

The Pieces Neovim plugin provides several commands to interact with Pieces OS. Here's a list of available commands:

## General Commands

### `:PiecesHealth`

Check the health of Pieces OS.

```vim
:PiecesHealth
```

### `:PiecesOSVersion`

Display the version of Pieces OS.

```vim
:PiecesOSVersion
```
### `:PiecesPluginVersion`

Display the current version of the Pieces Neovim plugin.

```vim
:PiecesPluginVersion
```

## Copilot Commands

### `:PiecesCopilot`

Open the Pieces Copilot window in a split view.

```vim
:PiecesCopilot
```

#### Using the Copilot Chat

1. Press `i` to enter insert mode and type your message.
2. Press `<Esc>` to exit insert mode.
3. Press `<Enter>` to send the message to Pieces Copilot and see the response.

#### Copilot Chat Commands

In the Copilot chat input, you can use slash commands to perform specific actions:

#### `/change_model`

Change the current LLM model.

### `:PiecesConversations`

Open a list of Pieces Copilot conversations to choose from.

```vim
:PiecesConversations
```
Navigation and actions:
- Press `<Del>` on the selected conversation to delete it
- Use `<Up>` and `<Down>` arrow keys to navigate the conversation list
- Press `<Enter>` to open the selected conversation in the Copilot

## Asset Management Commands

### `:PiecesSnippets`

List all of the saved snippets.

```vim
:PiecesSnippets
```
Navigation and actions:
- Use `<Up>` and `<Down>` arrow keys to navigate the snippet list.
- Press `<Enter>` to open the selected snippet for editing.
- Press `<Del>` on the selected snippet to delete it.
- When editing a snippet:
1. Press `i` to enter insert mode and make changes.
2. Press `<Esc>` to exit insert mode.
3. Type `:w` and press `<Enter>` to save the edited snippet.
4. Type `:q` and press `<Enter>` to exit the snippet editor.


### `:PiecesCreateSnippet`

Create a snippet from the selected text in the visual mode.

```vim
:PiecesCreateSnippet
```

1. Enter visual mode by pressing `v` in normal mode.
2. Select the desired text using arrow keys or Vim motions.
3. Type `:PiecesCreateSnippet` and press `<Enter>`.

## Auth Commands

### `:PiecesAccount`

Shows your Pieces account information such as Username, Email, Personal Cloud Status and Personal Domain in a new window.

```vim
:PiecesAccount
```
You can also logout from your account by going to the `Logout` option in the Auth status menu and then press `enter`. You will be logged out of your Pieces account.

### `:PiecesLogin`

Login to your Pieces account.

```vim
:PiecesLogin
```

### `:PiecesLogout`

Logout of your Pieces account.

```vim
:PiecesLogout
```

### `:PiecesConnectCloud`

Connect to your Personal Pieces Cloud.

```vim
:PiecesConnectCloud
```

### `:PiecesDisconnectCloud`

Disconnect from your Personal Pieces Cloud.

```vim
:PiecesDisconnectCloud
```

:::info

Note: In order to use the Personal Pieces Cloud commands, you must have an account connected to Pieces OS.

:::
## Tips

- When editing a snippet opened with `:PiecesSnippets`, remember to save your changes using the `:w` command.
- Use visual mode to select text before running `:PiecesCreateSnippet` to create a new snippet.



28 changes: 28 additions & 0 deletions docs/extensions-plugins/neovim/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Pieces Neovim Plugin
description: Understand the benefits and importance of using the Pieces for Developers Neovim Plugin, and get started with Quickstart and Commands.
---

import { CardWithCTA } from "/src/components/Card";
import Grid from "/src/components/Grid";
import Video from "/src/components/Video";

The Pieces Neovim plugin is your gateway to managing your saved materials and interacting with Pieces Copilot in Pieces directly from within Neovim. Seamlessly interact with Pieces OS and enhance your workflow like never before.

## Get Started

<Grid cols={2}>
<CardWithCTA title={'Quickstart'} description={'Learn how to set up and start using the Pieces Neovim Plugin'} href={'/extensions-plugins/neovim/quickstart'} />
<CardWithCTA title={'Commands'} description={'Explore the available Pieces Neovim Plugin commands'} href={'/extensions-plugins/neovim/commands'} />
<CardWithCTA title={'Troubleshooting'} description={'Learn how to troubleshoot common issues with the Pieces Neovim Plugin'} href={'/extensions-plugins/neovim/troubleshooting'} />
</Grid>

## Need Help?

If you encounter any issues or have questions, you can create an issue on the [Pieces Neovim Plugin GitHub repository](https://github.com/pieces-app/plugin_neo_vim/issues) and we will get back to you as soon as possible.

For additional support, feel free to [reach out through any of our support channels](/support) consult the [FAQs](/faq).

## Want To Contribute?

The Pieces Neovim Plugin is completely open-source and we welcome contributions. If you'd like to contribute, check out the [GitHub repository](https://github.com/pieces-app/plugin_neo_vim) to get started.
121 changes: 121 additions & 0 deletions docs/extensions-plugins/neovim/quickstart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
title: Pieces Neovim Plugin Quickstart
description: Learn how to set up and start using the Pieces Neovim Plugin.
---

import CTAButton from "/src/components/CTAButton";
import { pieces_app } from "/src/lib/const";

# Quickstart

In this tutorial, we'll walk you through the process of setting up and using the Pieces Neovim Plugin. We'll cover the installation process and basic usage to help you get up and running quickly.

<CTAButton
href={pieces_app.links.extensions.neovim}
label={'Install via GitHub'}
icon={'/assets/pieces_logos/white_circle.png'}
iconDark={'/assets/pieces_logos/black_circle.png'}
type={'secondary'}
/>

## Prerequisites

- [Pieces OS](/installation-getting-started/what-am-i-installing) installed on your machine.
- [Neovim](https://neovim.io/) installed on your machine.
- [Python](https://www.python.org/downloads/) installed on your machine because Python is required to run Python based Neovim plugins.

A few things to note before you start installing the Pieces Neovim Plugin:

- The Python based Neovim plugins requires the `pynvim` Python package, which is not included in the default Neovim installation. You can install it by running the following command:

```bash
pip install pynvim
```

shivay-at-pieces marked this conversation as resolved.
Show resolved Hide resolved
- Ensure that you have at least one Neovim package manager installed. For instance, you can install `vim-plug`.
In order to install `vim-plug`, run the following command in your terminal:

```bash
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim \
--create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
```

- Create a Neovim configuration file if you haven't already done that. It's usually located at `~/.config/nvim/init.vim`. If it doesn't exist, create it using:

```bash
mkdir -p ~/.config/nvim
touch ~/.config/nvim/init.vim
```

Note: Your Neovim configuration file can either be `init.vim` or `init.lua`. If you are using `init.lua`, you will need to add the following line to your configuration file:

```lua
vim.cmd [[packadd pieces.nvim]]
```

## Steps

### Step 1: Install the Pieces Neovim Plugin
1. Ensure Pieces OS is installed and running on your system
1. Open the `init.vim` file with a text editor (you can use Neovim itself):
```shell
nvim ~/.config/nvim/init.vim
```
1. Add the following lines to the `init.vim` file:
```vim
" init.vim
call plug#begin('~/.vim/plugged')

Plug 'kyazdani42/nvim-web-devicons'
Plug 'MunifTanjim/nui.nvim'
Plug 'hrsh7th/nvim-cmp'
Plug 'pieces-app/plugin_neo_vim'
shivay-at-pieces marked this conversation as resolved.
Show resolved Hide resolved

call plug#end()
```
If you're using Neovim to edit, press `<Esc>`, then type `:wq` and press `<Enter>` to save and quit.

1. Install the plugins: Open Neovim again and run the following command:
```vim
:PlugInstall
```
This will install all the plugins specified.

1. After the installation is complete, add the Pieces configuration to your `init.vim`:
```vim
lua << EOF
require("pieces_config").host = "http://localhost:1000"
shivay-at-pieces marked this conversation as resolved.
Show resolved Hide resolved
EOF
```
1. Save and exit (`:wq` in Neovim). Now run the following command inside Neovim to update the remote plugins:
```vim
:UpdateRemotePlugins
```

### Step 2: Use the Neovim Plugin
1. Open Neovim using the `nvim` command in your terminal.

1. Run the following command to verify the installation:
```vim
:PiecesOSVersion
```
If the installation was successful, you should see the version of the Pieces OS.

Congratulations! You have successfully set up and started using the Pieces Neovim Plugin.

:::info

Whenever there's an update available for the Pieces Neovim Plugin, you will receive the following notification "A new update for the Pieces Plugin is now available!". You can update the plugin in your respective Neovim plugin manager. For example, if you are using `vim-plug`, you can run the following command:

```bash
nvim +PlugUpdate
```
:::

## Next Steps
Now that you have setup the Pieces Neovim Plugin, you can explore more features and commands to streamline your workflow and boost productivity.

- [Commands](/extensions-plugins/neovim/commands)
- [Pieces Neovim Plugin GitHub Repository](https://github.com/pieces-app/plugin_neo_vim)


28 changes: 28 additions & 0 deletions docs/extensions-plugins/neovim/troubleshooting.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Pieces for Developers Neovim Plugin Troubleshooting
description: Learn how to troubleshoot common issues with the Pieces for Developers Neovim Plugin.
---

# Troubleshooting

If you encounter any issues while installing or using the Pieces for Developers Neovim Plugin, refer to the following troubleshooting guide for solutions.

## Common Issues

### Issue with Python Dependencies

#### Problem

When you try to run a Python based Neovim plugin, you may encounter an error related to Python dependencies missing. This error may occur when you run the plugin for the first time or after updating the plugin.

#### Solution

Ensure that you have installed the `pynvim` package. You can do this by running the following command:

```bash
pip install pynvim
```

## Contact Support

If you continue to experience issues after trying our solutions, please to [reach out to our support team](/support) for further assistance.
2 changes: 1 addition & 1 deletion docs/extensions-plugins/raycast/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ When you try to run a command in Raycast for the first time, you may encounter a

## Contact Support

If you continue to experience issues after trying our solutoins, please to [reach out to our support team](/support) for further assistance.
If you continue to experience issues after trying our solutions, please to [reach out to our support team](/support) for further assistance.
1 change: 1 addition & 0 deletions docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Get started with the Pieces for Developers platform and show you how to best use
<CardWithoutCTA icon={'/assets/jupyterlab_logo.png'} title={'JupyterLab'} href={'/extensions-plugins/jupyterlab'} />
<CardWithoutCTA icon={'/assets/ads_logo.png'} title={'Azure Data Studio'} href={'/extensions-plugins/azure-data-studio'} />
<CardWithoutCTA icon={'/assets/sublime_logo.png'} title={'Sublime Text'} href={'/extensions-plugins/sublime'} />
<CardWithoutCTA icon={'/assets/neovim_logo.png'} title={'Neovim'} href={'/extensions-plugins/neovim'} />
</Grid>

## Web Browsers
Expand Down
Loading