How to use Neovim in Cursor IDE

For those who want Neovim in Cursor. I have it working, including my Lua config and AutoCommands. It’s really neat.

  • Install the ‘VSCode Neovim’ extension, by asvetliakov

If you use vim.cmd in your lua files, then change them to: pcall(vim.cmd, …)

Tip: let Cursor assist you with making those changes correctly :grinning:
This will make it run smoothly in plain Neovim AND in the Cursor IDE.

UPDATE:
After using this setup for a while, I found that some keyboard shortcuts are intercepted by the editor instead of Neovim. For example, when I used Ctrl-Q for a multi-line operation, it turned out to be the Exit shortcut in Cursor IDE.
So, some tweaking of the keyboard shortcuts is needed. But it’s worth the effort if you really want to use Neovim. You’ll quickly figure out which shortcuts need to be changed.

Could you share which keybinds you’ve had to change?

In the end, I found it easier to change the keyboard shortcuts in Neovim to match those in Cursor and VS Code.

For example, I originally used Ctrl + L as my shortcut for :bd. Since this is used for the chat window in Cursor, I could have redefined it in Cursor to another keybinding. However, it was simpler to add Ctrl + PgDn to my Neovim setup and then stick to Ctrl + PgDn for iterating through editor buffers. I got used to it fairly quickly.

The same applies to closing buffers. My custom keybinding in Neovim was Ctrl + X, but Cursor and many other programs use Ctrl + W. So, I changed my Neovim keybinding to Ctrl + W as well.

The only annoying exception is Ctrl + Q, which forcefully exits Cursor instead of performing a block operation in the editor. However, Ctrl + V can easily be used as an alternative.

This is how I approach the situation: whenever I come across a keybinding difference between my Neovim configuration and Cursor, I decide which one to change to make them consistent.