Setting Up Neovim with Windows Powershell

hoo12f

omnix

Posted on September 11, 2022

Setting Up Neovim with Windows Powershell

I decided to configure my Neovim since it didn't look good and I wanted to supercharge my experience on it with extensions. So, I configured it. Here's how to do that:

Installing Neovim

Unfortunately, you can’t install Neovim using the built-in windows package manager, winget. You have to install another package manager. You can use scoop or chocolatey. I think scoop is better so I’m gonna use Scoop.

Scoop



>>> scoop install neovim


Enter fullscreen mode Exit fullscreen mode

Chocolatey



>>> choco install neovim


Enter fullscreen mode Exit fullscreen mode

and there, you’re done. If you don’t know how to install scoop, go to scoop.sh. Instantly, you will see the installation command. Make sure you are on Powershell! If you have the same problem with chocolatey, there’s an official tutorial here.

Setting up stuff

First, pull up the terminal. Make sure you are in no directory. Now, we’re gonna switch to the AppData directory using cd AppData. Now run cd Local to switch to the local directory. We’re gonna make a directory called “nvim” to store our config in it, and then switch to nvim.



# Change directory to "AppData"
>>> cd Appdata
# Change directory to "Local"
>>> cd Local
# Creates directory called "nvim"
>>> mkdir nvim
# Switches to "nvim" directory
>>> cd nvim


Enter fullscreen mode Exit fullscreen mode

now that you’re in the nvim folder, create a file called init.vim . The first thing we’re gonna do is get Neovim to make that file and enter this command:



>>> nvim init.vim


Enter fullscreen mode Exit fullscreen mode

Setting Up config/init.vim

now, lets add some code in our init.vim



set number


Enter fullscreen mode Exit fullscreen mode

this will automatically run the command “set number ”. The set number command will show the line number. Now, to set a theme and install a filesystem, we need a plugin manager. For this, we’re gonna use vim-plug, an open-source popular vim and Neovim plugin manager/installer. We can install it by using this command in the official README of the project.



iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
    ni "$(@($env:XDG_DATA_HOME, $env:LOCALAPPDATA)[$null -eq $env:XDG_DATA_HOME])/nvim-data/site/autoload/plug.vim" -Force
```

now, if this is in a different directory, move it to your `nvim` directory. You can access it by pressing `⊞ + R`. Now youre at the run menu. Type in `%AppData%` . Now go to `Local > nvim`. Now go to the `vimfiles` folder installed and move the `autoload` folder into the `nvim` folder. Now copy and paste this config:

```bash
call plug#begin()
    Plug 'preservim/nerdtree'
    autocmd VimEnter * NERDTree
    Plug 'navarasu/onedark.nvim'
call plug#end()
```

and then open Neovim using the `nvim` command. Enter command mode by pressing `esc` . Now type in `:PlugInstall` . This will install all of the plugins in the `init.vim` . Now youve installed all of the plugins, go back to the `init.vim` file and type in `colorscheme onedark`. One dark is a theme inspired by the Atom theme, its now available for vim and Neovim. The other plugin is NerdTree, which is a thing that lets you see your files on the left side of Neovim. Now, back to the configuration. If this doesnt work, close your terminal or reload your Neovim and then try again. Now, this is your full config:

```bash
call plug#begin()
    Plug 'preservim/nerdtree'
    autocmd VimEnter * NERDTree
    Plug 'navarasu/onedark.vim'
call plug#end()
colorscheme onedark
```

And, youre pretty much done now! This is what it should look like:

![image](https://user-images.githubusercontent.com/96026994/189510178-cb48573b-3e7a-4a2e-b2f3-7298c2c174e2.png)

Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
hoo12f
omnix

Posted on September 11, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related