Cursor plugin for Neovim?

My setup is like this:

In init.lua:

if vim.g.vscode then
    require "vscode_keymaps"
    require "options"
else
    ... my normal neovim config

then in vscode_keymaps define your vscode/cursor stuff. For example:

local keymap = vim.keymap.set
local opts = {
    noremap = true,
    silent = true
}

-- remap leader key
keymap("n", "<Space>", "", opts)
vim.g.mapleader = " "
vim.g.maplocalleader = " "

-- general keymaps
keymap({"n", "v"}, "<leader>t", "<cmd>lua require('vscode').action('workbench.action.terminal.toggleTerminal')<CR>")
keymap({"n", "v"}, "<leader>b", "<cmd>lua require('vscode').action('editor.debug.action.toggleBreakpoint')<CR>")
keymap({"n", "v"}, "<leader>d", "<cmd>lua require('vscode').action('editor.action.showHover')<CR>")
keymap({"n", "v"}, "<leader>a", "<cmd>lua require('vscode').action('editor.action.quickFix')<CR>")
keymap({"n", "v"}, "<leader>sp", "<cmd>lua require('vscode').action('workbench.actions.view.problems')<CR>")
keymap({"n", "v"}, "<leader>cn", "<cmd>lua require('vscode').action('notifications.clearAll')<CR>")
keymap({"n", "v"}, "<leader>ff", "<cmd>lua require('vscode').action('workbench.action.quickOpen')<CR>")
keymap({"n", "v"}, "<leader>cp", "<cmd>lua require('vscode').action('workbench.action.showCommands')<CR>")
keymap({"n", "v"}, "<leader>pr", "<cmd>lua require('vscode').action('code-runner.run')<CR>")
keymap({"n", "v"}, "<leader>fd", "<cmd>lua require('vscode').action('editor.action.formatDocument')<CR>")

Most important in my setup are they autocmdā€™s. See my options.lua where I let the editor return from Insert mode to Normal mode after a timeout.

vim.api.nvim_create_autocmd("InsertEnter", {
    callback = function()
        if is_normal_buffer() then
            vim.b.updaterestore = vim.opt.updatetime:get()
            vim.opt.updatetime = 10000
        end
    end
})

vim.api.nvim_create_autocmd("InsertLeave", {
    callback = function()
        if is_normal_buffer() and vim.b.updaterestore then
            vim.opt.updatetime = vim.b.updaterestore
            vim.b.updaterestore = nil
        end
    end
})

Hope this helps

2 Likes

Hey sorry for the late response. I love the If at the beginning, i didnā€™t know one could do that. Ill give that a shot thank you

Hello. Iā€™m exactly that person as well

+100000000

2 Likes

+1 for this

1 Like

+1 for Cursor tab and multiline suggestions

+1 for this

1 Like

+1, I love Cursor, but I ultimately chose not to use it because I canā€™t give up Neovim.

1 Like

+1 Please :pray:

I would greatly appreciate this feature. Alternatively, a guide on how to set up Cursor using neovim as the IDE inside (I know VSCode can do this) so that it seamlessly works with applying code would be very much appreciated.

+1 Please

+1 please considerate it, itā€™s really a pain in the ā– ā– ā–  to switch between those 2 tools, both of them being for me the greatest tools for productivity

1 Like

+1!!

Why couldnā€™t Santa bring this to us?!

+1 , literally created an account just to say this lol

Unfortunately, itā€™s highly unlikely for Cursor to be available in NeoVim as a plugin.

Being its own standalone editor, a lot of Cursorā€™s power comes from its ability to have total access to your IDE. This is mainly why we chose not to develop as an extension for any existing IDE, like the VSCode or Neodim.

I think the cursor tab feature can be implemented as the neovim provides the API to access the buffer and display the ghost text.

out of curiosity, what aspects of neovim are inaccessible to the developer that make this unrealistic? It seems enough of the community wants this that feature requests could be made to neovim to help make this possible.