Making a beautiful Neovim Config from scratch (BONUS: Godot Support)
Table of Contents
Introduction
In this tutorial, we will create a beautiful Neovim configuration from scratch, tailored for game development with Godot 3 and Godot 4. This guide will cover auto-formatting and auto-completion features that enhance your coding efficiency while ensuring an aesthetically pleasing setup.
Step 1: Install Neovim
-
Download Neovim
- Visit the Neovim releases page and download the latest version suitable for your operating system.
-
Install Neovim
- Follow the installation instructions specific to your OS:
- Windows: Use the installer or unzip the archive into a folder and add it to your PATH.
- macOS: Use Homebrew with the command:
brew install neovim
- Linux: Use your package manager, for example:
sudo apt install neovim
- Follow the installation instructions specific to your OS:
Step 2: Set Up Your Configuration Directory
-
Create the Configuration Folder
- Open your terminal and run:
mkdir -p ~/.config/nvim
- Open your terminal and run:
-
Create the Init File
- Create a new file named
init.vim
:touch ~/.config/nvim/init.vim
- Create a new file named
Step 3: Install a Plugin Manager
-
Choose a Plugin Manager
- Use a popular plugin manager like
vim-plug
. To install:curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
- Use a popular plugin manager like
-
Configure
init.vim
for Plugins- Open
init.vim
and add the following lines to set upvim-plug
:call plug#begin('~/.local/share/nvim/plugged') " Add plugins here call plug#end()
- Open
Step 4: Add Essential Plugins
-
Add Plugins for Godot Support
- Within the
call plug#begin
andcall plug#end()
block, add:Plug 'neovim/nvim-lspconfig' " LSP configurations Plug 'hrsh7th/nvim-cmp' " Autocompletion Plug 'hrsh7th/cmp-nvim-lsp' " LSP source for nvim-cmp Plug 'hrsh7th/cmp-buffer' " Buffer completions Plug 'hrsh7th/cmp-path' " File path completions Plug 'nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate' } " Syntax highlighting
- Within the
-
Install the Plugins
- Open Neovim and run the command:
:PlugInstall
- Open Neovim and run the command:
Step 5: Configure LSP for Godot
-
Set Up LSP for Godot
- Add the following configuration to your
init.vim
:lua << EOF require'lspconfig'.gdscript.setup{} EOF
- Add the following configuration to your
-
Ensure GDScript Language Server is Installed
- Follow the instructions on Godot's LSP documentation to install the GDScript language server.
Step 6: Enable Auto-Formatting
-
Install a Formatting Plugin
- Add the following plugin for formatting:
Plug 'sbdchd/neoformat'
- Add the following plugin for formatting:
-
Configure Auto-Formatting in
init.vim
- Add the following lines:
autocmd BufWritePre *.gd Neoformat
- Add the following lines:
Step 7: Customize Appearance
-
Choose a Color Scheme
- Add a color scheme plugin like:
Plug 'gruvbox-community/gruvbox'
- Add a color scheme plugin like:
-
Set the Color Scheme in
init.vim
- After the
call plug#end()
, add:colorscheme gruvbox set background=dark
- After the
Conclusion
You have successfully created a Neovim configuration that supports Godot development with auto-formatting and auto-completion. To enhance your setup further, consider exploring additional plugins and personalizing your preferences. Keep your configuration updated and enjoy coding in Neovim!