DEV Community

Cover image for Set Up Neovim with kickstart.nvim on Mac as a Vimginner
SeongKuk Han
SeongKuk Han

Posted on

Set Up Neovim with kickstart.nvim on Mac as a Vimginner

5 stage vim the prime video thumbnail

https://www.youtube.com/watch?v=uYXlgZKdsFM&t=412s


Recently, I have been watching a lot of videos on ThePrimeTime channel. He sometimes mentioned vim in his videos. It may have developed my curiosity about vim. Actually, I gave vim a try and it completely failed. I just turned on syntax highlighting and number lines and gave up. Today, I watched a video titled The 5 Stages of Vim where he reviewed an article The 5 Stages of Vim: A Humbling Experience. I decided to give it a try once more, but Neovim not vim, in the video, he mentioned kickstart, which comes with useful plugins. I thought it might be working this time.

I set it up quite successfully, and I'm going to share the process in this article, which I have done.

FYI, my laptop is MacBook Air M1, 2020 and the version of macOS is Sonoma 14.2.1.

I'm going to share in this order:


Install Neovim

1. Open https://github.com/neovim/neovim/blob/master/INSTALL.md

2. Unzip the zip file where you want to unzip in

I just unzipped it in the home directory.

nvim folder in home directory


Set up Kickstart

1. Open https://github.com/nvim-lua/kickstart.nvim

2. Clone git with the command shown in the README

guide in the github

If XDG_CONFIG_HOME is not set, the project will be cloned in $HOME/.config/nvim.

3. Execute nvim

execute nivm

Everything will be set up automatically.


Install a new terminal WezTerm

reddit article

https://www.reddit.com/r/neovim/comments/154280j/fresh_install_of_kickstartnvim_why_are_my_colors/

This is the problem I encountered. Nvim Color is broken. It turns out that using nvim in the default terminal of Mac has this issue. There are many options out there but I decided to install WezTerm terminal, there is no specific reason for choosing this one. I'm a newbie, choosing the best one is not what I have to do right now. I will figure out which terminal will fit me.

You can install a terminal you prefer to use or you may have one already.

1. Open https://wezfurlong.org/wezterm/install/macos.html

2. Install WezTerm. There is a step-by-step guide on the website.

Now, you must open the new terminal app instead of the default terminal on macOS to use nvim.


Open Neovim through vi or vim commands

I think there are other ways for this but I will explain what I've done.

1. Create a folder bin under the home directory.



mkdir ~/bin


Enter fullscreen mode Exit fullscreen mode

2. Create a soft link file



ln -s ~/nvim-macos/bin/nvim ~/bin/nvim


Enter fullscreen mode Exit fullscreen mode

nvim softlink

3. Add the custom bin folder in $Path env and aliases for vi and vim.

In the .zprofile, add the following lines. If you don't have the .zprofile under the home directory, you should create the file.



export PATH="$HOME/bin:${PATH}"

# open neovim with vi command
alias vim="nvim"
alias vi="nvim"


Enter fullscreen mode Exit fullscreen mode

zprofile

4. Load zprofile



source ~/.zprofile


Enter fullscreen mode Exit fullscreen mode

If you reopen the terminal, you don't need to load zprofile manually, it will be applied when you open a terminal.

I created a custom bin directory, considering that I may get some more executable files in the future.


Some Neovim Tips

Now, we're ready to use nvim. There are lots of commands and features. They are what we have to put some time into to get used to it. It's not what we can be good at right away just because we know them. To replace vscode with nvim, I wanted to know three things that I think it is necessary.


1. File Browsing

Telescope is a plugin included in kickstart.

Press Space then, s. You will get to see options once you press Space.
Also, you can use it :Telescope [command | you can find a command using tab].


2. Move between split screens and tabs

If you open a file in Telescope with a key Ctrl + T or Ctrl + V, you will open the file in a vertical tab(Ctrl + V) or a new tab(Ctrl + T).

It is really cool how it works in the terminal, anyway, I needed to know how to move between tabs and screens without a mouse. As I decide to use vim, I don't want to use a mouse.

Move to the left screen: Ctrl + W, then h.
Move to the right screen: Ctrl + W, then l.

In fact, the h and l keys are the same when you move a cursor.

Move to the next tab: gt.
Move to the previous tab: gT.
Move to the Nth tab: [number] + gt.


3. Comment Multiple Lines

1. Enter VISUAL BLOCK mode (Ctrl + V) and move a cursor up and down where you want to make comments

visual block

2. Enter INSERT mode (Shift + I) and write comment signs

insert mode

3. Break INSERT mode (ESC)

multiple comments


Conclusion

I just made one step for the vim world. vim was an editor that I always wanted to try because it looks so cool, of course, it's light and fast, you can even use it in the terminal. But after a couple of failures, I stopped giving it a try and when I saw people using vim, I gave them a weird look. I can't reach them, then I make it bad.

Now, with nvim and kickstart, I could start it easier than ever. I saw some videos talking about vim and they say once you get used to it, you can be way more productive. Also, it comes with a bunch of useful plugins. There is one thing more, it's just what I imagine though, it could be good for brain exercise, you know, all the commands and key combinations, most importantly, you can enjoy coming from learning new things. When you learn a new programming language and its concept and philosophy, you realize that what you have known can be different and there are so many ways out there. For example, it's what ThePrimeTime said though, placing file explorer on the side of an editor is what it has to be as I thought, When I realized it doesn't have to be, it was kind of shocking and an amazing experience. You know, breaking stereotypes. I'm very looking forward to using it.

I hope I settle down well in the stage 4: Embracing the Suck.

Happy Coding!

Top comments (0)