Skip to main content

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.

Install via GitHubInstall via GitHub

Prerequisites

  • Pieces OS installed on your machine.
  • Neovim installed on your machine.
  • Python 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:

    pip install pynvim
  • 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:

    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:

    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:

    vim.cmd [[packadd pieces.nvim]]

Steps

Step 1: Install the Pieces Neovim Plugin

  1. Ensure Pieces OS is installed and running on your system

  2. Open the init.vim file with a text editor (you can use Neovim itself):

    nvim ~/.config/nvim/init.vim
  3. Add the following lines to the init.vim file:

    " 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'

    call plug#end()

    If you're using Neovim to edit, press <Esc>, then type :wq and press <Enter> to save and quit.

  4. Install the plugins: Open Neovim again and run the following command:

    :PlugInstall

    This will install all the plugins specified.

  5. After the installation is complete, add the Pieces configuration to your init.vim:

    lua << EOF
    require("pieces_config").host = "http://localhost:1000"
    EOF
  6. Save and exit (:wq in Neovim). Now run the following command inside Neovim to update the remote plugins:

    :UpdateRemotePlugins

Step 2: Use the Neovim Plugin

  1. Open Neovim using the nvim command in your terminal.

  2. Run the following command to verify the installation:

    :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 can run the following command in your terminal:

nvim +UpdateRemotePlugins

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.