Opens an external site in a new window
Pride Month Hold my hand 🫱🏾‍🫲🏼
RODNEY LAB
  • Home
  • Plus +
  • Newsletter
  • Links
  • Profile
RODNEY LAB
  • Home
  • Plus +
  • Newsletter
  • Links

Unreal Engine with Neovim: Config for Game Development 🎮️ # Unreal Engine with Neovim: Config for Game Development 🎮️ #

blurry low resolution placeholder image Unreal Engine with Neovim
  1. Home Rodney Lab Home
  2. Blog Posts Rodney Lab Blog Posts
  3. C++ C++ Blog Posts
<PREVIOUS POST
NEXT POST >
LATEST POST >>

Unreal Engine with Neovim: Config for Game Development 🎮️ #

Published: 2 years ago
4 minute read
Gunning Fog Index: 6.7
Content by Rodney
blurry low resolution placeholder image Author Image: Rodney from Rodney Lab
SHARE:

🧑🏽‍💻 Why use Neovim with Unreal Engine? #

In this post, we see how you can work in Unreal Engine with Neovim for game development. Unreal Engine lets you define game logic using Blueprints (a codeless Visual Scripting UI) or C++. We focus on C++ in this post. The solution has been tested on macOS, but might also run just fine on Linux, and possibly Windows. Please let me know either way how you fared, if you tried those alternatives.

Officially, Unreal Engine does not support Neovim. That said, you might still prefer to opt for a lightweight text Neovim editor, like Neovide, which has a small memory footprint — useful when you have a resource-intensive game open, in the background in the Unreal Engine Editor. Neovide, written in Rust, is a no-nonsense, cross-platform Neovim GUI. Of course, it supports code code completions, quick fixes and other features you will expect from a modern editor.

If you are just looking to use Vim movements to make your editing more efficient, there is another alternative. You might consider using CLion or VS Code as your editor, and adding a Vim plugin that will let you use those Vim movements. This post targets readers who are already familiar with Neovim, LSP and setting up plugins, though there are links included for guides, which might be helpful for anyone not yet comfortable configuring Neovim.

🎮 Editing Unreal Engine C++ Code in Neovim #

We jump straight in to configuring Neovim here. If you want to know how to set up Unreal Engine on macOS, or use VS Code as your editor, see the UE5 macOS post. However, if you appreciate the benefits of a lean editor like Neovide , let’s see how to configure Neovim to run with Unreal Engine.

On macOS, Unreal Engine uses the Clang compiler. Clang is highly configurable and fantastic for working with Neovim. You will need the LSP plugin with Clang set up in your Neovim installation to get code completion, linting, quick fixes and so on.

Unreal Engine does not officially support Neovim, but to generate project files required below, you can use Unreal Engine, as described in the UE5 macOS post. For a detailed guide on setting up Neovim generally, with LSP and more, see this excellent tutorial from Jake Wiesler .

For LSP with Plug you will add something like this to your Neovim init.vim config file:

~/.config/init.vim
lua
    
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'

The last two plugins help provide autocompletion.

Then, add some Clang-specific config to your LSP config:

    
local on_attach = function(client, bufnr)
-- TRUNCATED...
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
local servers = { 'clangd' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
capabilities = capabilities,
on_attach = on_attach,
}
end

Apart from this config, you shouldn’t need any more setup, just to have Clang 11 or newer installed on your system, which you should already have from installing Xcode. You can see LSP Clang configuration options in the project GitHub repo , though.

Creating a Project compile_commands.json #

To get the most out of Neovim, you will need one more config file: compile_commands.json. This is a Clang requirement, which lets the compiler tooling provide completions and lints for your Unreal project. You can generate it by running a command, from the Terminal:

    
"/Users/Shared/Epic Games/UE_5.3/Engine/Build/BatchFiles/Mac/Build.sh" \
-mode=GenerateClangDatabase \
-project=/Path/to/your/project/YourProjectName/YourProjectName.uproject \
-game -engine [YourProjectName]Editor Mac Development

Update the Unreal Engine path if you are using a different version or have it installed elsewhere.

If this has run successfully, you should see a message telling you where Unreal Engine output the JSON file to:

    
ClangDatabase written to /Users/Shared/Epic Games/UE_5.3/compile_commands.json

Copy this output file to the root folder of your project, and now you should have code completion etc..

blurry low resolution placeholder image Unreal Engine with Neovim: Screen capture shows an Unreal Engine C++ actor file being edited in Neovim.  The user has pulled up the documentation for the Unreal Engine SetActorLocation A P I, shown in the top half of the editor window.
Unreal Engine with Neovim: Unreal C++ API Documentation in Neovim

Building your project from the Terminal #

To build your project, you will run command:

    
/Users/Shared/Epic Games/UE_5.3/Engine/Build/BatchFiles/Mac/Build.sh \
"/Path/to/your/project/YourProjectName/YourProjectName.uproject" \
-game -engine [YourProjectName]Editor Target Development Mac

Again, update the command to match your Unreal Engine version and exact path. See other available build commands by scanning through the [YourProjectName].code-workspace file in the root directory of your project.

🗳 Poll #

Which is your preferred Vim-like editor?
Voting reveals latest results.

🛁 Adding Linting Configuration #

To add linting to your Unreal project, using Clang tooling, just add a .clang-tidy file to your project root directory. If you do not yet have one, as a starting point, choose:

  • the .clang-tidy config used in the VS Code C/C++ Config Extension ; or
  • an alternative .clang-tidy from a C++ Best Practices repo  by Jason Turner.

🙌🏽 Unreal Engine with Neovim: Wrapping Up #

In this Unreal Engine with Neovim post, we saw how you can get going with game development in Unreal Engine and Neovim. More specifically, we saw:

  • a resource for setting up Unreal Engine for C++ coding with macOS;
  • how to generate a Clang compile_commands.json file for your Unreal Engine project; and
  • how to configure Neovim with Unreal Engine code quick fixes, lints and more.

I hope you found this useful. Do let me know if you found this content useful and would like to see more similar content. Also reach out if there is anything I could improve to provide a better experience for you.

🙏🏽 Unreal Engine with Neovim: Feedback #

If you have found this post useful, see links below for further related content on this site. Let me know if there are any ways I can improve on it. I hope you will use the code or starter in your own projects. Be sure to share your work on X, giving me a mention, so I can see what you did. Finally, be sure to let me know ideas for other short videos you would like to see. Read on to find ways to get in touch, further below. If you have found this post useful, even though you can only afford even a tiny contribution, please consider supporting me through Buy me a Coffee.

blurry low resolution placeholder image ask Rodney X (formerly Twitter) avatar

Rodney

@askRodney

Just dropped a new post on generating a compile_commands.json file for your Unreal project, opening up access to quick fixes, code completion and API documentation.

All thanks to the Clang LSP plugin for Neovim.

Hope you find the post useful!

https://t.co/1w2RtE2cqT

— Rodney (@askRodney) January 24, 2024

Finally, feel free to share the post on your social media accounts for all your followers who will find it useful. As well as leaving a comment below, you can get in touch via @askRodney on X (previously Twitter) and also, join the #rodney  Element Matrix room. Also, see further ways to get in touch with Rodney Lab. I post regularly on Game Dev as well as Rust and C++ (among other topics). Also, subscribe to the newsletter to keep up-to-date with our latest projects.

Thanks for reading this post. I hope you found it valuable. Please get in touch with your feedback and suggestions for posts you would like to see. Read more about me …

blurry low resolution placeholder image Rodney from Rodney Lab
TAGS:
C++GAMING

Related Post

blurry low resolution placeholder image UE5 AI Hearing C++: Unreal Engine Perception Example 🎮

UE5 AI Hearing C++: Unreal Engine Perception Example 🎮

c++
gaming
<PREVIOUS POST
NEXT POST >
LATEST POST >>

Leave a comment …

Your information will be handled in line with our Privacy Policy .

Ask for more

1 Nov 2022 — Astro Server-Side Rendering: Edge Search Site
3 Oct 2022 — Svelte eCommerce Site: SvelteKit Snipcart Storefront
1 Sept 2022 — Get Started with SvelteKit Headless WordPress

Copyright © 2020 – 2025 Rodney Johnson. All Rights Reserved. Please read important copyright and intellectual property information.

  • Home
  • Profile
  • Plus +
  • Newsletter
  • Contact
  • Links
  • Terms of Use
  • Privacy Policy
We use cookies  to enhance visitors’ experience. Please click the “Options” button to make your choice.  Learn more here.